Defines if modal should currently be shown or not
Function to change modal visibility. Called to hide the modal when someone taps on the backdrop.
OptionalshowTitle?: booleanDisplay a title in the modal.
Optionaltitle?: stringTitle to display.
OptionalshowConfirm?: booleanIf enabled, the confirm button is shown.
Function to call when the confirm button is pressed or the user taps out with onTapOut set to "confirm".
OptionalshowCancel?: booleanIf enabled, the cancel button is shown.
OptionalonCancel?: (duration: Duration) => voidFunction to call when the cancel button is pressed or the user taps out with onTapOut set to "cancel".
const [duration, setDuration] = useState({hours: 0, minutes: 15, seconds: 30});
const [cachedDuration, setCachedDuration] = useState(cloneDuration(duration));
useEffect(() => {
setCachedDuration(cloneDuration(duration));
}, [duration]);
return (
<ModalTimePicker
duration={cachedDuration} // when user cancels and reopens the time picker modal, show previously selected values
onConfirm={setDuration}
onCancel={setCachedDuration}
//...
/>
);
OptionalallowTapOut?: booleanIf enabled, user can close the modal by tapping on the backdrop.
OptionalonTapOut?: "cancel" | "confirm"Defines if tapping out should be considered cancelling or confirming. The corresponding function will be called on tap out.
OptionalbackdropStyle?: ViewStyleStyling for the backdrop.
OptionaltitleStyle?: TextStyleStyling for the title text.
OptionaltitlePickerSeparatorStyle?: ViewStyleStyling for the separator between the title and time picker.
OptionalpickerButtonsSeparatorStyle?: ViewStyleStyling for the separator between the time picker and buttons.
OptionalbuttonContainerStyle?: ViewStyleStyling for the button container.
OptionalbuttonSeparatorStyle?: ViewStyleStyling for the separator between the buttons.
OptionalconfirmButtonStyle?: TextStyleStyling for the confirm button.
OptionalcancelButtonStyle?: TextStyleStyling for the cancel button.
Properties for a modal time picker extending time picker props.