Datetime Picker is not opening i'm using react-native with react-hooks, in Android works fine . but its not opening in IOS and not showing any error.
i just created local component for datepicker so i can use it for both android and ios. for android its going fine IOS is the issue, its not responding
i done pod clean and install also no luck
const DatePicker =({}) =>{
const [state, setState] = useState({
date: new Date(),
mode: 'date',
show: false
});
const showPicker = mode => {
setState(prevState => ({
...prevState,
show: Platform.OS === 'ios',
mode
}));
};
const datePicker = () => {
showPicker('datetime');
};
return(
<>
<View>
<View style={styles.createBorder}>
<TouchableHighlight
underlayColor={disable ? 'transperant' : ''}
onPress={!disable && timePicker}
>
<View style={styles.datePickerBox}>
<Text
style={[styles.datePickerText, { width: width - 60 }]}
>
{state.date}
</Text>
</View>
</TouchableHighlight>
</View>
{state.show && Platform.OS === 'ios' && (
<DateTimePicker
style={[styles.inputBackground, {width: '100%' }]}
value={state.date}
mode="datetime"
is24Hour={false}
display="default"
onChange={setDate}
/>
)}
</View>
</>
);
}
export default DatePicker;
I just move to react-native-modal-datetime-picker its working fine now