Browse Source

fixing datepicker erro - ios

master
analuizaff 4 years ago
parent
commit
6ce0d040f8
  1. 24
      src/app/screens/PluviometerSharingDataScreen.js

24
src/app/screens/PluviometerSharingDataScreen.js

@ -18,6 +18,7 @@ import DateTimePicker from '@react-native-community/datetimepicker';
import { FontAwesome5 } from '@expo/vector-icons'; import { FontAwesome5 } from '@expo/vector-icons';
import { showMessage } from "react-native-flash-message"; import { showMessage } from "react-native-flash-message";
import moment from 'moment'; import moment from 'moment';
import colors from "../config/colors";
const validationSchema = Yup.object().shape({ const validationSchema = Yup.object().shape({
pluviometer: Yup.number().required().min(1).max(10000).label("pluviometer"), pluviometer: Yup.number().required().min(1).max(10000).label("pluviometer"),
@ -121,8 +122,8 @@ function PluviometerSharingDataScreen(props) {
<TouchableOpacity style={styles.datepickerStyle} <TouchableOpacity style={styles.datepickerStyle}
onPress={() => setShow(true)}> onPress={() => setShow(true)}>
<View style={styles.datePickerView}> <View style={styles.datePickerView}>
<View style={{ flexDirection:"row", justifyContent:"space-between", width: 280 }}>
<Text style={{fontSize: 16, marginLeft: 15}}>{date.format('DD/MM/YYYY')}</Text>
<View style={{ flexDirection: "row", justifyContent: "space-between", width: 280 }}>
<Text style={{ fontSize: 16, marginLeft: 15 }}>{date.format('DD/MM/YYYY')}</Text>
<FontAwesome5 style={styles.dateIcon} name="calendar-day" size={24} color="grey" /> <FontAwesome5 style={styles.dateIcon} name="calendar-day" size={24} color="grey" />
</View> </View>
{Platform.OS !== 'ios' && show && renderDatePicker()} {Platform.OS !== 'ios' && show && renderDatePicker()}
@ -141,10 +142,10 @@ function PluviometerSharingDataScreen(props) {
flexDirection: 'row', flexDirection: 'row',
}} }}
activeOpacity={1} activeOpacity={1}
visible={show}>
onPress={() => setShow(false)}
visible={show}
onPress={() => setShow(false)}>
<TouchableHighlight <TouchableHighlight
underlayColor={''}
underlayColor={'#f8f4f4'}
style={{ style={{
flex: 1, flex: 1,
borderTopColor: 'primary', borderTopColor: 'primary',
@ -157,21 +158,21 @@ function PluviometerSharingDataScreen(props) {
height: 256, height: 256,
overflow: 'hidden', overflow: 'hidden',
}}> }}>
<View style={{ marginTop:20 }}>
{ renderDatePicker }
<View style={{ marginTop: 20 }}>
{renderDatePicker()}
</View> </View>
<TouchableHighlight <TouchableHighlight
underlayColor={'transparent'} underlayColor={'transparent'}
onPress={() => onCancelPress()}
onPress={() => console.log('Datepicker press')}
style={(styles.btnText, styles.btnCancel)}> style={(styles.btnText, styles.btnCancel)}>
<Text>Cancelar</Text> <Text>Cancelar</Text>
</TouchableHighlight> </TouchableHighlight>
<TouchableHighlight <TouchableHighlight
underlayColor={'transparent'} underlayColor={'transparent'}
onPress={() => onDonePress()}
onPress={() => console.log('Datepicker press')}
style={(styles.btnText, styles.btnDone)}> style={(styles.btnText, styles.btnDone)}>
<Text>OK</Text>
<Text>Ok</Text>
</TouchableHighlight> </TouchableHighlight>
</View> </View>
</TouchableHighlight> </TouchableHighlight>
@ -234,7 +235,8 @@ const styles = StyleSheet.create({
paddingHorizontal: 20, paddingHorizontal: 20,
flexDirection: "row", flexDirection: "row",
alignItems: "center", alignItems: "center",
justifyContent: "center"
justifyContent: "center",
color: colors.primary,
}, },
btnCancel: { btnCancel: {
left: 0, left: 0,

Loading…
Cancel
Save