The goal of this project is to minimize the responsibilities of every component. Fitting with the 'pure function' paradigms, we will extract component logic into Redux. This project also explores view-to-view navigation in React Native.
Why?
React is the View Layer in MVC, so it should only be responsible for taking logic and rendering it.
$ npm install
$ react-native run-android
Install dependencies:
$ npm install --save react-navigation
$ npm install --save react-native-router-flux
$ npm install --save mobx
$ npm install --save mobx-react
$ npm install --save prop-types
Change your Router.js to:
const RouterComponent = () => {
return (
<Router>
<Scene key="root">
<Scene key="login" component={LoginForm} title="Please Login" />
</Scene>
</Router>
)
}
If any issues:
This package.json snippet was added for unit test purposes:
See: https://reactnavigation.org/docs/guides/redux
"jest": {
"preset": "react-native",
"transformIgnorePatterns": [
"node_modules/(?!(jest-)?react-native|react-navigation)"
]
},
Used for efficient data collection and CSS editing
See: https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-jsx-source
$ npm install --save-dev babel-plugin-transform-react-jsx-source
{
"plugins": ["transform-react-jsx-source"]
}