Skip to content
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

feat: remove check for screens enabled in native stack #922

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/createNativeStackNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,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