Purpose of RNN Screens is to simplify and accelerate the process of React Native App development with React Native Navigation. It is not a replacement for RNN but a good addition!
Make sure you have react-native-navigation installed in your project.
yarn add rnn-screens
import {generateRNNScreens, Root, Stack, Component, BottomTabs} from 'rnn-screens';
export const screens = generateRNNScreens({
Main: {
component: Main,
options: {
topBar: {
title: {
text: 'Home',
},
},
},
},
Settings: {
component: Settings,
options: {
topBar: {
title: {
text: 'Settings',
},
},
},
},
});
// One screen app
screens.N.setRoot(Root(Stack(Component(screens.get('Main')))));
// Tab based app
screens.N.setRoot(
Root(
BottomTabs([
Stack(Component(screens.get('Main'))),
Stack(Component(screens.get('Settings'))),
]),
),
);
// push screen
screens.push(componentId, 'Example');
// show modal
screens.show('Example');
// push screen with passProps
screens.push<ExampleScreenProps>(
componentId,
'Example',
{ value: randomNum() },
)
An integration example could be found at kanzitelli/rnn-starter.
Thanks to the team @ Wix behind React Native Navigation!
This project is MIT licensed