Skip to content

Commit 011e8a4

Browse files
authored
Add Windows Native Props Types (#346)
* Add Windows Native Props Types * Fix Linting Issues
1 parent 59f5249 commit 011e8a4

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

src/index.d.ts

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ type AndroidMode = 'date' | 'time';
66
type Display = 'spinner' | 'default' | 'clock' | 'calendar';
77
type IOSDisplay = 'default' | 'compact' | 'inline' | 'spinner';
88
type MinuteInterval = 1 | 2 | 3 | 4 | 5 | 6 | 10 | 12 | 15 | 20 | 30;
9+
type DAY_OF_WEEK = 0 | 1 | 2 | 3 | 4 | 5 | 6;
910

1011
export type Event = SyntheticEvent<
1112
Readonly<{
@@ -148,6 +149,41 @@ export type NativeRef = {
148149
current: Ref<RCTDateTimePickerNative> | null;
149150
};
150151

151-
declare const RNDateTimePicker: FC<IOSNativeProps | AndroidNativeProps>;
152+
export type WindowsDatePickerChangeEvent = {
153+
nativeEvent: {
154+
newDate: number;
155+
};
156+
};
157+
158+
export type WindowsNativeProps = Readonly<
159+
BaseProps &
160+
DateOptions &
161+
TimeOptions & {
162+
/**
163+
* The display options.
164+
*/
165+
display?: Display;
166+
167+
onChange?: (event: WindowsDatePickerChangeEvent, date?: Date) => void;
168+
placeholderText?: string;
169+
dateFormat?:
170+
| 'day month year'
171+
| 'dayofweek day month'
172+
| 'longdate'
173+
| 'shortdate';
174+
dayOfWeekFormat?:
175+
| '{dayofweek.abbreviated(2)}'
176+
| '{dayofweek.abbreviated(3)}'
177+
| '{dayofweek.full}';
178+
firstDayOfWeek?: DAY_OF_WEEK;
179+
timeZoneOffsetInSeconds?: number;
180+
is24Hour?: boolean;
181+
minuteInterval?: number;
182+
}
183+
>;
184+
185+
declare const RNDateTimePicker: FC<
186+
IOSNativeProps | AndroidNativeProps | WindowsNativeProps
187+
>;
152188

153189
export default RNDateTimePicker;

0 commit comments

Comments
 (0)