Skip to content

Commit

Permalink
feat: remove check for screens enabled in native stack (#922)
Browse files Browse the repository at this point in the history
Removed the check for enabling RNScreens for `native-stack` v4 and v5. It is not necessary since there is no point in using `native-stack` and not enabling the `react-native-screens` for its' components.
  • Loading branch information
WoLewicki committed May 20, 2021
1 parent b58a3e9 commit 6739b8c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/createNativeStackNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ class StackView extends React.Component<Props> {
return (
<Screen
key={`screen_${route.key}`}
enabled
style={[StyleSheet.absoluteFill, options.cardStyle]}
stackAnimation={stackAnimation}
stackPresentation={stackPresentation}
Expand Down
7 changes: 0 additions & 7 deletions src/native-stack/navigators/createNativeStackNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
useNavigationBuilder,
} from '@react-navigation/native';
import * as React from 'react';
import { screensEnabled } from 'react-native-screens';
import {
NativeStackNavigationEventMap,
NativeStackNavigationOptions,
Expand All @@ -24,12 +23,6 @@ function NativeStackNavigator({
screenOptions,
...rest
}: NativeStackNavigatorProps) {
if (!screensEnabled()) {
throw new Error(
'Native stack is only available if React Native Screens is enabled.'
);
}

const { state, descriptors, navigation } = useNavigationBuilder<
StackNavigationState<ParamListBase>,
StackRouterOptions,
Expand Down
3 changes: 2 additions & 1 deletion src/native-stack/views/NativeStackView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const maybeRenderNestedStack = (
if (isHeaderInModal) {
return (
<ScreenStack style={styles.container}>
<Screen style={StyleSheet.absoluteFill}>
<Screen enabled style={StyleSheet.absoluteFill}>
<HeaderConfig {...options} route={route} />
<Container
style={viewStyles}
Expand Down Expand Up @@ -151,6 +151,7 @@ export default function NativeStackView({
return (
<Screen
key={route.key}
enabled
style={StyleSheet.absoluteFill}
gestureEnabled={isAndroid ? false : gestureEnabled}
replaceAnimation={replaceAnimation}
Expand Down

0 comments on commit 6739b8c

Please sign in to comment.