@office-iss/react-native-win32 0.0.0-canary.286 → 0.0.0-canary.288

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/.flowconfig +4 -1
  2. package/CHANGELOG.json +57 -1
  3. package/CHANGELOG.md +23 -4
  4. package/Libraries/Alert/RCTAlertManager.js.flow +18 -0
  5. package/Libraries/Animated/Animated.js +8 -37
  6. package/Libraries/Animated/Animated.js.flow +15 -0
  7. package/Libraries/Animated/AnimatedExports.js +47 -0
  8. package/Libraries/Animated/AnimatedExports.js.flow +48 -0
  9. package/Libraries/Animated/useAnimatedValue.js +1 -3
  10. package/Libraries/Blob/URLSearchParams.js.flow +23 -0
  11. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +1 -1
  12. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +1 -1
  13. package/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.js.flow +20 -0
  14. package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +8 -8
  15. package/Libraries/Components/Button.js +2 -2
  16. package/Libraries/Components/Button.win32.js +2 -2
  17. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +14 -100
  18. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +64 -4
  19. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js +138 -0
  20. package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +7 -4
  21. package/Libraries/Components/LayoutConformance/LayoutConformance.js +6 -4
  22. package/Libraries/Components/LayoutConformance/LayoutConformanceNativeComponent.js +1 -1
  23. package/Libraries/Components/Pressable/Pressable.js +18 -63
  24. package/Libraries/Components/Pressable/Pressable.win32.js +19 -65
  25. package/Libraries/Components/Pressable/useAndroidRippleForView.js +2 -2
  26. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js +4 -46
  27. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js +10 -4
  28. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidTypes.js +54 -0
  29. package/Libraries/Components/RefreshControl/RefreshControl.js +10 -7
  30. package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +2 -1
  31. package/Libraries/Components/SafeAreaView/SafeAreaView.js +1 -1
  32. package/Libraries/Components/SafeAreaView/SafeAreaView.win32.js +1 -1
  33. package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +2 -4
  34. package/Libraries/Components/ScrollView/ScrollContentViewNativeComponent.js +2 -4
  35. package/Libraries/Components/ScrollView/ScrollView.js +43 -59
  36. package/Libraries/Components/ScrollView/ScrollViewCommands.js +1 -1
  37. package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +2 -4
  38. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +6 -7
  39. package/Libraries/Components/StatusBar/StatusBar.js +33 -22
  40. package/Libraries/Components/Switch/Switch.js +70 -41
  41. package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +2 -4
  42. package/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js +2 -4
  43. package/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js +2 -4
  44. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +1 -0
  45. package/Libraries/Components/TextInput/TextInput.flow.js +10 -12
  46. package/Libraries/Components/TextInput/TextInput.js +22 -28
  47. package/Libraries/Components/TextInput/TextInput.win32.js +22 -28
  48. package/Libraries/Components/TextInput/TextInputState.js +2 -18
  49. package/Libraries/Components/TextInput/TextInputState.win32.js +2 -18
  50. package/Libraries/Components/TextInput/Win32TextInputNativeComponent.js +1 -1
  51. package/Libraries/Components/Touchable/Touchable.js +7 -7
  52. package/Libraries/Components/Touchable/Touchable.win32.js +7 -7
  53. package/Libraries/Components/Touchable/TouchableBounce.js +1 -1
  54. package/Libraries/Components/Touchable/TouchableHighlight.js +35 -14
  55. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +95 -47
  56. package/Libraries/Components/Touchable/TouchableNativeFeedback.win32.js +248 -43
  57. package/Libraries/Components/Touchable/TouchableOpacity.js +52 -10
  58. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +112 -59
  59. package/Libraries/Components/View/View.js +1 -1
  60. package/Libraries/Components/View/View.win32.js +1 -1
  61. package/Libraries/Components/View/ViewNativeComponent.js +2 -4
  62. package/Libraries/Components/View/ViewPropTypes.js +15 -12
  63. package/Libraries/Components/View/ViewPropTypes.win32.js +74 -71
  64. package/Libraries/Core/ReactNativeVersion.js +1 -1
  65. package/Libraries/Core/setUpReactDevTools.js +2 -0
  66. package/Libraries/Debugging/DebuggingOverlayRegistry.js +10 -7
  67. package/Libraries/Image/Image.android.js +1 -1
  68. package/Libraries/Image/Image.js.flow +27 -0
  69. package/Libraries/Image/ImageBackground.js +1 -1
  70. package/Libraries/Image/ImageProps.js +97 -30
  71. package/Libraries/Image/ImageTypes.flow.js +16 -6
  72. package/Libraries/Image/ImageViewNativeComponent.js +3 -5
  73. package/Libraries/Image/TextInlineImageNativeComponent.js +2 -4
  74. package/Libraries/Interaction/InteractionManager.js +9 -1
  75. package/Libraries/Interaction/PanResponder.js +11 -11
  76. package/Libraries/Interaction/TaskQueue.js +2 -2
  77. package/Libraries/Lists/FlatList.js +8 -7
  78. package/Libraries/LogBox/LogBox.js +1 -1
  79. package/Libraries/NativeComponent/BaseViewConfig.js.flow +14 -0
  80. package/Libraries/NativeComponent/NativeComponentRegistry.js +1 -1
  81. package/Libraries/Network/RCTNetworking.js.flow +44 -0
  82. package/Libraries/Network/XMLHttpRequest_new.js +3 -0
  83. package/Libraries/Network/XMLHttpRequest_old.js +3 -0
  84. package/Libraries/Pressability/HoverState.js +1 -0
  85. package/Libraries/Pressability/HoverState.win32.js +1 -0
  86. package/Libraries/Pressability/Pressability.js +2 -2
  87. package/Libraries/Pressability/Pressability.win32.js +3 -3
  88. package/Libraries/ReactNative/FabricUIManager.js +5 -3
  89. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +7 -5
  90. package/Libraries/ReactNative/RendererImplementation.js +3 -5
  91. package/Libraries/ReactNative/requireNativeComponent.js +1 -1
  92. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +12 -0
  93. package/Libraries/Renderer/shims/ReactNativeTypes.js +39 -91
  94. package/Libraries/StyleSheet/PlatformColorValueTypes.js.flow +22 -0
  95. package/Libraries/Text/Text.d.ts +1 -1
  96. package/Libraries/Text/Text.js +3 -1
  97. package/Libraries/Text/Text.win32.js +3 -1
  98. package/Libraries/Text/TextNativeComponent.js +1 -1
  99. package/Libraries/Text/TextNativeComponent.win32.js +1 -1
  100. package/Libraries/Text/TextProps.js +124 -84
  101. package/Libraries/Text/TextProps.win32.js +124 -84
  102. package/Libraries/Types/CoreEventTypes.js +1 -1
  103. package/Libraries/Types/CoreEventTypes.win32.js +1 -1
  104. package/Libraries/Types/ReactDevToolsTypes.js +4 -8
  105. package/Libraries/Utilities/BackHandler.js.flow +25 -0
  106. package/Libraries/Utilities/DevSettings.js +14 -0
  107. package/Libraries/Utilities/Dimensions.js +5 -0
  108. package/Libraries/Utilities/Dimensions.win32.js +5 -0
  109. package/{flow/Position.js → Libraries/Utilities/Platform.js.flow} +3 -6
  110. package/Libraries/Utilities/PlatformTypes.js +97 -7
  111. package/Libraries/Utilities/codegenNativeComponent.js +1 -1
  112. package/Libraries/__flowtests__/ReactNativeTypes-flowtest.js +2 -4
  113. package/index.win32.js +3 -4
  114. package/overrides.json +24 -24
  115. package/package.json +15 -16
  116. package/src/private/components/HScrollViewNativeComponents.js +1 -1
  117. package/src/private/components/VScrollViewNativeComponents.js +1 -1
  118. package/src/private/featureflags/ReactNativeFeatureFlags.js +11 -6
  119. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +3 -2
  120. package/src/private/inspector/getInspectorDataForViewAtPoint.js +2 -4
  121. package/src/private/setup/setUpDOM.js +36 -1
  122. package/src/private/specs_DEPRECATED/components/ActivityIndicatorViewNativeComponent.js +1 -1
  123. package/src/private/specs_DEPRECATED/components/AndroidDrawerLayoutNativeComponent.js +1 -1
  124. package/src/private/specs_DEPRECATED/components/AndroidHorizontalScrollContentViewNativeComponent.js +1 -1
  125. package/src/private/specs_DEPRECATED/components/AndroidSwipeRefreshLayoutNativeComponent.js +1 -1
  126. package/src/private/specs_DEPRECATED/components/AndroidSwitchNativeComponent.js +1 -1
  127. package/src/private/specs_DEPRECATED/components/DebuggingOverlayNativeComponent.js +1 -1
  128. package/src/private/specs_DEPRECATED/components/ProgressBarAndroidNativeComponent.js +1 -1
  129. package/src/private/specs_DEPRECATED/components/PullToRefreshViewNativeComponent.js +1 -1
  130. package/src/private/specs_DEPRECATED/components/RCTInputAccessoryViewNativeComponent.js +1 -1
  131. package/src/private/specs_DEPRECATED/components/RCTModalHostViewNativeComponent.js +1 -1
  132. package/src/private/specs_DEPRECATED/components/RCTSafeAreaViewNativeComponent.js +1 -1
  133. package/src/private/specs_DEPRECATED/components/SwitchNativeComponent.js +1 -1
  134. package/src/private/specs_DEPRECATED/components/UnimplementedNativeViewNativeComponent.js +1 -1
  135. package/src/private/types/HostComponent.js +16 -0
  136. package/src/private/types/HostInstance.js +50 -0
  137. package/src/private/webapis/dom/nodes/ReactNativeDocument.js +1 -0
  138. package/src/private/webapis/dom/nodes/ReactNativeElement.js +40 -32
  139. package/src/private/webapis/dom/nodes/ReadOnlyCharacterData.js +1 -1
  140. package/src/private/webapis/dom/nodes/ReadOnlyElement.js +1 -1
  141. package/src/private/webapis/dom/nodes/ReadOnlyNode.js +1 -1
  142. package/src/private/webapis/intersectionobserver/IntersectionObserver.js +4 -4
  143. package/src/private/webapis/mutationobserver/MutationObserver.js +9 -9
  144. package/src/private/webapis/performance/PerformanceObserver.js +6 -6
  145. package/src/types/globals.d.ts +628 -0
  146. package/src-win/Libraries/Text/Text.d.ts +1 -1
  147. package/types/index.d.ts +2 -53
  148. package/types/modules/globals.d.ts +0 -599
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @flow strict
7
+ * @flow strict-local
8
8
  * @format
