dva-native
encapsulating react-navigation@2.x, dva, axios and Mock.js for react-native
You can use dva-native-cli
Start
npm install --save dva-native //
Api
Export Files
dva-native
Default export file
;
dva-native/navigation
Export the api of react-navigation@2.x
;
dva-native/axios
Async request library, export axios
;// if you want to print the request log;
dva-native/mock
Export Mock.js
;
dva-native/dynamic
Load components on dynamic. For convenience debug, only in production mode. metro is commonJs standard. If you want to split bundle, use react-native unbundle in android
; const DynamicComponent = ;
dva-native/codePushConfig
If use react-native-code-push, Configuring some environmental params, but codePush.getConfiguration is a Promise. You may not be able to get it in time
; app app
dva-native API
createApp.setGlobalError
Call ErrorUtils.setGlobalHandler. Reset Capture javascript errors, only in production mode
// If you use react-native-sentry, must Call before itcreateAppSentry;
createApp.onGlobalError
Add listener for javascript error
createApp
dynamic.setErrorComponent
If you run js context error and use setGlobalError, set a ErrorComponent to show
dynamic
app = createApp(...dva opts)(getAppNavigator)
Create dva instance
If use react-navigation, getAppNavigator
must return Navigator
{ const wrapper = ; return }
app.config
Configure some params
app// orapp
app.getConfig
Return config params
app
app.root
This is necessary, and must return React Component
app
app.start
Register Root Component
AppRegistry;