1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-03 23:50:33 +02:00
Files
joplin/ReactNativeClient/lib/components/app-nav.js

52 lines
1.2 KiB
JavaScript
Raw Normal View History

2017-07-14 18:49:14 +00:00
import React, { Component } from 'react';
import { connect } from 'react-redux'
2017-07-31 22:03:12 +02:00
import { NotesScreen } from 'lib/components/screens/notes.js';
2017-07-14 18:49:14 +00:00
import { View } from 'react-native';
import { _ } from 'lib/locale.js';
class AppNavComponent extends Component {
render() {
2017-08-01 17:59:01 +00:00
// if (!this.props.route) throw new Error('Route must not be null');
// let route = this.props.route;
// let Screen = null;
// Screen = this.props.screens[route.routeName].screen;
// return (
// <View style={{ flex: 1 }}>
// <Screen navigation={{ state: route }} />
// </View>
// );
2017-07-14 18:49:14 +00:00
if (!this.props.route) throw new Error('Route must not be null');
let route = this.props.route;
2017-07-31 22:03:12 +02:00
let Screen = null;
let notesScreenVisible = false;
if (route.routeName == 'Notes') {
notesScreenVisible = true;
} else {
Screen = this.props.screens[route.routeName].screen;
}
2017-07-14 18:49:14 +00:00
return (
2017-07-21 23:42:24 +01:00
<View style={{ flex: 1 }}>
2017-07-31 22:03:12 +02:00
<NotesScreen visible={notesScreenVisible} navigation={{ state: route }} />
{ !notesScreenVisible && <Screen navigation={{ state: route }} /> }
2017-07-14 18:49:14 +00:00
</View>
);
}
}
const AppNav = connect(
(state) => {
return {
route: state.route,
};
}
)(AppNavComponent)
export { AppNav };