Skip to content

Commit

Permalink
Make updates for react-native-router-flux
Browse files Browse the repository at this point in the history
  • Loading branch information
Noah Malmed committed Feb 8, 2018
1 parent 9bc75dd commit ffad1c8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/components/NavBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class NavBar extends Component {
}

handleSideDrawer(){
Actions.refresh({key: 'drawer', open: true })
Actions.drawerOpen()
}

render() {
Expand Down
3 changes: 1 addition & 2 deletions src/components/SideDrawerContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ export class SideDrawerContent extends Component {
}

close() {
//Timeout used due to open issue: https://github.com/aksonov/react-native-router-flux/issues/1125
setTimeout(() => Actions.refresh({key: 'drawer', open: false }), 0)
Actions.drawerClose();
}

goHome(){
Expand Down
38 changes: 19 additions & 19 deletions src/containers/app.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, {Component} from 'react'
import { AppState, Navigator, NetInfo } from 'react-native'
import { createStore, applyMiddleware } from 'redux'
import { composeWithDevTools } from 'remote-redux-devtools';
import { AppState, NetInfo } from 'react-native'
import { Provider } from 'react-redux'
import reducer from '../reducers/index'
import thunkMiddleware from 'redux-thunk'
import {Scene, Router} from 'react-native-router-flux'
import {Scene, Router, Drawer} from 'react-native-router-flux'
import { setIsConnected, fetchAllProjects, setState } from '../actions/index'
import { loadUserData } from '../actions/user'
import { setSession } from '../actions/session'
Expand All @@ -18,7 +18,7 @@ import PublicationList from '../components/PublicationList'
import SignIn from '../components/SignIn'
import Register from '../components/Register'
import Settings from '../components/Settings'
import SideDrawer from '../components/SideDrawer'
import SideDrawerContent from '../components/SideDrawerContent'
import ZooWebView from '../components/ZooWebView'
import Onboarding from '../components/Onboarding'
import SwipeClassifier from '../components/SwipeClassifier'
Expand All @@ -40,30 +40,30 @@ export default class App extends Component {
const dispatchConnected = isConnected => store.dispatch(setIsConnected(isConnected))
NetInfo.isConnected.fetch().then(isConnected => {
store.dispatch(setState('isConnected', isConnected))
NetInfo.isConnected.addEventListener('change', dispatchConnected)
NetInfo.isConnected.addEventListener('connectionChange', dispatchConnected)
})
store.dispatch(fetchAllProjects())
}

render() {
return (
<Provider store={store}>
<Router ref="router">
<Scene ref="drawer" key="drawer" component={SideDrawer} open={false}>
<Scene key="main" tabs={false} >
<Scene key="SignIn" component={SignIn} duration={0} type="reset" sceneConfig={Navigator.SceneConfigs.FloatFromLeft} />
<Scene key="ZooniverseApp" component={ZooniverseApp} initial />
<Scene key="ProjectDisciplines" component={ProjectDisciplines} />
<Scene key="About" component={About} />
<Scene key="Publications" component={PublicationList} />
<Scene key="ProjectList" component={ProjectList} />
<Scene key="Register" component={Register} />
<Scene key="Settings" component={Settings} />
<Scene key="ZooWebView" hideNavBar={true} component={ZooWebView} duration={0} />
<Scene key="Onboarding" component={Onboarding} duration={0} hideNavBar={true} sceneConfig={Navigator.SceneConfigs.FloatFromLeft} />
<Scene key="SwipeClassifier" component={SwipeClassifier} panHandlers={null} />
<Router>
<Drawer ref="drawer" key="drawer" contentComponent={SideDrawerContent} open={false} drawerPosition="right">
<Scene key="main" tabs={false}>
<Scene key="SignIn" component={SignIn} duration={0} type="reset" navBar={SignIn.renderNavigationBar} />
<Scene key="ZooniverseApp" component={ZooniverseApp} navBar={ZooniverseApp.renderNavigationBar} initial />
<Scene key="ProjectDisciplines" component={ProjectDisciplines} navBar={ProjectDisciplines.renderNavigationBar} />
<Scene key="About" component={About} navBar={About.renderNavigationBar}/>
<Scene key="Publications" component={PublicationList} navBar={PublicationList.renderNavigationBar} />
<Scene key="ProjectList" component={ProjectList} navBar={ProjectList.renderNavigationBar} />
<Scene key="Register" component={Register} navBar={Register.renderNavigationBar} />
<Scene key="Settings" component={Settings} navBar={Settings.renderNavigationBar} />
<Scene key="ZooWebView" hideNavBar={true} component={ZooWebView} duration={0} navBar={ZooWebView.renderNavigationBar} />
<Scene key="Onboarding" component={Onboarding} duration={0} hideNavBar={true} />
<Scene key="SwipeClassifier" component={SwipeClassifier} panHandlers={null} navBar={SwipeClassifier.renderNavigationBar}/>
</Scene>
</Scene>
</Drawer>
</Router>
</Provider>
);
Expand Down

0 comments on commit ffad1c8

Please sign in to comment.