Skip to content

Commit

Permalink
fix: disable react-native-screens on iOS for older versions
Browse files Browse the repository at this point in the history
  • Loading branch information
satya164 committed Nov 4, 2020
1 parent e3e58c2 commit ce7d20e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/bottom-tabs/src/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ export type BottomTabNavigationConfig<T = BottomTabBarOptions> = {
/**
* Whether inactive screens should be detached from the view hierarchy to save memory.
* Make sure to call `enableScreens` from `react-native-screens` to make it work.
* Defaults to `true`.
* Defaults to `true` on Android.
*/
detachInactiveScreens?: boolean;
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/stack/src/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ export type StackNavigationConfig = {
/**
* Whether inactive screens should be detached from the view hierarchy to save memory.
* Make sure to call `enableScreens` from `react-native-screens` to make it work.
* Defaults to `true`.
* Defaults to `true` on Android, depends on the version of `react-native-screens` on iOS.
*/
detachInactiveScreens?: boolean;
};
Expand Down
5 changes: 3 additions & 2 deletions packages/stack/src/views/Stack/CardStack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,9 @@ export default class CardStack extends React.Component<Props, State> {
onGestureStart,
onGestureEnd,
onGestureCancel,
// Enable on new versions of screens or for non modals on older versions
detachInactiveScreens = shouldUseActivityState || mode !== 'modal',
// Enable on new versions of `react-native-screens`
// On older versions of `react-native-screens`, there's an issue with screens not being responsive to user interaction.
detachInactiveScreens = shouldUseActivityState,
} = this.props;

const { scenes, layout, gestures, headerHeights } = this.state;
Expand Down

0 comments on commit ce7d20e

Please sign in to comment.