xgfe / react-native-datepicker

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

Background color of selected date area, is not changing while disabled the datepicker #465

Closed PrantikMon closed 2 years ago

PrantikMon commented 2 years ago

Issue

In selected date showing area, background color is not working when it is disabled.

Is there any other way to make it done?

Expected Behavior

Code

<DatePicker
       disabled= {isDisabled} //Boolean Val of isDisable
       style={{ backgroundColor: '#e0ffbc'}}
/>

Environment

  1. react-native -v: 0.67.2
  2. node -v:16.14.2
  3. npm -v:8.17.0
  4. yarn --version:
  5. target platform: Android | iOS
  6. operating system: windows 10
PrantikMon commented 2 years ago

Solution :Need to use customStyles props and then use disable tag to make necessary design changes when it is in disable mode.

HarshMB commented 2 years ago

Hi @PrantikMon can you share the code, i am unable to change background color while making disabled true.

Here is my code:-

<DatePicker {...props} disabled={true} customStyles={{ placeholderText: { fontSize: 15, color: 'white', top: 10 }, dateText: { fontSize: 15, color: 'black', top: 10, backgroundColor: 'white' }, dateIcon: { position: 'absolute', right: 0, top: 15, marginLeft: 0 }, dateInput: { borderWidth: 0, left: 10, position: 'absolute', } }} />