Datetimepicker: Working on IOS, but not on Android

Created on 9 Jul 2020  Â·  1Comment  Â·  Source: react-native-datetimepicker/datetimepicker

Bug report

Summary

Conditionally rendering the Android date picker isn't working. If I set it to true it'll render the component straight up on load, but If I trigger from false to true on the render it doesn't show.

Environment info

System:
OS: macOS 10.15.4
CPU: (4) x64 Intel(R) Core(TM) i5-5287U CPU @ 2.90GHz
Memory: 945.49 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.16.2 - /usr/local/bin/node
Yarn: Not Found
npm: 6.14.4 - /usr/local/bin/npm
Watchman: 4.7.0 - /usr/local/bin/watchman
Managers:
CocoaPods: Not Found
SDKs:
iOS SDK:
Platforms: iOS 13.5, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
Android SDK:
API Levels: 29
Build Tools: 29.0.3
System Images: android-23 | Google APIs ARM EABI v7a, android-25 | Intel x86 Atom, android-25 | Google APIs Intel x86 Atom_64
Android NDK: Not Found
IDEs:
Android Studio: 3.6 AI-192.7142.36.36.6392135
Xcode: 11.5/11E608c - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_101 - /usr/bin/javac
Python: 2.7.16 - /usr/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.11.0 => 16.11.0
react-native: https://github.com/expo/react-native/archive/sdk-38.0.2.tar.gz => 0.62.2
npmGlobalPackages:
react-native: Not Found

Library version: latest version

Steps to reproduce

  1. Create a functional component containing the datetimepicker
  2. On button press, show the functional component

Describe what you expected to happen:

  1. On button press the date picker component renders

Reproducible sample code

function DatePickerInput(props) {
const [date, setDate] = useState(new Date());
const [mode, setMode] = useState(props.mode);

const onChange = (selectedDate) => {
console.log(selectedDate);
const currentDate = selectedDate || date;
setDate(currentDate);
props.setDate(currentDate);
props.dismiss();
};
return (

style={{ width: "100%" }}
value={date}
mode={mode}
display="default"
// isVisible={props.show}
onConfirm={onChange}
onCancel={props.dismiss}
/>

);
}

{showEffectiveDatePicker && (
setDate={(e) => {
setHoursChange({
...hoursChange,
effectiveDate: e,
});
}}
dismiss={() => setShowEffectiveDatePicker(false)}
mode="date"
show={showEffectiveDatePicker}
/>
)}

//showEffectiveDatePicker, when replaced with true renders the component, but not when it's set using state.

Most helpful comment

any update on this? i'm getting the same issue as well

>All comments

any update on this? i'm getting the same issue as well

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yesIamFaded picture yesIamFaded  Â·  5Comments

inferusvv picture inferusvv  Â·  4Comments

gabrieljablonski picture gabrieljablonski  Â·  5Comments

gokulkulkarni1987 picture gokulkulkarni1987  Â·  3Comments

corradio picture corradio  Â·  5Comments