diff --git a/native/utils/user-profile-utils.js b/native/utils/user-profile-utils.js new file mode 100644 --- /dev/null +++ b/native/utils/user-profile-utils.js @@ -0,0 +1,24 @@ +// @flow + +import { useNavigation } from '@react-navigation/native'; +import * as React from 'react'; + +import { UserProfileBottomSheetRouteName } from '../navigation/route-names.js'; + +function useNavigateToUserProfileBottomSheet(): (userID: string) => mixed { + const { navigate } = useNavigation(); + + return React.useCallback( + (userID: string) => { + navigate<'UserProfileBottomSheet'>({ + name: UserProfileBottomSheetRouteName, + params: { + userID, + }, + }); + }, + [navigate], + ); +} + +export { useNavigateToUserProfileBottomSheet };