Browse Source

fixing datepicker problems - ios

master
analuizaff 4 years ago
parent
commit
8ca56c2dac
  1. 10
      src/app/screens/PluviometerSharingDataScreen.js

10
src/app/screens/PluviometerSharingDataScreen.js

@ -36,10 +36,7 @@ function PluviometerSharingDataScreen(props) {
let dateTime = new Date().toString(); let dateTime = new Date().toString();
//---------------ios------------------------ //---------------ios------------------------
const onChange = (e, selectedDate) => { const onChange = (e, selectedDate) => {
setShow(false);
if (selectedDate) {
setDate(moment(defaultDate));
}
setDate(moment(selectedDate));
} }
const onCancelPress = () => { const onCancelPress = () => {
setDate(moment(defaultDate)); setDate(moment(defaultDate));
@ -66,7 +63,8 @@ function PluviometerSharingDataScreen(props) {
timeZoneOffsetInMinutes={0} timeZoneOffsetInMinutes={0}
value={new Date(date)} value={new Date(date)}
mode="date" mode="date"
maximumDate={new Date()}
minimumDate={new Date(moment().subtract(1, 'month'))}
maximumDate={new Date(moment())}
onChange={Platform.OS === 'ios' ? onChange : onAndroidChange} onChange={Platform.OS === 'ios' ? onChange : onAndroidChange}
/> />
) )
@ -148,7 +146,7 @@ function PluviometerSharingDataScreen(props) {
underlayColor={'#f8f4f4'} underlayColor={'#f8f4f4'}
style={{ style={{
flex: 1, flex: 1,
borderTopColor: 'primary',
borderTopColor: colors.primary,
borderTopWidth: 1, borderTopWidth: 1,
}} }}
onPress={() => console.log('Datepicker press')}> onPress={() => console.log('Datepicker press')}>

Loading…
Cancel
Save