xgfe / react-native-datepicker

react native datePicker component for both Android and IOS, useing DatePikcerAndroid, TimePickerAndroid and DatePickerIOS
MIT License
2.12k stars 726 forks source link

Not showing past dates including current date on some iOS devices. #422

Open asiriPiyajanaka opened 4 years ago

asiriPiyajanaka commented 4 years ago

Issue

react-native-datepicker not showing in current date and past dates from current day on some iOS devices. Totally working on android and also working on some iOS devices.

IMG-20200604-WA0003

Expected Behavior

To work on all iOS devices. Like this -

Screenshot 2020-06-08 at 4 23 51 PM

Code


import DatePicker from 'react-native-datepicker';

<DatePicker
 style={{ width: '108%', right: responsiveWidth(3) }}
 date={birthDate}
 mode="date"
 placeholder={this.state.birthDate == '' ? '': this.state.birthDate }
 format="YYYY-MM-DD"
 minDate={minDateStr}
 maxDate={new Date(Date.now() - 86400000)}
 confirmBtnText="Confirm"
 cancelBtnText="Cancel"
 showIcon={false}
 disabled={!this.state.isPageEditable}
 customStyles={{
    dateIcon: {
        position: 'absolute',
        left: 0,
        top: 4,
        marginLeft: 0,
        display: 'none'
    },
    dateInput: {
        // marginLeft: 36,
        backgroundColor: 'rgba(255, 255, 255, 0.15)',
        borderRadius: 10,
        height: responsiveHeight(6.5)

    },
    dateText: {
        color: 'white', textAlign: 'left', fontWeight: 'bold'
    },
    placeholderText: {
        color: 'white', alignContent: 'left', fontWeight: 'bold'
    }
    // ... You can check the source to find the other keys.
 }}
 onDateChange={(date) => { this.setState({ birthDate: date }) }}
                            />

Environment

  1. react-native -v: 0.60.5
  2. node -v: v12.14.1
  3. npm -v: 6.13.4
  4. yarn --version:
  5. target platform: Android | iOS
  6. operating system: macOS
hizbullah106 commented 4 years ago

@asiriPiyajanaka Were you able to find the cause in the end?

khan8698 commented 4 years ago

Please check #365 may be that is your issue

sai-kiran-mh commented 4 years ago

@hizbullah106 @asiriPiyajanaka This occurs in iOS devices in which dark mode is enable.

https://github.com/xgfe/react-native-datepicker/issues/365#issuecomment-532875809

or

use custom styles like below customStyles={{ datePicker: { color: 'black', ios_backgroundColor: 'white', backgroundColor: 'white', }, datePickerCon: { color: 'black', ios_backgroundColor: 'white', backgroundColor: 'white', }, }}

carlmagumpara commented 4 years ago

@hizbullah106 @asiriPiyajanaka This occurs in iOS devices in which dark mode is enable.

#365 (comment)

or

use custom styles like below customStyles={{ datePicker: { color: 'black', ios_backgroundColor: 'white', backgroundColor: 'white', }, datePickerCon: { color: 'black', ios_backgroundColor: 'white', backgroundColor: 'white', }, }}

hi is "ios_backgroundColor" a valid style?