@amabeth/time-picker
    Preparing search index...

    Type Alias ModalTimePickerProps

    ModalTimePickerProps: TimePickerProps & {
        visible: boolean;
        setVisible: (b: boolean) => void;
        showTitle?: boolean;
        title?: string;
        showConfirm?: boolean;
        onConfirm: (duration: Duration) => void;
        showCancel?: boolean;
        onCancel?: (duration: Duration) => void;
        allowTapOut?: boolean;
        onTapOut?: "cancel" | "confirm";
        backdropStyle?: ViewStyle;
        titleStyle?: TextStyle;
        titlePickerSeparatorStyle?: ViewStyle;
        pickerButtonsSeparatorStyle?: ViewStyle;
        buttonContainerStyle?: ViewStyle;
        buttonSeparatorStyle?: ViewStyle;
        confirmButtonStyle?: TextStyle;
        cancelButtonStyle?: TextStyle;
    }

    Properties for a modal time picker extending time picker props.

    Type declaration

    • visible: boolean

      Defines if modal should currently be shown or not

    • setVisible: (b: boolean) => void

      Function to change modal visibility. Called to hide the modal when someone taps on the backdrop.

    • OptionalshowTitle?: boolean

      Display a title in the modal.

      true
      
    • Optionaltitle?: string

      Title to display.

      Select time
      
    • OptionalshowConfirm?: boolean

      If enabled, the confirm button is shown.

      true
      
    • onConfirm: (duration: Duration) => void

      Function to call when the confirm button is pressed or the user taps out with onTapOut set to "confirm".

      const [duration, setDuration] = useState({hours: 0, minutes: 15, seconds: 30});

      return (
      <ModalTimePicker
      onConfirm={setDuration}
      //...
      />
      );
    • OptionalshowCancel?: boolean

      If enabled, the cancel button is shown.

      true
      
    • OptionalonCancel?: (duration: Duration) => void

      Function 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?: boolean

      If enabled, user can close the modal by tapping on the backdrop.

      true
      
    • OptionalonTapOut?: "cancel" | "confirm"

      Defines if tapping out should be considered cancelling or confirming. The corresponding function will be called on tap out.

      cancel
      
    • OptionalbackdropStyle?: ViewStyle

      Styling for the backdrop.

        {
      backgroundColor: "black"
      }
    • OptionaltitleStyle?: TextStyle

      Styling for the title text.

        {
      fontSize: 24,
      color: "white"
      }
    • OptionaltitlePickerSeparatorStyle?: ViewStyle

      Styling for the separator between the title and time picker.

        {
      height: 15
      }
    • OptionalpickerButtonsSeparatorStyle?: ViewStyle

      Styling for the separator between the time picker and buttons.

        {
      height: 15
      }
    • OptionalbuttonContainerStyle?: ViewStyle

      Styling for the button container.

        {
      flexDirection: "row",
      justifyContent: "flex-end"
      }
    • OptionalbuttonSeparatorStyle?: ViewStyle

      Styling for the separator between the buttons.

        {
      height: 15
      }
    • OptionalconfirmButtonStyle?: TextStyle

      Styling for the confirm button.

        {
      fontSize: 24,
      padding: 5,
      color: "white"
      }
    • OptionalcancelButtonStyle?: TextStyle

      Styling for the cancel button.

        {
      fontSize: 24,
      padding: 5,
      color: "white"
      }