Skip to content

Commit

Permalink
fix: display prop TypeScript issue (#636)
Browse files Browse the repository at this point in the history
Potential typing BREAKING CHANGE: fix the `display` prop type. 
It shouldn't be a breaking change, but if you were patching the package this might break your CI so we're releasing it as a breaking change just to be on the safe side :) 
To verify it, just update to this version and re-run the typecheck script of your app: if it works, you're good to go 👍
  • Loading branch information
matthewparavati committed Mar 30, 2022
1 parent 48e9b61 commit 1fd3755
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
18 changes: 16 additions & 2 deletions src/DateTimePickerModal.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,14 @@ export const ConfirmButton = ({
accessibilityRole="button"
accessibilityLabel={label}
>
<Text style={[style.text, buttonTextColorIOS && { color: buttonTextColorIOS }]}>{label}</Text>
<Text
style={[
style.text,
buttonTextColorIOS && { color: buttonTextColorIOS },
]}
>
{label}
</Text>
</TouchableHighlight>
);
};
Expand Down Expand Up @@ -299,7 +306,14 @@ export const CancelButton = ({
accessibilityRole="button"
accessibilityLabel={label}
>
<Text style={[style.text, buttonTextColorIOS && { color: buttonTextColorIOS }]}>{label}</Text>
<Text
style={[
style.text,
buttonTextColorIOS && { color: buttonTextColorIOS },
]}
>
{label}
</Text>
</TouchableHighlight>
);
};
Expand Down
11 changes: 7 additions & 4 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export interface DateTimePickerProps {
* Default is '#007ff9'
*/
buttonTextColorIOS?: string;

/**
* The prop to locate cancel button for e2e testing
*/
Expand Down Expand Up @@ -174,7 +174,7 @@ export interface DateTimePickerProps {
*
* @extends from DatePickerIOSProperties
*/
minuteInterval?: 1 | 2 | 3 | 4 | 5 | 6 | 10 | 12 | 15 | 20 | 30;
minuteInterval?: 1 | 2 | 3 | 4 | 5 | 6 | 10 | 12 | 15 | 20 | 30;

/**
* Timezone offset in minutes.
Expand Down Expand Up @@ -216,9 +216,12 @@ export interface DateTimePickerProps {
testID?: string;
}

type NativePickerProps =
| Omit<IOSNativeProps, "value" | "mode">
| Omit<AndroidNativeProps, "value" | "mode">;

export type ReactNativeModalDateTimePickerProps = DateTimePickerProps &
Omit<IOSNativeProps, "value" | "mode" | "onChange"> &
Omit<AndroidNativeProps, "value" | "mode" | "onChange">;
NativePickerProps;

export default class DateTimePicker extends React.Component<
ReactNativeModalDateTimePickerProps,
Expand Down

0 comments on commit 1fd3755

Please sign in to comment.