-
Notifications
You must be signed in to change notification settings - Fork 1
Routed Settings on Main Page #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: ios
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,171 @@ | ||
| import React, {Component} from 'react'; | ||
| import { | ||
| Modal, | ||
| DatePickerIOS, | ||
| TouchableHighlight, | ||
| TouchableOpacity, | ||
| View, | ||
| StyleSheet, | ||
| } from 'react-native'; | ||
| import { | ||
| Toast, | ||
| Button, | ||
| Icon, | ||
| Body, | ||
| Left, | ||
| Right, | ||
| Title, | ||
| Container, | ||
| Header, | ||
| Content, | ||
| Form, | ||
| Item, | ||
| Input, | ||
| Label, | ||
| Text, | ||
| } from 'native-base'; | ||
|
|
||
| class CalendarModal extends Component { | ||
| constructor(props) { | ||
| super(props); | ||
| this.state = { | ||
| modalVisible: false, | ||
| startVisible: false, | ||
| StartDate: new Date(), | ||
| EndDate: new Date(), | ||
|
Comment on lines
+34
to
+35
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Be consistent in your naming scheme. Always use camelCase |
||
| }; | ||
| this.setStartDate = this.setStartDate.bind(this); | ||
| this.setEndDate = this.setEndDate.bind(this); | ||
| } | ||
| setStartDate(newDate) { | ||
| this.setState({StartDate: newDate}); | ||
| } | ||
| setEndDate(newDate) { | ||
| this.setState({EndDate: newDate}); | ||
| } | ||
| toggleModal(visible) { | ||
| this.setState({modalVisible: visible}); | ||
| } | ||
| toggleStart(visible) { | ||
| this.setState({startVisible: visible}); | ||
| } | ||
| render() { | ||
| return ( | ||
| <View style={styles.container}> | ||
| <Modal | ||
| animationType={'none'} | ||
| transparent={true} | ||
| visible={this.state.modalVisible} | ||
| onRequestClose={() => { | ||
| console.log('Modal has been closed.'); | ||
| }}> | ||
| <View style={styles.modal}> | ||
| <Container> | ||
| <Header> | ||
| <Body style={{flexDirection: 'row'}}> | ||
| <Title>Edit Shift</Title> | ||
| </Body> | ||
| <Right /> | ||
| </Header> | ||
| <Content style={styles.content}> | ||
| <Form> | ||
| <Body style={{marginTop: 10, flexDirection: 'row-reverse'}}> | ||
| <Title>Start</Title> | ||
| </Body> | ||
|
|
||
| {!this.state.startVisible && ( | ||
| <Button | ||
| block | ||
| style={{marginTop: 10, margin: 20, backgroundColor: '#00adf5'}} | ||
| onPress={() => { | ||
| this.toggleStart(!this.state.startVisible); | ||
| }}> | ||
| <Text>Time: {this.props.StartDate}</Text> | ||
| </Button> | ||
| )} | ||
| {this.state.startVisible && ( | ||
| <DatePickerIOS | ||
| date={this.state.StartDate} | ||
| onDateChange={this.setStartDate} | ||
| visible={this.state.startVisible} | ||
| /> | ||
| )} | ||
| {this.state.startVisible && ( | ||
| <Button | ||
| block | ||
| style={{marginTop: 0, margin: 20, backgroundColor: '#00adf5'}} | ||
| onPress={() => { | ||
| this.toggleStart(false); | ||
| }}> | ||
| <Text>Save</Text> | ||
| </Button> | ||
| )} | ||
| <Title> End </Title> | ||
| <DatePickerIOS date={this.state.EndDate} onDateChange={this.setEndDate} /> | ||
| <Item floatingLabel> | ||
| <Label>Title</Label> | ||
| <Input /> | ||
| </Item> | ||
| <Item floatingLabel last> | ||
| <Label>Description</Label> | ||
| <Input /> | ||
| </Item> | ||
| </Form> | ||
| <View style={styles.content}> | ||
| <Button | ||
| block | ||
| style={{marginTop: 20, margin: 100, backgroundColor: '#00adf5'}} | ||
| onPress={() => { | ||
| this.toggleModal(!this.state.modalVisible); | ||
| }}> | ||
| <Text>Edit Shift</Text> | ||
| </Button> | ||
| </View> | ||
| </Content> | ||
| </Container> | ||
| {/* <TouchableHighlight onPress = {() => { | ||
| this.toggleModal(!this.state.modalVisible)}}> | ||
|
|
||
| <Text style = {styles.text}>Close Modal</Text> | ||
| </TouchableHighlight> */} | ||
| </View> | ||
| </Modal> | ||
|
|
||
| <Button | ||
| block | ||
| style={{marginTop: 40, margin: 80, backgroundColor: '#00adf5'}} | ||
| onPress={() => { | ||
| this.toggleModal(true); | ||
| }}> | ||
| <Text>Edit User Settings</Text> | ||
| </Button> | ||
| </View> | ||
| ); | ||
| } | ||
| } | ||
| export default CalendarModal; | ||
|
|
||
| const styles = StyleSheet.create({ | ||
| container: { | ||
| flex: 1, | ||
| alignItems: 'center', | ||
| justifyContent: 'center', | ||
| }, | ||
| modal: { | ||
| justifyContent: 'center', | ||
| flex: 1, | ||
| alignItems: 'center', | ||
| width: '85%', | ||
| borderRadius: 10, | ||
| borderWidth: 1, | ||
| borderColor: '#fff', | ||
| marginTop: 70, | ||
| marginLeft: 40, | ||
| }, | ||
| text: { | ||
| color: '#3f2949', | ||
| marginTop: 10, | ||
| }, | ||
| }); | ||
|
|
||
| export {CalendarModal}; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,77 @@ | ||
| // @flow | ||
|
|
||
| import React, {Component} from 'react'; | ||
| import {View} from 'react-native'; | ||
| import {StyleSheet, View, Image, Text} from 'react-native'; | ||
| import {Card, Divider} from 'react-native-elements'; | ||
| import {CalendarModal} from './CalendarModal'; | ||
| import { WeatherWidget } from 'react-native-weather'; | ||
|
|
||
| export default class Dashboard extends Component { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to Vinit, we won't have a Dashboard component, so remove for now :( |
||
| constructor(props) { | ||
| super(props); | ||
|
|
||
| this.state = { | ||
| latitude: 0, | ||
| longitude: 0, | ||
| forecast: [], | ||
| error: '', | ||
| }; | ||
| } | ||
| getLocation() { | ||
| // Get the current position of the user | ||
| navigator.geolocation.getCurrentPosition( | ||
| position => { | ||
| this.setState( | ||
| prevState => ({ | ||
| latitude: position.coords.latitude, | ||
| longitude: position.coords.longitude, | ||
| }), | ||
| () => { | ||
| this.getWeather(); | ||
| }, | ||
| ); | ||
| }, | ||
| error => this.setState({forecast: error.message}), | ||
| {enableHighAccuracy: true, timeout: 20000, maximumAge: 1000}, | ||
| ); | ||
| } | ||
|
|
||
| getWeather() { | ||
| // Construct the API url to call | ||
| let url = | ||
| 'https://api.openweathermap.org/data/2.5/forecast?lat=' + | ||
| this.state.latitude + | ||
| '&lon=' + | ||
| this.state.longitude + | ||
| '&units=metric&appid=734bff6c94faf86e71390520d5252983'; | ||
|
|
||
| // Call the API, and set the state of the weather forecast | ||
| fetch(url) | ||
| .then(response => response.json()) | ||
| .then(data => { | ||
| this.setState((prevState, props) => ({ | ||
| forecast: data, | ||
| })); | ||
| }); | ||
| } | ||
|
|
||
| render() { | ||
| return <View />; | ||
| return <WeatherWidget | ||
| api={"77f7286000cc8628cc4557b024c9756b"} | ||
| lat={"0"} | ||
| lng={"0"} | ||
| />; | ||
| } | ||
| } | ||
|
|
||
| const styles = StyleSheet.create({ | ||
| container: { | ||
| alignItems: 'center', | ||
| }, | ||
| modal: { | ||
| alignItems: 'center', | ||
| }, | ||
| text: { | ||
| color: '#3f2949', | ||
| }, | ||
| }); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,14 +15,15 @@ function AppNavigator() { | |
| <Stack.Screen | ||
| name="Home" | ||
| component={BottomTabNavigator} | ||
| options={({route}) => ({ | ||
| options={({navigation}) => ({ | ||
| title: 'GTHC', | ||
| headerRight: () => ( | ||
| <Icon.Button | ||
| backgroundColor={mainHeader.headerStyle.backgroundColor} | ||
| name="ios-settings" | ||
| size={24} | ||
| color="white" | ||
| onPress={() => navigation.navigate('Settings')} | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great!! |
||
| /> | ||
| ), | ||
| ...mainHeader, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we have a date picker? isn't the modal just gonna have read only information about the shift?