9
9
  */
10
10
 
@@ -29,6 +29,11 @@ export default function setUpDOM() {
29
29
  () => require('../webapis/geometry/DOMRectReadOnly').default,
30
30
  );
31
31
 
32
+ polyfillGlobal(
33
+ 'DOMRectList',
34
+ () => require('../webapis/geometry/DOMRectList').default,
35
+ );
36
+
32
37
  polyfillGlobal(
33
38
  'HTMLCollection',
34
39
  () => require('../webapis/dom/oldstylecollections/HTMLCollection').default,
@@ -38,4 +43,34 @@ export default function setUpDOM() {
38
43
  'NodeList',
39
44
  () => require('../webapis/dom/oldstylecollections/NodeList').default,
40
45
  );
46
+
47
+ polyfillGlobal(
48
+ 'Node',
49
+ () => require('../webapis/dom/nodes/ReadOnlyNode').default,
50
+ );
51
+
52
+ polyfillGlobal(
53
+ 'Document',
54
+ () => require('../webapis/dom/nodes/ReactNativeDocument').default,
55
+ );
56
+
57
+ polyfillGlobal(
58
+ 'CharacterData',
59
+ () => require('../webapis/dom/nodes/ReadOnlyCharacterData').default,
60
+ );
61
+
62
+ polyfillGlobal(
63
+ 'Text',
64
+ () => require('../webapis/dom/nodes/ReadOnlyText').default,
65
+ );
66
+
67
+ polyfillGlobal(
68
+ 'Element',
69
+ () => require('../webapis/dom/nodes/ReadOnlyElement').default,
70
+ );
71
+
72
+ polyfillGlobal(
73
+ 'HTMLElement',
74
+ () => require('../webapis/dom/nodes/ReactNativeElement').default,
75
+ );
41
76
  }
