Last active
April 25, 2021 09:51
-
-
Save jjylik/62e9afe0a5d5f94f443beeeaf2d8edc2 to your computer and use it in GitHub Desktop.
React native inline requires
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const RootStack = (): JSX.Element => { | |
return ( | |
<Stack.Navigator initialRouteName={initialRouteName}> | |
<Stack.Screen | |
name="SomeScreenWithLazyWrapper" | |
component={ScreenWrapper} | |
options={{title: 'Screen 1'}} | |
/> | |
<Stack.Screen | |
name="SomeScreenWithGetComponent" | |
getComponent={() => require('./ScreenImplementation').default} | |
options={{title: 'Screen 1'}} | |
/> | |
</Stack.Navigator> | |
); | |
}; | |
export const ScreenWrapper = (props: ScreenProps): JSX.Element => { | |
// eslint-disable-next-line @typescript-eslint/no-var-requires | |
const ScreenImplementation = require('./ScreenImplementation.tsx').default; | |
return <ScreenImplementation {...props} />; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment