From 4e886265e193ccec338dc43d72cb8767480e0a63 Mon Sep 17 00:00:00 2001 From: Camilo Giraldo Date: Wed, 11 Sep 2019 17:25:42 -0500 Subject: [PATCH] Create settings screen --- routes.js | 8 ++ src/screens/Settings.js | 242 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 250 insertions(+) create mode 100644 src/screens/Settings.js diff --git a/routes.js b/routes.js index 5ac0b2e..0fb98de 100644 --- a/routes.js +++ b/routes.js @@ -16,6 +16,7 @@ import Components from './src/screens/Components'; import Login from './src/screens/Login'; import News from './src/screens/News'; import OrderConfirmed from './src/screens/OrderConfirmed'; +import Settings from './src/screens/Settings'; import Presentation from './src/screens/Presentation'; import Dashboard from './src/screens/Dashboard'; import Register from './src/screens/Register'; @@ -135,6 +136,13 @@ const screens = { drawerIcon: props => , }, }, + Settings: { + screen: Settings, + navigationOptions: { + drawerLabel: 'Settings Screen', + drawerIcon: props => , + }, + }, /* Presentation: { screen: Presentation, diff --git a/src/screens/Settings.js b/src/screens/Settings.js new file mode 100644 index 0000000..b9464fe --- /dev/null +++ b/src/screens/Settings.js @@ -0,0 +1,242 @@ +import React from 'react'; +import { Platform, ScrollView, StyleSheet } from 'react-native'; + +// galio components +import { + Text, Input, Block, NavBar, Checkbox, Switch, Radio, +} from 'galio-framework'; +import theme from '../theme'; + +class Settings extends React.Component { + state = { + switch1: true, + switch2: true, + switch3: false, + switch4: true, + primaryCard: 'card1', + }; + + toggleSwitch = (name) => { + this.setState(prevState => ({ + [name]: !prevState[name], + })); + }; + + setPrimaryCard = (name) => { + this.setState({ primaryCard: name }); + }; + + render() { + const { navigation } = this.props; + const { + switch1, switch2, switch3, switch4, primaryCard, + } = this.state; + + return ( + + navigation.openDrawer()} + style={Platform.OS === 'android' ? { marginTop: theme.SIZES.BASE } : null} + /> + + + + + Edit Details + You can change your personal info + + + + + + + + + + + + + Select Card + Choose your primary card + + + + this.setPrimaryCard('card1')} + initialValue={primaryCard === 'card1'} + /> + {'John Doe \nExpires 11/2022'} + + + this.setPrimaryCard('card2')} + initialValue={primaryCard === 'card2'} + /> + {'John Doe \nExpires 11/2022'} + + + + + {'John Doe \nExpires 11/2022'} + + + + + + + Notification settings + These are important settings + + + Someone mentions me + this.toggleSwitch('switch1')} + /> + + + Someone follows me + this.toggleSwitch('switch2')} + /> + + + Someone comments me + this.toggleSwitch('switch3')} + /> + + + A seller follows me + this.toggleSwitch('switch4')} + /> + + + + + + ); + } +} + +const styles = StyleSheet.create({ + container: { + padding: 14, + justifyContent: 'center', + }, + section: { + marginBottom: 20, + }, + headerContainer: { + flex: 2, + alignItems: 'center', + }, + header: { + margin: 3, + fontSize: theme.SIZES.FONT * 1.2, + fontWeight: '600', + }, + subHeader: { + marginBottom: 5, + color: theme.COLORS.GREY, + }, + checkOption: { + margin: 10, + }, + creditCardItem: { + padding: 10, + }, + cardDetails: { + marginLeft: 43, + marginTop: -15, + }, + borderTop: { + borderTopColor: theme.COLORS.GREY, + borderTopWidth: 1, + }, + creditCardContainer: { + borderWidth: 1, + borderRadius: 5, + borderColor: theme.COLORS.GREY, + }, + toggleOption: { + margin: 10, + flex: 1, + flexDirection: 'row', + alignItems: 'center', + justifyContent: 'space-between', + }, +}); +export default Settings;