@@ -9,9 +9,9 @@
9
9
  */
10
10
 
11
11
  import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
12
- import type {HostComponent} from '../../../../Libraries/Renderer/shims/ReactNativeTypes';
13
12
  import type {ColorValue} from '../../../../Libraries/StyleSheet/StyleSheet';
14
13
  import type {WithDefault} from '../../../../Libraries/Types/CodegenTypes';
14
+ import type {HostComponent} from '../../types/HostComponent';
15
15
 
16
16
  import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
17
17
 
@@ -9,7 +9,6 @@
9
9
  */
10
10
 
11
11
  import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
12
- import type {HostComponent} from '../../../../Libraries/Renderer/shims/ReactNativeTypes';
13
12
  import type {ColorValue} from '../../../../Libraries/StyleSheet/StyleSheet';
14
13
  import type {
15
14
  DirectEventHandler,
@@ -17,6 +16,7 @@ import type {
17
16
  Int32,
18
17
  WithDefault,
19
18
  } from '../../../../Libraries/Types/CodegenTypes';
19
+ import type {HostComponent} from '../../types/HostComponent';
20
20
 
21
21
  import codegenNativeCommands from '../../../../Libraries/Utilities/codegenNativeCommands';
22
22
  import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
@@ -9,7 +9,7 @@
9
9
  */
10
10
 
11
11
  import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
12
- import type {HostComponent} from '../../../../Libraries/Renderer/shims/ReactNativeTypes';
12
+ import type {HostComponent} from '../../types/HostComponent';
13
13
 
14
14
  import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
15
15
 
@@ -9,13 +9,13 @@
9
9
  */
10
10
 
11
11
  import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
12
- import type {HostComponent} from '../../../../Libraries/Renderer/shims/ReactNativeTypes';
13
12
  import type {ColorValue} from '../../../../Libraries/StyleSheet/StyleSheet';
14
13
  import type {
15
14
  DirectEventHandler,
16
15
  Float,
17
16
  WithDefault,
18
17
  } from '../../../../Libraries/Types/CodegenTypes';
18
+ import type {HostComponent} from '../../types/HostComponent';
19
19
 
20
20
  import codegenNativeCommands from '../../../../Libraries/Utilities/codegenNativeCommands';
21
21
  import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
@@ -9,13 +9,13 @@
9
9
  */
10
10
 
11
11
  import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
12
- import type {HostComponent} from '../../../../Libraries/Renderer/shims/ReactNativeTypes';
13
12
  import type {ColorValue} from '../../../../Libraries/StyleSheet/StyleSheet';
14
13
  import type {
15
14
  BubblingEventHandler,
16
15
  Int32,
17
16
  WithDefault,
18
17
  } from '../../../../Libraries/Types/CodegenTypes';
18
+ import type {HostComponent} from '../../types/HostComponent';
19
19
 
20
20
  import codegenNativeCommands from '../../../../Libraries/Utilities/codegenNativeCommands';
21
21
  import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
@@ -9,8 +9,8 @@
9
9
  */
10
10
 
11
11
  import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
12
- import type {HostComponent} from '../../../../Libraries/Renderer/shims/ReactNativeTypes';
13
12
  import type {ProcessedColorValue} from '../../../../Libraries/StyleSheet/processColor';
13
+ import type {HostComponent} from '../../types/HostComponent';
14
14
 
15
15
  import codegenNativeCommands from '../../../../Libraries/Utilities/codegenNativeCommands';
16
16
  import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
@@ -9,12 +9,12 @@
9
9
  */
10
10
 
11
11
  import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
12
- import type {HostComponent} from '../../../../Libraries/Renderer/shims/ReactNativeTypes';
13
12
  import type {ColorValue} from '../../../../Libraries/StyleSheet/StyleSheet';
14
13
  import type {
15
14
  Double,
16
15
  WithDefault,
17
16
  } from '../../../../Libraries/Types/CodegenTypes';
17
+ import type {HostComponent} from '../../types/HostComponent';
18
18
 
19
19
  import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
20
20
 
@@ -9,13 +9,13 @@
9
9
  */
10
10
 
11
11
  import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
12
- import type {HostComponent} from '../../../../Libraries/Renderer/shims/ReactNativeTypes';
13
12
  import type {ColorValue} from '../../../../Libraries/StyleSheet/StyleSheet';
14
13
  import type {
15
14
  DirectEventHandler,
16
15
  Float,
17
16
  WithDefault,
18
17
  } from '../../../../Libraries/Types/CodegenTypes';
18
+ import type {HostComponent} from '../../types/HostComponent';
19
19
 
20
20
  import codegenNativeCommands from '../../../../Libraries/Utilities/codegenNativeCommands';
21
21
  import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
@@ -9,8 +9,8 @@
9
9
  */
10
10
 
11
11
  import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
12
- import type {HostComponent} from '../../../../Libraries/Renderer/shims/ReactNativeTypes';
13
12
  import type {ColorValue} from '../../../../Libraries/StyleSheet/StyleSheet';
13
+ import type {HostComponent} from '../../types/HostComponent';
14
14
 
15
15
  import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
16
16
 
@@ -9,12 +9,12 @@
9
9
  */
10
10
 
11
11
  import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
12
- import type {HostComponent} from '../../../../Libraries/Renderer/shims/ReactNativeTypes';
13
12
  import type {
14
13
  DirectEventHandler,
15
14
  Int32,
16
15
  WithDefault,
17
16
  } from '../../../../Libraries/Types/CodegenTypes';
17
+ import type {HostComponent} from '../../types/HostComponent';
18
18
 
19
19
  import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
20
20
 
@@ -9,7 +9,7 @@
9
9
  */
10
10
 
11
11
  import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
12
- import type {HostComponent} from '../../../../Libraries/Renderer/shims/ReactNativeTypes';
12
+ import type {HostComponent} from '../../types/HostComponent';
13
13
 
14
14
  import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
15
15
 
@@ -9,13 +9,13 @@
9
9
  */
10
10
 
11
11
  import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
12
- import type {HostComponent} from '../../../../Libraries/Renderer/shims/ReactNativeTypes';
13
12
  import type {ColorValue} from '../../../../Libraries/StyleSheet/StyleSheet';
14
13
  import type {
15
14
  BubblingEventHandler,
16
15
  Int32,
17
16
  WithDefault,
18
17
  } from '../../../../Libraries/Types/CodegenTypes';
18
+ import type {HostComponent} from '../../types/HostComponent';
19
19
 
20
20
  import codegenNativeCommands from '../../../../Libraries/Utilities/codegenNativeCommands';
21
21
  import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
@@ -9,8 +9,8 @@
9
9
  */
10
10
 
11
11
  import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
12
- import type {HostComponent} from '../../../../Libraries/Renderer/shims/ReactNativeTypes';
13
12
  import type {WithDefault} from '../../../../Libraries/Types/CodegenTypes';
13
+ import type {HostComponent} from '../../types/HostComponent';
14
14
 
15
15
  import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
16
16
 
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict
8
+ * @format
9
+ */
10
+
11
+ import type {HostInstance} from './HostInstance';
12
+
13
+ export type HostComponent<Config: {...}> = component(
14
+ ref: React.RefSetter<HostInstance>,
15
+ ...Config
16
+ );
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @format
8
+ * @flow strict
9
+ */
10
+
11
+ export type MeasureOnSuccessCallback = (
12
+ x: number,
13
+ y: number,
14
+ width: number,
15
+ height: number,
16
+ pageX: number,
17
+ pageY: number,
18
+ ) => void;
19
+
20
+ export type MeasureInWindowOnSuccessCallback = (
21
+ x: number,
22
+ y: number,
23
+ width: number,
24
+ height: number,
25
+ ) => void;
26
+
27
+ export type MeasureLayoutOnSuccessCallback = (
28
+ left: number,
29
+ top: number,
30
+ width: number,
31
+ height: number,
32
+ ) => void;
33
+
34
+ /**
35
+ * Current usages should migrate to this definition
36
+ */
37
+ export interface LegacyHostInstanceMethods {
38
+ blur(): void;
39
+ focus(): void;
40
+ measure(callback: MeasureOnSuccessCallback): void;
41
+ measureInWindow(callback: MeasureInWindowOnSuccessCallback): void;
42
+ measureLayout(
43
+ relativeToNativeNode: number | HostInstance,
44
+ onSuccess: MeasureLayoutOnSuccessCallback,
45
+ onFail?: () => void,
46
+ ): void;
47
+ setNativeProps(nativeProps: {...}): void;
48
+ }
49
+
50
+ export type HostInstance = LegacyHostInstanceMethods;
@@ -71,6 +71,7 @@ export default class ReactNativeDocument extends ReadOnlyNode {
71
71
  return null;
72
72
  }
73
73
 
74
+ // $FlowExpectedError[incompatible-extend] This is defined as returning string in Node, but it's actually null in Document.
74
75
  get textContent(): null {
75
76
  return null;
76
77
  }
@@ -11,15 +11,17 @@
11
11
  // flowlint unsafe-getters-setters:off
12
12
 
13
13
  import type {
14
- HostInstance,
15
- INativeMethods,
16
14
  InternalInstanceHandle,
17
- MeasureInWindowOnSuccessCallback,
18
- MeasureLayoutOnSuccessCallback,
19
- MeasureOnSuccessCallback,
20
15
  Node as ShadowNode,
21
16
  ViewConfig,
22
17
  } from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
18
+ import type {
19
+ HostInstance,
20
+ LegacyHostInstanceMethods,
21
+ MeasureInWindowOnSuccessCallback,
22
+ MeasureLayoutOnSuccessCallback,
23
+ MeasureOnSuccessCallback,
24
+ } from '../../../types/HostInstance';
23
25
  import type {InstanceHandle} from './internals/NodeInternals';
24
26
  import type ReactNativeDocument from './ReactNativeDocument';
25
27
 
@@ -58,9 +60,9 @@ const noop = () => {};
58
60
  // was slower than this method because the engine has to create an object than
59
61
  // we then discard to create a new one.
60
62
 
61
- class ReactNativeElementMethods
63
+ class ReactNativeElement
62
64
  extends ReadOnlyElement
63
- implements INativeMethods
65
+ implements LegacyHostInstanceMethods
64
66
  {
65
67
  // These need to be accessible from `ReactFabricPublicInstanceUtils`.
66
68
  __nativeTag: number;
@@ -144,12 +146,10 @@ class ReactNativeElementMethods
144
146
  */
145
147
 
146
148
  blur(): void {
147
- // $FlowFixMe[incompatible-exact] Migrate all usages of `NativeMethods` to an interface to fix this.
148
149
  TextInputState.blurTextInput(this);
149
150
  }
150
151
 
151
152
  focus() {
152
- // $FlowFixMe[incompatible-exact] Migrate all usages of `NativeMethods` to an interface to fix this.
153
153
  TextInputState.focusTextInput(this);
154
154
  }
155
155
 
@@ -227,28 +227,36 @@ class ReactNativeElementMethods
227
227
  }
228
228
  }
