Repository navigation
fix: RHN flashes if dismissed using swipe from the edge gesture #81622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,13 +2,16 @@ import type {StackCardInterpolationProps} from '@react-navigation/stack'; | |
| import useResponsiveLayout from '@hooks/useResponsiveLayout'; | ||
| import useStyleUtils from '@hooks/useStyleUtils'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
| import {isMobileSafari} from '@libs/Browser'; | ||
| import Animations from '@libs/Navigation/PlatformStackNavigation/navigationOptions/animation'; | ||
| import type {PlatformStackNavigationOptions} from '@libs/Navigation/PlatformStackNavigation/types'; | ||
| import variables from '@styles/variables'; | ||
| import CONFIG from '@src/CONFIG'; | ||
| import hideKeyboardOnSwipe from './hideKeyboardOnSwipe'; | ||
| import useModalCardStyleInterpolator from './useModalCardStyleInterpolator'; | ||
|
|
||
| const IS_MOBILE_SAFARI = isMobileSafari(); | ||
|
|
||
| type SplitNavigatorScreenOptions = { | ||
| sidebarScreen: PlatformStackNavigationOptions; | ||
| centralScreen: PlatformStackNavigationOptions; | ||
|
|
@@ -51,10 +54,11 @@ const useSplitNavigatorScreenOptions = () => { | |
| ...hideKeyboardOnSwipe, | ||
| headerShown: false, | ||
| title: CONFIG.SITE_TITLE, | ||
| animation: shouldUseNarrowLayout ? Animations.SLIDE_FROM_RIGHT : Animations.NONE, | ||
| animation: shouldUseNarrowLayout && !IS_MOBILE_SAFARI ? Animations.SLIDE_FROM_RIGHT : Animations.NONE, | ||
| animationTypeForReplace: 'pop', | ||
| web: { | ||
| cardStyleInterpolator: (props: StackCardInterpolationProps) => modalCardStyleInterpolator({props, isFullScreenModal: true, shouldAnimateSidePanel: true}), | ||
| cardStyleInterpolator: (props: StackCardInterpolationProps) => | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❌ PERF-13 (docs)The Use the same module-level constant suggested above: const IS_MOBILE_SAFARI = isMobileSafari();
// In the hook:
modalCardStyleInterpolator({props, isFullScreenModal: true, shouldAnimateSidePanel: true, animationEnabled: !IS_MOBILE_SAFARI})Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @paulnjs Please check this comment. |
||
| modalCardStyleInterpolator({props, isFullScreenModal: true, shouldAnimateSidePanel: true, animationEnabled: !IS_MOBILE_SAFARI}), | ||
| cardStyle: shouldUseNarrowLayout ? StyleUtils.getNavigationModalCardStyle() : themeStyles.h100, | ||
| }, | ||
| }, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ PERF-13 (docs)
The
isMobileSafari()function is called on every render of this hook since its not memoized. The function performs user agent string parsing which is expensive work that could be hoisted outside the hook.Consider storing the result in a constant at module level:
This pattern is already used elsewhere in the codebase (e.g.,
src/components/FlatList/index.tsx).Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@paulnjs Please check this comment.