Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3362537
D9261.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D9261.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 25, 11:00 PM (20 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2581266
Default Alt Text
D9261.diff (1 KB)
Attached To
Mode
D9261: [native] introduce useNavigateToUserProfileBottomSheet hook
Attached
Detach File
Event Timeline
Log In to Comment