From 38d5845a1e870110a612d642879b8177b482013b Mon Sep 17 00:00:00 2001 From: foxmicha Date: Tue, 16 Jan 2018 09:32:07 -0500 Subject: [PATCH] Update React-Native Modal prop typings Please fill in this template. - [x] Use a meaningful title for the pull request. Include the name of the package modified. - [x] Test the change in your own code. (Compile and run.) - [x] Follow the advice from the [readme](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#make-a-pull-request). - [x] Avoid [common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#common-mistakes). - [x] Run `npm run lint package-name` (or `tsc` if no `tslint.json` is present). Select one of these and delete the others: If changing an existing definition: - [x] Provide a URL to documentation or source code which provides context for the suggested changes: https://github.com/facebook/react-native/blob/master/Libraries/Modal/Modal.js#L161 Additional info: Just like the onShow optional prop, the Modal's onOrientationChange prop can capture a NativeSyntheticEvent at the time of the hardware change. This allows the developer to determine if the orientation change was to the landscape or portrait style and react accordingly. --- types/react-native/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 7368241a9e..86cd2c59f4 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -4363,7 +4363,7 @@ export interface ModalProperties { * The orientation provided is only 'portrait' or 'landscape'. This callback is also called on initial render, regardless of the current orientation. * @platform ios */ - onOrientationChange?: () => void; + onOrientationChange?: (event?: NativeSyntheticEvent) => void; /** * The `onDismiss` prop allows passing a function that will be called once the modal has been dismissed. * @platform ios