diff --git a/ReactNativeClient/debug-log.bat b/ReactNativeClient/debug-log.bat
new file mode 100644
index 0000000000..65fcefe2d7
--- /dev/null
+++ b/ReactNativeClient/debug-log.bat
@@ -0,0 +1 @@
+adb logcat *:S ReactNative:V ReactNativeJS:V
\ No newline at end of file
diff --git a/ReactNativeClient/src/root.js b/ReactNativeClient/src/root.js
index a4596fd3f8..0683dab0c7 100644
--- a/ReactNativeClient/src/root.js
+++ b/ReactNativeClient/src/root.js
@@ -25,68 +25,27 @@ const reducer = (state = defaultState, action) => {
switch (action.type) {
- case 'SET_BUTTON_NAME':
+ case 'Navigation/NAVIGATE':
+ case 'Navigation/BACK':
- var state = shallowcopy(state);
- state.myButtonLabel = action.name;
- return state;
+ const nextStateNav = AppNavigator.router.getStateForAction(action, state.nav);
+ if (!nextStateNav) return state;
+ let newState = Object.assign({}, state);
+ newState.nav = nextStateNav;
+ return newState;
- case 'INC_COUNTER':
+ case 'VIEW_NOTE':
- var state = shallowcopy(state);
- state.counter++;
- return state;
-
- case 'VIEW_NOTE':
-
- // let state = Object.assign({}, state);
- // state.selectedNoteId = action.id;
+ // TODO
return state;
- //
- // state.counter++;
- // return state;
-
}
return state;
}
-// const appReducer = combineReducers({
-// reducer: reducer,
-// });
-
let store = createStore(reducer);
-class MyInput extends Component {
-
- render() {
- return
- }
-
-}
-
-const mapStateToInputProps = function(state) {
- return { text: state.defaultText }
-}
-
-const mapDispatchToInputProps = function(dispatch) {
- return {
- onChangeText(text) {
- dispatch({
- type: 'SET_BUTTON_NAME',
- name: text
- });
- }
- }
-}
-
-const MyConnectionInput = connect(
- mapStateToInputProps,
- mapDispatchToInputProps
-)(MyInput)
-
-
class NotesScreen extends React.Component {
static navigationOptions = {
title: 'Notes',
@@ -102,7 +61,6 @@ class NotesScreen extends React.Component {
navigate('Note')
}
/>
-
);
}
@@ -123,7 +81,6 @@ class NoteScreen extends React.Component {
navigate('Notes')
}
/>
-
);
}
@@ -147,69 +104,41 @@ class ProfileScreen extends React.Component {
}
}
-
const AppNavigator = StackNavigator({
Notes: {screen: NotesScreen},
Note: {screen: NoteScreen},
Profile: {screen: ProfileScreen},
});
+class AppComponent extends React.Component {
+ render() {
+ return (
+
+ );
+ }
+}
+
+defaultState.nav = AppNavigator.router.getStateForAction(AppNavigator.router.getActionForPathAndParams('Notes'));
+
+const mapStateToProps = (state) => {
+ return {
+ nav: state.nav
+ };
+};
+
+const App = connect(mapStateToProps)(AppComponent);
+
class Root extends React.Component {
render() {
return (
-
+
);
}
}
-
-
-
-// const AppNavigator = StackNavigator({
-// Main: {screen: MainScreen},
-// Profile: {screen: ProfileScreen},
-// });
-
-// class AppComponent extends React.Component {
-// render() {
-// return (
-//
-// );
-// }
-// }
-
-// const navInitialState = AppNavigator.router.getStateForAction(AppNavigator.router.getActionForPathAndParams('Main'));
-
-// const navReducer = (state = navInitialState, action) => {
-// const nextState = AppNavigator.router.getStateForAction(action, state);
-// return nextState || state;
-// };
-
-// const appReducer = combineReducers({
-// nav: navReducer,
-// });
-
-// const mapStateToProps = (state) => ({
-// nav: state.nav
-// });
-
-// const App = connect(mapStateToProps)(AppComponent);
-
-// const store = createStore(appReducer);
-
-// class Root extends React.Component {
-// render() {
-// return (
-//
-//
-//
-// );
-// }
-// }
-
export { Root };
\ No newline at end of file