通过安卓或Ios在跳转时候带过来的参数,可以利用viewName来判断哪些路由需要加载,精确制导,并且可以携带token过来,实现react native请求。

import React from 'react'
import { Provider } from 'react-redux'
import { store, dispatch, actions } from './store/index'
import Router from './router/index'
import PublishRouter from './router/publishRouter'

const App = (props) => {
  let { viewName, token } = props
  if (viewName === 'publish') {
    dispatch(actions.globalActions.setToken(token))
    return (
      <Provider store={store}>
        <PublishRouter />
      </Provider>
    )
  }
  return (
    <Provider store={store}>
      <Router />
    </Provider>
  )
}

export default App