Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from nat-sharpe/filterscreen
Adds FilterScreen, Redux and complex Fetch request
- Loading branch information
Showing
22 changed files
with
452 additions
and
199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
REACT_APP_API_URL='dev' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
REACT_APP_API_URL='pro' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,69 @@ | ||
import React, {Component} from 'react'; | ||
import {AppRegistry, Text, View, StyleSheet} from 'react-native'; | ||
import React from 'react'; | ||
import { Platform, StatusBar, StyleSheet, View } from 'react-native'; | ||
import { AppLoading, Asset, Font, Icon } from 'expo'; | ||
import AppNavigator from './navigation/AppNavigator'; | ||
import store from './redux/store'; | ||
import {Provider} from 'react-redux'; | ||
|
||
import Component5 from './screens/Component5'; | ||
export default class App extends React.Component { | ||
state = { | ||
isLoadingComplete: false, | ||
}; | ||
|
||
export default class foodbetter extends Component{ | ||
render(){ | ||
return( | ||
<View style={styles.container}> | ||
<Component5 /> | ||
</View> | ||
) | ||
render() { | ||
// if (!this.state.isLoadingComplete && !this.props.skipLoadingScreen) { | ||
// return ( | ||
// <AppLoading | ||
// startAsync={this._loadResourcesAsync} | ||
// onError={this._handleLoadingError} | ||
// onFinish={this._handleFinishLoading} | ||
// /> | ||
// ); | ||
// } else { | ||
console.log(store) | ||
return ( | ||
<Provider store={store}> | ||
<View style={styles.container}> | ||
{console.log(store.getState())} | ||
{Platform.OS === 'ios' && <StatusBar barStyle="default" />} | ||
<AppNavigator /> | ||
</View> | ||
</Provider> | ||
); | ||
// } | ||
} | ||
|
||
// _loadResourcesAsync = async () => { | ||
// return Promise.all([ | ||
// Asset.loadAsync([ | ||
// require('./assets/images/robot-dev.png'), | ||
// require('./assets/images/robot-prod.png'), | ||
// ]), | ||
// Font.loadAsync({ | ||
// // This is the font that we are using for our tab bar | ||
// ...Icon.Ionicons.font, | ||
// // We include SpaceMono because we use it in HomeScreen.js. Feel free | ||
// // to remove this if you are not using it in your app | ||
// 'space-mono': require('./assets/fonts/SpaceMono-Regular.ttf'), | ||
// }), | ||
// ]); | ||
// }; | ||
|
||
// _handleLoadingError = error => { | ||
// // In this case, you might want to report the error to your error | ||
// // reporting service, for example Sentry | ||
// console.warn(error); | ||
// }; | ||
|
||
// _handleFinishLoading = () => { | ||
// this.setState({ isLoadingComplete: true }); | ||
// }; | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
backgroundColor: '#ecf0f1', | ||
} | ||
backgroundColor: '#fff', | ||
}, | ||
}); | ||
|
||
AppRegistry.registerComponent('Food Better', () => foodbetter); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React, {Component} from 'react'; | ||
import {AppRegistry, Text, View, StyleSheet} from 'react-native'; | ||
|
||
import ScannerScreen from './screens/ScannerScreen'; | ||
|
||
export default class foodbetter extends Component{ | ||
render(){ | ||
return( | ||
<View style={styles.container}> | ||
<ScannerScreen /> | ||
</View> | ||
) | ||
} | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
backgroundColor: '#ecf0f1', | ||
} | ||
}); | ||
|
||
AppRegistry.registerComponent('Food Better', () => foodbetter); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
const reducer = (oldState, action) => { | ||
if (action.type === 'CHANGE_SETTINGS') { | ||
// console.log('Poo') | ||
// console.log(action) | ||
// console.log(oldState) | ||
// console.log(oldState.settings) | ||
// console.log(action.settings.vegan) | ||
return { | ||
...oldState, | ||
settings: action.settings | ||
} | ||
} else if (action.type === 'UPDATE_ITEMS') { | ||
let newItem = { | ||
id: action.id, | ||
allowed: action.allowed, | ||
name: action.name, | ||
brand: action.brand, | ||
imageURL: action.imageURL, | ||
carbs: action.carbs, | ||
calories: action.calories, | ||
organic: action.organic, | ||
vegan: naction.vegan, | ||
glutenFree: action.glutenFree, | ||
}; | ||
let newScans = [...oldState.oldScans]; | ||
newScans.splice(0, 1); | ||
newScans.push(newItem); | ||
return { | ||
...oldState, | ||
oldScans: newScans | ||
} | ||
} | ||
return oldState; | ||
} | ||
|
||
export default reducer; |
Oops, something went wrong.