react-native-form-model
Version:
An easily testable and opinionated React Native form model builder written in pure JavaScript.
73 lines (72 loc) • 5.76 kB
TypeScript
import { Moment } from 'moment';
import React, { Component } from 'react';
import { ViewProps } from 'react-native';
import { PaperThemeWithForm } from '../models/FormStyle';
declare type Align = 'left' | 'center' | 'right';
export declare type DatePickerMode = 'date' | 'time';
export interface DatePickerProps extends ViewProps {
value?: Moment;
disabled?: boolean;
submitOnChange?: boolean;
onChange?: (value: Moment) => void;
/**
* Set the picker visible value to false here.
*
* On Android, you must set visible property to false before
* changing the value property, or else the picker will
* reapper a second time. See
* [issue](https://github.com/react-native-datetimepicker/datetimepicker/issues/54).
*/
onSubmit: (value: Moment) => void;
/**
* Set the picker visible value to false here.
*/
onCancel: () => void;
visible: boolean;
futureDisabled?: boolean;
theme: PaperThemeWithForm;
mode: DatePickerMode;
align?: Align;
}
interface DatePickerState {
date: Moment;
}
/** Cross-platform date picker wrapper. */
declare class DatePicker extends Component<DatePickerProps, DatePickerState> {
static readonly submitOnChangeSupported: boolean;
static readonly isTimePickerSupported: boolean;
/**
* Whether the modal is managed automatically and
* the view should be displayed as a field.
*/
static isIntegrated(options: {
mode: DatePickerMode;
}): boolean;
constructor(props: DatePickerProps);
componentDidMount(): void;
getSnapshotBeforeUpdate(): Partial<DatePickerProps>;
componentDidUpdate(prevProps: Partial<DatePickerProps>): void;
private _setDate;
onChange(value: any): Partial<DatePickerState>;
onSubmit(newState?: DatePickerState): void;
onCancel(): void;
handleAndroidModalEvent(event: any, date: Date): void;
render(): false | JSX.Element;
private renderAndroidPickerModal;
private renderIOSPickerView;
private renderFallbackPickerView;
private renderCalendar;
private renderButtons;
private renderArrow;
private today;
private maximumDate;
private cleanDate;
private calendarDate;
private modalContentStyle;
}
declare const _default: (React.ComponentClass<Pick<DatePickerProps, "disabled" | "mode" | "style" | "hitSlop" | "onLayout" | "testID" | "hasTVPreferredFocus" | "tvParallaxProperties" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "accessibilityRole" | "accessibilityState" | "accessibilityHint" | "accessibilityValue" | "onAccessibilityAction" | "accessibilityLiveRegion" | "importantForAccessibility" | "accessibilityElementsHidden" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors" | "visible" | "nativeID" | "pointerEvents" | "removeClippedSubviews" | "collapsable" | "needsOffscreenAlphaCompositing" | "renderToHardwareTextureAndroid" | "focusable" | "shouldRasterizeIOS" | "isTVSelectable" | "tvParallaxShiftDistanceX" | "tvParallaxShiftDistanceY" | "tvParallaxTiltAngle" | "tvParallaxMagnification" | "onStartShouldSetResponder" | "onMoveShouldSetResponder" | "onResponderEnd" | "onResponderGrant" | "onResponderReject" | "onResponderMove" | "onResponderRelease" | "onResponderStart" | "onResponderTerminationRequest" | "onResponderTerminate" | "onStartShouldSetResponderCapture" | "onMoveShouldSetResponderCapture" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onTouchEndCapture" | "value" | "align" | "onSubmit" | "submitOnChange" | "onChange" | "onCancel" | "futureDisabled"> & {
theme?: import("@callstack/react-theme-provider").$DeepPartial<ReactNativePaper.Theme> | undefined;
}, any> & import("@callstack/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<(React.ComponentClass<DatePickerProps, any> & typeof DatePicker) | (React.FunctionComponent<DatePickerProps> & typeof DatePicker), {}>) | (React.FunctionComponent<Pick<DatePickerProps, "disabled" | "mode" | "style" | "hitSlop" | "onLayout" | "testID" | "hasTVPreferredFocus" | "tvParallaxProperties" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "accessibilityRole" | "accessibilityState" | "accessibilityHint" | "accessibilityValue" | "onAccessibilityAction" | "accessibilityLiveRegion" | "importantForAccessibility" | "accessibilityElementsHidden" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors" | "visible" | "nativeID" | "pointerEvents" | "removeClippedSubviews" | "collapsable" | "needsOffscreenAlphaCompositing" | "renderToHardwareTextureAndroid" | "focusable" | "shouldRasterizeIOS" | "isTVSelectable" | "tvParallaxShiftDistanceX" | "tvParallaxShiftDistanceY" | "tvParallaxTiltAngle" | "tvParallaxMagnification" | "onStartShouldSetResponder" | "onMoveShouldSetResponder" | "onResponderEnd" | "onResponderGrant" | "onResponderReject" | "onResponderMove" | "onResponderRelease" | "onResponderStart" | "onResponderTerminationRequest" | "onResponderTerminate" | "onStartShouldSetResponderCapture" | "onMoveShouldSetResponderCapture" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onTouchEndCapture" | "value" | "align" | "onSubmit" | "submitOnChange" | "onChange" | "onCancel" | "futureDisabled"> & {
theme?: import("@callstack/react-theme-provider").$DeepPartial<ReactNativePaper.Theme> | undefined;
}> & import("@callstack/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<(React.ComponentClass<DatePickerProps, any> & typeof DatePicker) | (React.FunctionComponent<DatePickerProps> & typeof DatePicker), {}>);
export default _default;