Skip to content

Commit d55bbfe

Browse files
rubennortefacebook-github-bot
authored andcommitted
Do not reference DOM types in public API for VirtualView (#53272)
Summary: Pull Request resolved: #53272 Changelog: [internal] `VirtualView` has been exposed as an unstable API in the `react-native` package but its public API is referencing the DOM APIs, which forces their definitions to also be public (but shouldn't because they haven't been released yet). This replaces the reference with a reference to `HostInstance`, which will be updated to reference the DOM APIs when ready. Reviewed By: yungsters Differential Revision: D80254442 fbshipit-source-id: 254779c97c116ba08b6cc0c185906617ffd1269f
1 parent f9a49e5 commit d55bbfe

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

packages/react-native/ReactNativeApi.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<2945ef6895f3b6ab1da15ac08a6ef3e7>>
7+
* @generated SignedSource<<41ecf4d1ea640f43ef6f21ae5670d30f>>
88
*
99
* This file was generated by scripts/js-api/build-types/index.js.
1010
*/
@@ -3195,7 +3195,7 @@ declare type ModalRefProps = {
31953195
declare type ModeChangeEvent = Readonly<
31963196
Omit<NativeModeChangeEvent, "mode"> & {
31973197
mode: VirtualViewMode
3198-
target: ReadOnlyElement_default
3198+
target: HostInstance
31993199
}
32003200
>
32013201
declare type Module = {}
@@ -6074,7 +6074,7 @@ export {
60746074
ModalProps, // 3fb62261
60756075
ModalPropsAndroid, // 515fb173
60766076
ModalPropsIOS, // 6053cb61
6077-
ModeChangeEvent, // 0dc5e81f
6077+
ModeChangeEvent, // 0d79bb94
60786078
MouseEvent, // d432147f
60796079
NativeAppEventEmitter, // b4d20c1d
60806080
NativeColorValue, // d2094c29

packages/react-native/src/private/components/virtualview/VirtualView.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import type {ViewStyleProp} from '../../../../Libraries/StyleSheet/StyleSheet';
1212
import type {NativeSyntheticEvent} from '../../../../Libraries/Types/CoreEventTypes';
13-
import type ReadOnlyElement from '../../webapis/dom/nodes/ReadOnlyElement';
13+
import type {HostInstance} from '../../types/HostInstance';
1414
import type {NativeModeChangeEvent} from './VirtualViewNativeComponent';
1515

1616
import StyleSheet from '../../../../Libraries/StyleSheet/StyleSheet';
@@ -44,7 +44,7 @@ export type Rect = $ReadOnly<{
4444
export type ModeChangeEvent = $ReadOnly<{
4545
...Omit<NativeModeChangeEvent, 'mode'>,
4646
mode: VirtualViewMode,
47-
target: ReadOnlyElement,
47+
target: HostInstance,
4848
}>;
4949

5050
type VirtualViewComponent = component(
@@ -92,8 +92,8 @@ function createVirtualView(
9292
? null
9393
: onModeChange.bind(null, {
9494
mode,
95-
// $FlowFixMe[incompatible-cast]
96-
target: event.currentTarget as ReadOnlyElement,
95+
// $FlowFixMe[incompatible-type] - we know this is a HostInstance
96+
target: event.currentTarget as HostInstance,
9797
targetRect: event.nativeEvent.targetRect,
9898
thresholdRect: event.nativeEvent.thresholdRect,
9999
});

0 commit comments

Comments
 (0)