229
229
 
230
- // Alternative constructor just implemented to provide a better performance than
231
- // calling super() in the original class.
232
- function ReactNativeElement(
233
- this: ReactNativeElementMethods,
234
- tag: number,
235
- viewConfig: ViewConfig,
236
- internalInstanceHandle: InternalInstanceHandle,
237
- ownerDocument: ReactNativeDocument,
238
- ) {
239
- // Inlined from `ReadOnlyNode`
240
- setOwnerDocument(this, ownerDocument);
241
- setInstanceHandle(this, internalInstanceHandle);
242
-
243
- this.__nativeTag = tag;
244
- this.__internalInstanceHandle = internalInstanceHandle;
245
- this.__viewConfig = viewConfig;
246
- }
230
+ type ReactNativeElementT = ReactNativeElement;
247
231
 
248
- ReactNativeElement.prototype = Object.create(
249
- ReactNativeElementMethods.prototype,
250
- );
232
+ function replaceConstructorWithoutSuper(
233
+ ReactNativeElementClass: Class<ReactNativeElementT>,
234
+ ): Class<ReactNativeElementT> {
235
+ // Alternative constructor just implemented to provide a better performance than
236
+ // calling super() in the original class.
237
+ // eslint-disable-next-line no-shadow
238
+ function ReactNativeElement(
239
+ this: ReactNativeElementT,
240
+ tag: number,
241
+ viewConfig: ViewConfig,
242
+ internalInstanceHandle: InternalInstanceHandle,
243
+ ownerDocument: ReactNativeDocument,
244
+ ) {
245
+ // Inlined from `ReadOnlyNode`
246
+ setOwnerDocument(this, ownerDocument);
247
+ setInstanceHandle(this, internalInstanceHandle);
248
+
249
+ this.__nativeTag = tag;
250
+ this.__internalInstanceHandle = internalInstanceHandle;
251
+ this.__viewConfig = viewConfig;
252
+ }
253
+
254
+ ReactNativeElement.prototype = ReactNativeElementClass.prototype;
255
+
256
+ // $FlowExpectedError[incompatible-return]
257
+ return ReactNativeElement;
258
+ }
251
259
 
252
- // $FlowExpectedError[prop-missing]
253
- // $FlowFixMe[incompatible-cast]
254
- export default ReactNativeElement as typeof ReactNativeElementMethods;
260
+ export default replaceConstructorWithoutSuper(
261
+ ReactNativeElement,
262
+ ) as typeof ReactNativeElement;
@@ -43,7 +43,7 @@ export default class ReadOnlyCharacterData extends ReadOnlyNode {
43
43
  /**
44
44
  * @override
45
45
  */
46
- get textContent(): string | null {
46
+ get textContent(): string {
47
47
  return this.data;
48
48
  }
49
49
 
@@ -179,7 +179,7 @@ export default class ReadOnlyElement extends ReadOnlyNode {
179
179
  return '';
180
180
  }
181
181
 
182
- get textContent(): string | null {
182
+ get textContent(): string {
183
183
  const node = getNativeElementReference(this);
184
184
 
185
185
  if (node != null) {
@@ -155,7 +155,7 @@ export default class ReadOnlyNode {
155
155
  /**
156
156
  * @abstract
157
157
  */
158
- get textContent(): string | null {
158
+ get textContent(): string {
159
159
  throw new TypeError(
160
160
  '`textContent` is abstract and must be implemented in a subclass of `ReadOnlyNode`',
161
161
  );
@@ -21,10 +21,10 @@ export type IntersectionObserverCallback = (
21
21
  observer: IntersectionObserver,
22
22
  ) => mixed;
23
23
 
24
- type IntersectionObserverInit = {
24
+ export interface IntersectionObserverInit {
25
25
  // root?: ReactNativeElement, // This option exists on the Web but it's not currently supported in React Native.
26
26
  // rootMargin?: string, // This option exists on the Web but it's not currently supported in React Native.
27
- threshold?: number | $ReadOnlyArray<number>,
27
+ threshold?: number | $ReadOnlyArray<number>;
28
28
 
29
29
  /**
30
30
  * This is a React Native specific option (not spec compliant) that specifies
@@ -36,8 +36,8 @@ type IntersectionObserverInit = {
36
36
  * Note: If `rnRootThreshold` is set, and `threshold` is not set,
37
37
  * `threshold` will not default to [0] (as per spec)
38
38
  */
39
- rnRootThreshold?: number | $ReadOnlyArray<number>,
40
- };
39
+ rnRootThreshold?: number | $ReadOnlyArray<number>;
40
+ }
41
41
 
42
42
  /**
43
43
  * The [Intersection Observer API](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API)
@@ -21,18 +21,18 @@ export type MutationObserverCallback = (
21
21
  observer: MutationObserver,
22
22
  ) => mixed;
23
23
 
24
- type MutationObserverInit = $ReadOnly<{
25
- subtree?: boolean,
24
+ export interface MutationObserverInit {
25
+ +subtree?: boolean;
26
26
  // This is the only supported option so it's required to be `true`.
27
- childList: true,
27
+ +childList: true;
28
28
 
29
29
  // Unsupported:
30
- attributes?: boolean,
31
- attributeFilter?: $ReadOnlyArray<string>,
32
- attributeOldValue?: boolean,
33
- characterData?: boolean,
34
- characterDataOldValue?: boolean,
35
- }>;
30
+ +attributes?: boolean;
31
+ +attributeFilter?: $ReadOnlyArray<string>;
32
+ +attributeOldValue?: boolean;
33
+ +characterData?: boolean;
34
+ +characterDataOldValue?: boolean;
35
+ }
36
36
 
37
37
  /**
38
38
  * This is a React Native implementation for the `MutationObserver` API
@@ -66,12 +66,12 @@ export type PerformanceObserverCallback = (
66
66
  options?: PerformanceObserverCallbackOptions,
67
67
  ) => void;
68
68
 
69
- export type PerformanceObserverInit = {
70
- entryTypes?: Array<PerformanceEntryType>,
71
- type?: PerformanceEntryType,
72
- buffered?: boolean,
73
- durationThreshold?: DOMHighResTimeStamp,
74
- };
69
+ export interface PerformanceObserverInit {
70
+ +entryTypes?: Array<PerformanceEntryType>;
71
+ +type?: PerformanceEntryType;
72
+ +buffered?: boolean;
73
+ +durationThreshold?: DOMHighResTimeStamp;
74
+ }
75
75
 
76
76
  function getSupportedPerformanceEntryTypes(): $ReadOnlyArray<PerformanceEntryType> {
77
77
  if (!NativePerformance) {