Page MenuHomePhorge

D9261.1767191828.diff
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

D9261.1767191828.diff

diff --git a/native/user-profile/user-profile-utils.js b/native/user-profile/user-profile-utils.js
new file mode 100644
--- /dev/null
+++ b/native/user-profile/user-profile-utils.js
@@ -0,0 +1,40 @@
+// @flow
+
+import { useNavigation } from '@react-navigation/native';
+import _throttle from 'lodash/throttle.js';
+import * as React from 'react';
+
+import {
+ UserProfileBottomSheetRouteName,
+ UserProfileBottomSheetNavigatorRouteName,
+} from '../navigation/route-names.js';
+
+function useNavigateToUserProfileBottomSheet(): (userID: string) => mixed {
+ const { navigate } = useNavigation();
+
+ return React.useMemo(
+ () =>
+ _throttle(
+ (userID: string) => {
+ navigate<'UserProfileBottomSheetNavigator'>(
+ UserProfileBottomSheetNavigatorRouteName,
+ {
+ screen: UserProfileBottomSheetRouteName,
+ params: {
+ userID,
+ },
+ key: `${UserProfileBottomSheetNavigatorRouteName}|${UserProfileBottomSheetRouteName}|${userID}`,
+ },
+ );
+ },
+ 500, // 500ms throttle delay
+ {
+ leading: true,
+ trailing: false,
+ },
+ ),
+ [navigate],
+ );
+}
+
+export { useNavigateToUserProfileBottomSheet };

File Metadata

Mime Type
text/plain
Expires
Wed, Dec 31, 2:37 PM (6 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5873847
Default Alt Text
D9261.1767191828.diff (1 KB)

Event Timeline