diff --git a/App.js b/App.js index 8d6286c..84ff170 100644 --- a/App.js +++ b/App.js @@ -1,15 +1,23 @@ -import React from 'react'; -import { StyleSheet, Text, View } from 'react-native'; +import React from 'react' +import { StyleSheet, View } from 'react-native' +import { Provider } from 'react-redux' +import createStore from './Redux' +import AppNavigation from './Navigation/AppNavigation' +import ReduxNavigation from './Navigation/ReduxNavigation' + +// create our store +const store = createStore() + export default class App extends React.Component { render() { return ( - - Open up App.js to start working on your app! - Changes you make will automatically reload. - Shake your phone to open the developer menu. - - ); + + + + + + ) } } @@ -20,4 +28,4 @@ const styles = StyleSheet.create({ alignItems: 'center', justifyContent: 'center', }, -}); +}) diff --git a/Containers/LoginScreen.js b/Containers/LoginScreen.js new file mode 100644 index 0000000..06788d6 --- /dev/null +++ b/Containers/LoginScreen.js @@ -0,0 +1,21 @@ +import React from 'react' +import { StyleSheet, Text, View } from 'react-native' + +export default class App extends React.Component { + render() { + return ( + + HIYA!!!!! + + ) + } +} + +const styles = StyleSheet.create({ + container: { + flex: 1, + backgroundColor: '#fff', + alignItems: 'center', + justifyContent: 'center', + }, +}) diff --git a/Navigation/AppNavigation.js b/Navigation/AppNavigation.js new file mode 100644 index 0000000..8fddc9b --- /dev/null +++ b/Navigation/AppNavigation.js @@ -0,0 +1,13 @@ +import { StackNavigator } from 'react-navigation' +import LoginScreen from '../Containers/LoginScreen' + +// Manifest of possible screens +const PrimaryNav = StackNavigator({ + LoginScreen: { screen: LoginScreen } +}, { + // Default config for all screens + headerMode: 'none', + initialRouteName: 'LoginScreen' +}) + +export default PrimaryNav diff --git a/Navigation/ReduxNavigation.js b/Navigation/ReduxNavigation.js new file mode 100644 index 0000000..0692f53 --- /dev/null +++ b/Navigation/ReduxNavigation.js @@ -0,0 +1,18 @@ +import React from 'react' +import * as ReactNavigation from 'react-navigation' +import { connect } from 'react-redux' +import AppNavigation from './AppNavigation' + +// here is our redux-aware our smart component +function ReduxNavigation (props) { + const { dispatch, nav } = props + const navigation = ReactNavigation.addNavigationHelpers({ + dispatch, + state: nav + }) + + return +} + +const mapStateToProps = state => ({ nav: state.nav }) +export default connect(mapStateToProps)(ReduxNavigation) diff --git a/Redux/index.js b/Redux/index.js new file mode 100644 index 0000000..76e9abe --- /dev/null +++ b/Redux/index.js @@ -0,0 +1,18 @@ +// Wherever you build your reducers +import { combineReducers, createStore, applyMiddleware, compose } from 'redux' +import AppNavigation from '../Navigation/AppNavigation' + +const navReducer = (state, action) => { + const newState = AppNavigation.router.getStateForAction(action, state) + return newState || state +} + +export default () => { + /* ------------- Assemble The Reducers ------------- */ + const rootReducer = combineReducers({ + nav: navReducer + }) + + // return store + return createStore(rootReducer) +} diff --git a/package.json b/package.json index cf74091..0af0ca6 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,8 @@ "version": "0.1.0", "private": true, "devDependencies": { - "react-native-scripts": "1.2.1", "jest-expo": "~20.0.0", + "react-native-scripts": "1.2.1", "react-test-renderer": "16.0.0-alpha.12" }, "main": "./node_modules/react-native-scripts/build/bin/crna-entry.js", @@ -21,6 +21,9 @@ "dependencies": { "expo": "^20.0.0", "react": "16.0.0-alpha.12", - "react-native": "^0.47.0" + "react-native": "^0.47.0", + "react-navigation": "^1.0.0-beta.11", + "react-redux": "^5.0.6", + "redux": "^3.7.2" } -} \ No newline at end of file +} diff --git a/yarn.lock b/yarn.lock index 6f9cfcb..60b1d5d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1312,6 +1312,10 @@ ci-info@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.0.0.tgz#dc5285f2b4e251821683681c381c3388f46ec534" +clamp@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/clamp/-/clamp-1.0.1.tgz#66a0e64011816e37196828fdc8c8c147312c8634" + cli-cursor@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" @@ -2038,7 +2042,7 @@ fbjs@0.8.12: setimmediate "^1.0.5" ua-parser-js "^0.7.9" -fbjs@^0.8.4, fbjs@^0.8.9: +fbjs@^0.8.12, fbjs@^0.8.4, fbjs@^0.8.9: version "0.8.14" resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.14.tgz#d1dbe2be254c35a91e09f31f9cd50a40b2a0ed1c" dependencies: @@ -2474,6 +2478,10 @@ hoek@4.x.x: version "4.2.0" resolved "https://registry.yarnpkg.com/hoek/-/hoek-4.2.0.tgz#72d9d0754f7fe25ca2d01ad8f8f9a9449a89526d" +hoist-non-react-statics@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-1.2.0.tgz#aa448cf0986d55cc40773b17174b7dd066cb7cfb" + hoist-non-react-statics@^2.2.1: version "2.3.0" resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-2.3.0.tgz#ede16318c2ff1f9fe3a025396ba06fd4c44608bb" @@ -4074,6 +4082,12 @@ path-to-regexp@0.1.7: version "0.1.7" resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" +path-to-regexp@^1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-1.7.0.tgz#59fde0f435badacba103a84e9d3bc64e96b9937d" + dependencies: + isarray "0.0.1" + path-type@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-1.1.0.tgz#59c44f7ee491da704da415da5a4070ba4f8fe441" @@ -4339,6 +4353,22 @@ react-native-branch@2.0.0-beta.3: version "2.0.0-beta.3" resolved "https://registry.yarnpkg.com/react-native-branch/-/react-native-branch-2.0.0-beta.3.tgz#2167af86bbc9f964bd45bd5f37684e5b54965e32" +react-native-dismiss-keyboard@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/react-native-dismiss-keyboard/-/react-native-dismiss-keyboard-1.0.0.tgz#32886242b3f2317e121f3aeb9b0a585e2b879b49" + +react-native-drawer-layout-polyfill@^1.3.0: + version "1.3.2" + resolved "https://registry.yarnpkg.com/react-native-drawer-layout-polyfill/-/react-native-drawer-layout-polyfill-1.3.2.tgz#192c84d7a5a6b8a6d2be2c7daa5e4164518d0cc7" + dependencies: + react-native-drawer-layout "1.3.2" + +react-native-drawer-layout@1.3.2: + version "1.3.2" + resolved "https://registry.yarnpkg.com/react-native-drawer-layout/-/react-native-drawer-layout-1.3.2.tgz#b9740d7663a1dc4f88a61b9c6d93d2d948ea426e" + dependencies: + react-native-dismiss-keyboard "1.0.0" + react-native-gesture-handler@^1.0.0-alpha.14: version "1.0.0-alpha.17" resolved "https://registry.yarnpkg.com/react-native-gesture-handler/-/react-native-gesture-handler-1.0.0-alpha.17.tgz#1ae4412e1b208d175b34a14931d0635064a92e7b" @@ -4379,6 +4409,12 @@ react-native-svg@5.3.0: color "^0.11.1" lodash "^4.16.6" +react-native-tab-view@^0.0.65: + version "0.0.65" + resolved "https://registry.yarnpkg.com/react-native-tab-view/-/react-native-tab-view-0.0.65.tgz#b685ea3081ff7c96486cd997361026c407302c59" + dependencies: + prop-types "^15.5.8" + react-native-vector-icons@4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/react-native-vector-icons/-/react-native-vector-icons-4.1.1.tgz#9ac75bde77d9243346668c51dca7756775428087" @@ -4474,6 +4510,18 @@ react-native@^0.47.0: xtend ">=4.0.0 <4.1.0-0" yargs "^6.4.0" +react-navigation@^1.0.0-beta.11: + version "1.0.0-beta.11" + resolved "https://registry.yarnpkg.com/react-navigation/-/react-navigation-1.0.0-beta.11.tgz#4271edb23cdbcc6eb88602f7fde0a77f0ef7a160" + dependencies: + clamp "^1.0.1" + fbjs "^0.8.12" + hoist-non-react-statics "^1.2.0" + path-to-regexp "^1.7.0" + prop-types "^15.5.10" + react-native-drawer-layout-polyfill "^1.3.0" + react-native-tab-view "^0.0.65" + react-proxy@^1.1.7: version "1.1.8" resolved "https://registry.yarnpkg.com/react-proxy/-/react-proxy-1.1.8.tgz#9dbfd9d927528c3aa9f444e4558c37830ab8c26a" @@ -4481,7 +4529,7 @@ react-proxy@^1.1.7: lodash "^4.6.1" react-deep-force-update "^1.0.0" -react-redux@^5.0.2: +react-redux@^5.0.2, react-redux@^5.0.6: version "5.0.6" resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-5.0.6.tgz#23ed3a4f986359d68b5212eaaa681e60d6574946" dependencies: @@ -4573,7 +4621,7 @@ redux-logger@^2.7.4: dependencies: deep-diff "0.3.4" -redux@^3.6.0: +redux@^3.6.0, redux@^3.7.2: version "3.7.2" resolved "https://registry.yarnpkg.com/redux/-/redux-3.7.2.tgz#06b73123215901d25d065be342eb026bc1c8537b" dependencies: @@ -5580,7 +5628,7 @@ webidl-conversions@^4.0.0: version "4.0.2" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad" -"websql@github:expo/node-websql#18.0.0": +websql@expo/node-websql#18.0.0: version "0.4.4" resolved "https://codeload.github.com/expo/node-websql/tar.gz/e364fa65146a9e2157a19e5c719e7702c2b6b87a" dependencies: