@office-iss/react-native-win32 0.74.4 → 0.75.0-preview.2

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 (214) hide show
  1. package/.flowconfig +9 -4
  2. package/CHANGELOG.json +569 -51
  3. package/CHANGELOG.md +173 -30
  4. package/Libraries/Animated/AnimatedImplementation.js +2 -0
  5. package/Libraries/Animated/NativeAnimatedHelper.js +4 -0
  6. package/Libraries/Animated/NativeAnimatedHelper.win32.js +4 -0
  7. package/Libraries/Animated/createAnimatedComponent.js +10 -4
  8. package/Libraries/Animated/useAnimatedProps.js +56 -28
  9. package/Libraries/BatchedBridge/MessageQueue.js +1 -0
  10. package/Libraries/Components/Button.js +10 -5
  11. package/Libraries/Components/Button.win32.js +1 -0
  12. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +11 -2
  13. package/Libraries/Components/Pressable/Pressable.js +13 -6
  14. package/Libraries/Components/Pressable/Pressable.win32.js +13 -6
  15. package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +4 -0
  16. package/Libraries/Components/ScrollView/ScrollView.js +109 -29
  17. package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +6 -0
  18. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +13 -1
  19. package/Libraries/Components/StatusBar/StatusBar.js +1 -21
  20. package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +0 -15
  21. package/Libraries/Components/TextInput/InputAccessoryView.js +10 -1
  22. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +0 -12
  23. package/Libraries/Components/TextInput/TextInput.d.ts +0 -19
  24. package/Libraries/Components/TextInput/TextInput.js +14 -70
  25. package/Libraries/Components/TextInput/TextInput.win32.js +15 -72
  26. package/Libraries/Components/Touchable/Touchable.js +2 -2
  27. package/Libraries/Components/Touchable/TouchableHighlight.d.ts +4 -10
  28. package/Libraries/Components/Touchable/TouchableHighlight.js +3 -1
  29. package/Libraries/Components/Touchable/TouchableOpacity.d.ts +4 -32
  30. package/Libraries/Components/Touchable/TouchableOpacity.js +3 -1
  31. package/Libraries/Components/Touchable/TouchableWithoutFeedback.d.ts +8 -0
  32. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +117 -111
  33. package/Libraries/Components/View/ReactNativeStyleAttributes.js +6 -0
  34. package/Libraries/Components/View/ReactNativeViewAttributes.js +1 -0
  35. package/Libraries/Components/View/ReactNativeViewAttributes.win32.js +1 -0
  36. package/Libraries/Components/View/View.js +0 -11
  37. package/Libraries/Components/View/View.win32.js +0 -11
  38. package/Libraries/Components/View/ViewAccessibility.js +4 -4
  39. package/Libraries/Components/View/ViewAccessibility.win32.js +6 -6
  40. package/Libraries/Components/View/ViewPropTypes.d.ts +7 -49
  41. package/Libraries/Components/View/ViewPropTypes.js +7 -0
  42. package/Libraries/Components/View/ViewPropTypes.win32.js +7 -0
  43. package/Libraries/Core/Devtools/loadBundleFromServer.js +3 -3
  44. package/Libraries/Core/Devtools/loadBundleFromServer.win32.js +153 -0
  45. package/Libraries/Core/Devtools/parseErrorStack.js +5 -5
  46. package/Libraries/Core/Devtools/parseHermesStack.js +22 -16
  47. package/Libraries/Core/ErrorHandlers.js +116 -0
  48. package/Libraries/Core/ExceptionsManager.js +2 -2
  49. package/Libraries/Core/ReactNativeVersion.js +3 -3
  50. package/Libraries/Core/setUpDeveloperTools.js +3 -1
  51. package/Libraries/Core/setUpPerformance.js +6 -4
  52. package/Libraries/Core/setUpReactDevTools.js +70 -10
  53. package/Libraries/Core/setUpTimers.js +50 -31
  54. package/Libraries/Debugging/DebuggingOverlayRegistry.js +1 -1
  55. package/Libraries/Image/Image.android.js +23 -13
  56. package/Libraries/Image/Image.d.ts +14 -15
  57. package/Libraries/Image/Image.ios.js +21 -11
  58. package/Libraries/Image/Image.win32.js +5 -3
  59. package/Libraries/Image/ImageProps.js +16 -5
  60. package/Libraries/Image/ImageTypes.flow.js +7 -2
  61. package/Libraries/Image/ImageUtils.js +1 -0
  62. package/Libraries/Image/ImageViewNativeComponent.js +2 -1
  63. package/Libraries/Inspector/ElementBox.js +6 -3
  64. package/Libraries/Inspector/ElementProperties.js +1 -1
  65. package/Libraries/Interaction/TouchHistoryMath.js +4 -4
  66. package/Libraries/IntersectionObserver/IntersectionObserverManager.js +6 -26
  67. package/Libraries/JSInspector/NetworkAgent.js +1 -1
  68. package/Libraries/LogBox/Data/LogBoxData.js +39 -29
  69. package/Libraries/LogBox/Data/LogBoxLog.js +114 -2
  70. package/Libraries/LogBox/Data/parseLogBoxLog.js +168 -53
  71. package/Libraries/LogBox/LogBox.js +29 -12
  72. package/Libraries/LogBox/LogBoxNotificationContainer.js +4 -0
  73. package/Libraries/LogBox/UI/LogBoxInspector.js +8 -70
  74. package/Libraries/LogBox/UI/LogBoxInspectorBody.js +87 -0
  75. package/Libraries/LogBox/UI/LogBoxInspectorFooter.js +6 -42
  76. package/Libraries/LogBox/UI/LogBoxInspectorFooterButton.js +58 -0
  77. package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +5 -66
  78. package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +8 -52
  79. package/Libraries/LogBox/UI/LogBoxInspectorHeaderButton.js +76 -0
  80. package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js +8 -5
  81. package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.win32.js +8 -5
  82. package/Libraries/LogBox/UI/LogBoxNotification.js +13 -152
  83. package/Libraries/LogBox/UI/LogBoxNotificationCountBadge.js +63 -0
  84. package/Libraries/LogBox/UI/LogBoxNotificationDismissButton.js +67 -0
  85. package/Libraries/LogBox/UI/LogBoxNotificationMessage.js +57 -0
  86. package/Libraries/NativeComponent/BaseViewConfig.android.js +5 -0
  87. package/Libraries/NativeComponent/BaseViewConfig.ios.js +5 -0
  88. package/Libraries/NativeComponent/BaseViewConfig.win32.js +5 -0
  89. package/Libraries/NativeComponent/NativeComponentRegistry.js +12 -5
  90. package/Libraries/NativeComponent/StaticViewConfigValidator.js +3 -0
  91. package/Libraries/Network/XMLHttpRequest.js +5 -1
  92. package/Libraries/NewAppScreen/components/LearnMoreLinks.js +3 -3
  93. package/Libraries/Pressability/Pressability.js +3 -51
  94. package/Libraries/Pressability/Pressability.win32.js +3 -51
  95. package/Libraries/ReactNative/AppContainer-dev.js +3 -2
  96. package/Libraries/ReactNative/AppContainer-prod.js +2 -1
  97. package/Libraries/ReactNative/AppContainer.js +2 -0
  98. package/Libraries/ReactNative/AppRegistry.d.ts +7 -0
  99. package/Libraries/ReactNative/AppRegistry.js +10 -4
  100. package/Libraries/ReactNative/BridgelessUIManager.js +1 -21
  101. package/Libraries/ReactNative/FabricUIManager.js +0 -51
  102. package/Libraries/ReactNative/ReactFabricPublicInstance/warnForStyleProps.js +1 -0
  103. package/Libraries/ReactNative/RendererImplementation.js +20 -2
  104. package/Libraries/ReactNative/UIManager.d.ts +0 -21
  105. package/Libraries/ReactNative/UIManagerProperties.js +0 -3
  106. package/Libraries/ReactNative/__mocks__/FabricUIManager.js +5 -341
  107. package/Libraries/ReactNative/getNativeComponentAttributes.js +8 -8
  108. package/Libraries/ReactNative/renderApplication.js +3 -0
  109. package/Libraries/Renderer/implementations/ReactFabric-dev.js +15682 -27088
  110. package/Libraries/Renderer/implementations/ReactFabric-prod.js +5082 -4381
  111. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +3480 -2571
  112. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +15943 -27543
  113. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +5303 -4606
  114. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +3450 -2572
  115. package/Libraries/Renderer/shims/ReactFabric.js +2 -2
  116. package/Libraries/Renderer/shims/ReactFeatureFlags.js +2 -2
  117. package/Libraries/Renderer/shims/ReactNative.js +2 -3
  118. package/Libraries/Renderer/shims/ReactNativeTypes.js +24 -3
  119. package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +2 -2
  120. package/Libraries/Renderer/shims/createReactNativeComponentClass.js +2 -2
  121. package/Libraries/Share/Share.d.ts +16 -10
  122. package/Libraries/Share/Share.js +14 -15
  123. package/Libraries/StyleSheet/StyleSheet.d.ts +1 -1
  124. package/Libraries/StyleSheet/StyleSheet.js +3 -10
  125. package/Libraries/StyleSheet/StyleSheet.win32.js +3 -10
  126. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +21 -21
  127. package/Libraries/StyleSheet/StyleSheetTypes.js +24 -18
  128. package/Libraries/StyleSheet/flattenStyle.js +1 -0
  129. package/Libraries/StyleSheet/processFilter.js +132 -0
  130. package/Libraries/StyleSheet/processTransform.js +18 -3
  131. package/Libraries/Text/Text.js +151 -128
  132. package/Libraries/Text/Text.win32.js +163 -138
  133. package/Libraries/Text/TextNativeComponent.js +5 -4
  134. package/Libraries/Text/TextNativeComponent.win32.js +5 -4
  135. package/Libraries/Text/TextProps.js +6 -6
  136. package/Libraries/Text/TextProps.win32.js +6 -6
  137. package/Libraries/TurboModule/TurboModuleRegistry.js +2 -1
  138. package/Libraries/Types/CodegenTypes.js +3 -0
  139. package/Libraries/Utilities/{LoadingView.android.js → DevLoadingView.js} +33 -11
  140. package/Libraries/Utilities/Dimensions.js +1 -0
  141. package/Libraries/Utilities/Dimensions.win32.js +1 -0
  142. package/Libraries/Utilities/HMRClient.js +36 -8
  143. package/Libraries/Utilities/HMRClientProdShim.js +1 -0
  144. package/Libraries/Utilities/Platform.android.js +5 -5
  145. package/Libraries/Utilities/Platform.d.ts +1 -1
  146. package/Libraries/Utilities/Platform.flow.js +2 -2
  147. package/Libraries/Utilities/Platform.flow.win32.js +3 -3
  148. package/Libraries/Utilities/Platform.ios.js +1 -1
  149. package/Libraries/Utilities/Platform.win32.js +1 -1
  150. package/Libraries/Utilities/RCTLog.js +1 -0
  151. package/Libraries/Utilities/ReactNativeTestTools.js +12 -24
  152. package/Libraries/Utilities/verifyComponentAttributeEquivalence.js +11 -6
  153. package/Libraries/__tests__/ButtonWin32-test.js +7 -6
  154. package/Libraries/promiseRejectionTrackingOptions.js +1 -0
  155. package/jest/mockComponent.js +7 -0
  156. package/jest/renderer.js +25 -14
  157. package/jest/setup.js +19 -13
  158. package/jest.config.js +2 -1
  159. package/overrides.json +32 -31
  160. package/package.json +27 -25
  161. package/rn-get-polyfills.js +1 -0
  162. package/src/private/core/composeStyles.js +27 -0
  163. package/src/private/featureflags/ReactNativeFeatureFlags.js +93 -33
  164. package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +23 -4
  165. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +56 -0
  166. package/src/private/fusebox/setUpFuseboxReactDevToolsDispatcher.js +108 -0
  167. package/src/private/specs/modules/NativeBlobModule.js +4 -2
  168. package/src/private/specs/modules/NativeDevSettings.js +1 -0
  169. package/src/private/specs/modules/NativePlatformConstantsAndroid.js +1 -1
  170. package/src/private/specs/modules/NativePlatformConstantsIOS.js +1 -1
  171. package/src/private/specs/modules/NativePlatformConstantsWin.js +1 -1
  172. package/src/private/specs/modules/NativePushNotificationManagerIOS.js +0 -4
  173. package/src/private/specs/modules/NativeUIManager.js +0 -7
  174. package/src/private/webapis/dom/geometry/DOMRectReadOnly.js +24 -24
  175. package/src/private/webapis/dom/nodes/ReactNativeElement.js +11 -14
  176. package/src/private/webapis/dom/nodes/ReadOnlyCharacterData.js +2 -3
  177. package/src/private/webapis/dom/nodes/ReadOnlyElement.js +24 -54
  178. package/src/private/webapis/dom/nodes/ReadOnlyNode.js +5 -13
  179. package/src/private/webapis/dom/nodes/specs/NativeDOM.js +468 -0
  180. package/src/private/webapis/dom/nodes/specs/__mocks__/NativeDOMMock.js +413 -0
  181. package/src/private/webapis/dom/oldstylecollections/DOMRectList.js +4 -4
  182. package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +4 -4
  183. package/src/private/webapis/dom/oldstylecollections/NodeList.js +5 -5
  184. package/src/private/webapis/idlecallbacks/specs/NativeIdleCallbacks.js +34 -0
  185. package/src/private/webapis/microtasks/specs/NativeMicrotasks.js +21 -0
  186. package/src/private/webapis/performance/EventCounts.js +1 -1
  187. package/src/private/webapis/performance/MemoryInfo.js +9 -9
  188. package/src/private/webapis/performance/Performance.js +10 -56
  189. package/src/private/webapis/performance/PerformanceObserver.js +30 -22
  190. package/src/private/webapis/performance/RawPerformanceEntry.js +2 -7
  191. package/src/private/webapis/performance/ReactNativeStartupTiming.js +18 -18
  192. package/src/private/webapis/performance/UserTiming.js +63 -0
  193. package/src/private/webapis/performance/{NativePerformance.js → specs/NativePerformance.js} +3 -2
  194. package/src/private/webapis/performance/{NativePerformanceObserver.js → specs/NativePerformanceObserver.js} +2 -2
  195. package/src/private/webapis/performance/{__mocks__ → specs/__mocks__}/NativePerformance.js +1 -1
  196. package/src/private/webapis/performance/{__mocks__ → specs/__mocks__}/NativePerformanceObserver.js +3 -4
  197. package/src-win/Libraries/Components/View/ViewPropTypes.d.ts +7 -49
  198. package/types/modules/globals.d.ts +4 -0
  199. package/Libraries/Components/ScrollView/ScrollView.win32.js +0 -1915
  200. package/Libraries/NativeModules/specs/NativeAnimationsDebugModule.js +0 -13
  201. package/Libraries/Utilities/LoadingView.ios.js +0 -50
  202. package/Libraries/Utilities/LoadingView.js +0 -16
  203. package/jest/ReactNativeInternalFeatureFlagsMock.js +0 -13
  204. package/src/private/featureflags/NativeReactNativeFeatureFlags.js +0 -44
  205. package/src/private/featureflags/__tests__/ReactNativeFeatureFlags-test.js +0 -92
  206. package/src/private/specs/modules/NativeAnimationsDebugModule.js +0 -20
  207. package/src/private/webapis/dom/oldstylecollections/__tests__/DOMRectList-test.js +0 -85
  208. package/src/private/webapis/dom/oldstylecollections/__tests__/HTMLCollection-test.js +0 -80
  209. package/src/private/webapis/dom/oldstylecollections/__tests__/NodeList-test.js +0 -161
  210. package/src/private/webapis/performance/__tests__/EventCounts-test.js +0 -116
  211. package/src/private/webapis/performance/__tests__/NativePerformanceMock-test.js +0 -82
  212. package/src/private/webapis/performance/__tests__/NativePerformanceObserverMock-test.js +0 -108
  213. package/src/private/webapis/performance/__tests__/Performance-test.js +0 -117
  214. package/src/private/webapis/performance/__tests__/PerformanceObserver-test.js +0 -208
@@ -0,0 +1,56 @@
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
+ * @generated SignedSource<<6922b452333fc62a263bd77d42afbbbe>>
8
+ * @flow strict-local
9
+ */
10
+
11
+ /**
12
+ * IMPORTANT: Do NOT modify this file directly.
13
+ *
14
+ * To change the definition of the flags, edit
15
+ * packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js.
16
+ *
17
+ * To regenerate this code, run the following script from the repo root:
18
+ * yarn featureflags-update
19
+ */
20
+
21
+ import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport';
22
+
23
+ import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry';
24
+
25
+ export interface Spec extends TurboModule {
26
+ +commonTestFlag?: () => boolean;
27
+ +allowCollapsableChildren?: () => boolean;
28
+ +allowRecursiveCommitsWithSynchronousMountOnAndroid?: () => boolean;
29
+ +batchRenderingUpdatesInEventLoop?: () => boolean;
30
+ +destroyFabricSurfacesInReactInstanceManager?: () => boolean;
31
+ +enableBackgroundExecutor?: () => boolean;
32
+ +enableCleanTextInputYogaNode?: () => boolean;
33
+ +enableGranularShadowTreeStateReconciliation?: () => boolean;
34
+ +enableMicrotasks?: () => boolean;
35
+ +enableSynchronousStateUpdates?: () => boolean;
36
+ +enableUIConsistency?: () => boolean;
37
+ +fixStoppedSurfaceRemoveDeleteTreeUIFrameCallbackLeak?: () => boolean;
38
+ +forceBatchingMountItemsOnAndroid?: () => boolean;
39
+ +fuseboxEnabledDebug?: () => boolean;
40
+ +fuseboxEnabledRelease?: () => boolean;
41
+ +lazyAnimationCallbacks?: () => boolean;
42
+ +preventDoubleTextMeasure?: () => boolean;
43
+ +setAndroidLayoutDirection?: () => boolean;
44
+ +useImmediateExecutorInAndroidBridgeless?: () => boolean;
45
+ +useModernRuntimeScheduler?: () => boolean;
46
+ +useNativeViewConfigsInBridgelessMode?: () => boolean;
47
+ +useRuntimeShadowNodeReferenceUpdate?: () => boolean;
48
+ +useRuntimeShadowNodeReferenceUpdateOnLayout?: () => boolean;
49
+ +useStateAlignmentMechanism?: () => boolean;
50
+ }
51
+
52
+ const NativeReactNativeFeatureFlags: ?Spec = TurboModuleRegistry.get<Spec>(
53
+ 'NativeReactNativeFeatureFlagsCxx',
54
+ );
55
+
56
+ export default NativeReactNativeFeatureFlags;
@@ -0,0 +1,108 @@
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-local
8
+ * @format
9
+ * @oncall react_native
10
+ */
11
+
12
+ type JSONValue =
13
+ | string
14
+ | number
15
+ | boolean
16
+ | null
17
+ | {[key: string]: JSONValue}
18
+ | Array<JSONValue>;
19
+ type DomainName = 'react-devtools';
20
+
21
+ class EventScope<T> {
22
+ #listeners: Set<(T) => void> = new Set();
23
+
24
+ addEventListener(listener: T => void): void {
25
+ this.#listeners.add(listener);
26
+ }
27
+
28
+ removeEventListener(listener: T => void): void {
29
+ this.#listeners.delete(listener);
30
+ }
31
+
32
+ emit(value: T): void {
33
+ // Assuming that listeners won't throw.
34
+ for (const listener of this.#listeners) {
35
+ listener(value);
36
+ }
37
+ }
38
+ }
39
+
40
+ export class Domain {
41
+ name: DomainName;
42
+ onMessage: EventScope<JSONValue>;
43
+
44
+ constructor(name: DomainName) {
45
+ if (global[FuseboxReactDevToolsDispatcher.BINDING_NAME] == null) {
46
+ throw new Error(
47
+ `Could not create domain ${name}: receiving end doesn't exist`,
48
+ );
49
+ }
50
+
51
+ this.name = name;
52
+ this.onMessage = new EventScope<JSONValue>();
53
+ }
54
+
55
+ sendMessage(message: JSONValue) {
56
+ const messageWithDomain = {domain: this.name, message};
57
+ const serializedMessageWithDomain = JSON.stringify(messageWithDomain);
58
+
59
+ global[FuseboxReactDevToolsDispatcher.BINDING_NAME](
60
+ serializedMessageWithDomain,
61
+ );
62
+ }
63
+ }
64
+
65
+ class FuseboxReactDevToolsDispatcher {
66
+ static #domainNameToDomainMap: Map<DomainName, Domain> = new Map();
67
+
68
+ // Referenced and initialized from Chrome DevTools frontend.
69
+ static BINDING_NAME: string = '__CHROME_DEVTOOLS_FRONTEND_BINDING__';
70
+ static onDomainInitialization: EventScope<Domain> = new EventScope<Domain>();
71
+
72
+ // Should be private, referenced from Chrome DevTools frontend only.
73
+ static initializeDomain(domainName: DomainName): Domain {
74
+ const domain = new Domain(domainName);
75
+
76
+ this.#domainNameToDomainMap.set(domainName, domain);
77
+ this.onDomainInitialization.emit(domain);
78
+
79
+ return domain;
80
+ }
81
+
82
+ // Should be private, referenced from Chrome DevTools frontend only.
83
+ static sendMessage(domainName: DomainName, message: string): void {
84
+ const domain = this.#domainNameToDomainMap.get(domainName);
85
+ if (domain == null) {
86
+ throw new Error(
87
+ `Could not send message to ${domainName}: domain doesn't exist`,
88
+ );
89
+ }
90
+
91
+ try {
92
+ const parsedMessage = JSON.parse(message);
93
+ domain.onMessage.emit(parsedMessage);
94
+ } catch (err) {
95
+ console.error(
96
+ `Error while trying to send a message to domain ${domainName}:`,
97
+ err,
98
+ );
99
+ }
100
+ }
101
+ }
102
+
103
+ Object.defineProperty(global, '__FUSEBOX_REACT_DEVTOOLS_DISPATCHER__', {
104
+ value: FuseboxReactDevToolsDispatcher,
105
+ configurable: false,
106
+ enumerable: false,
107
+ writable: false,
108
+ });
@@ -12,8 +12,10 @@ import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport';
12
12
 
13
13
  import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry';
14
14
 
15
+ export type Constants = {|BLOB_URI_SCHEME: ?string, BLOB_URI_HOST: ?string|};
16
+
15
17
  export interface Spec extends TurboModule {
16
- +getConstants: () => {|BLOB_URI_SCHEME: ?string, BLOB_URI_HOST: ?string|};
18
+ +getConstants: () => Constants;
17
19
  +addNetworkingHandler: () => void;
18
20
  +addWebSocketHandler: (id: number) => void;
19
21
  +removeWebSocketHandler: (id: number) => void;
@@ -29,7 +31,7 @@ let NativeBlobModule = null;
29
31
 
30
32
  if (NativeModule != null) {
31
33
  NativeBlobModule = {
32
- getConstants(): {|BLOB_URI_SCHEME: ?string, BLOB_URI_HOST: ?string|} {
34
+ getConstants(): Constants {
33
35
  if (constants == null) {
34
36
  constants = NativeModule.getConstants();
35
37
  }
@@ -21,6 +21,7 @@ export interface Spec extends TurboModule {
21
21
  +setProfilingEnabled: (isProfilingEnabled: boolean) => void;
22
22
  +toggleElementInspector: () => void;
23
23
  +addMenuItem: (title: string) => void;
24
+ +openDebugger?: () => void;
24
25
 
25
26
  // Events
26
27
  +addListener: (eventName: string) => void;
@@ -16,7 +16,7 @@ export type ReactNativeVersionAndroid = {|
16
16
  major: number,
17
17
  minor: number,
18
18
  patch: number,
19
- prerelease: ?number,
19
+ prerelease: ?string,
20
20
  |};
21
21
 
22
22
  export type PlatformConstantsAndroid = {|
@@ -19,7 +19,7 @@ export type PlatformConstantsIOS = {|
19
19
  major: number,
20
20
  minor: number,
21
21
  patch: number,
22
- prerelease: ?number,
22
+ prerelease: ?string,
23
23
  |},
24
24
  forceTouchAvailable: boolean,
25
25
  osVersion: string,
@@ -19,7 +19,7 @@ export type PlatformConstantsWin32 = {|
19
19
  major: number,
20
20
  minor: number,
21
21
  patch: number,
22
- prerelease: ?string | number,
22
+ prerelease: ?string,
23
23
  |},
24
24
  forceTouchAvailable: boolean,
25
25
  osVersion: number,
@@ -55,10 +55,6 @@ type Notification = {|
55
55
  * getScheduledLocalNotifications or getDeliveredNotifications.
56
56
  */
57
57
  +soundName?: ?string,
58
- /** DEPRECATED. This was used for iOS's legacy UILocalNotification. */
59
- +alertAction?: ?string,
60
- /** DEPRECATED. Use `fireDate` or `fireIntervalSeconds` instead. */
61
- +repeatInterval?: ?string,
62
58
  |};
63
59
 
64
60
  export interface Spec extends TurboModule {
@@ -101,13 +101,6 @@ export interface Spec extends TurboModule {
101
101
  +getDefaultEventTypes?: () => Array<string>;
102
102
  +setLayoutAnimationEnabledExperimental?: (enabled: boolean) => void;
103
103
  +sendAccessibilityEvent?: (reactTag: number, eventType: number) => void;
104
- +showPopupMenu?: (
105
- reactTag: number,
106
- items: Array<string>,
107
- error: (error: Object) => void,
108
- success: (event: string, selected?: number) => void,
109
- ) => void;
110
- +dismissPopupMenu?: () => void;
111
104
 
112
105
  // ios only
113
106
  +lazilyLoadView?: (name: string) => Object; // revisit return
@@ -33,10 +33,10 @@ function castToNumber(value: mixed): number {
33
33
  * This is a (mostly) spec-compliant version of `DOMRectReadOnly` (https://developer.mozilla.org/en-US/docs/Web/API/DOMRectReadOnly).
34
34
  */
35
35
  export default class DOMRectReadOnly {
36
- _x: number;
37
- _y: number;
38
- _width: number;
39
- _height: number;
36
+ #x: number;
37
+ #y: number;
38
+ #width: number;
39
+ #height: number;
40
40
 
41
41
  constructor(x: ?number, y: ?number, width: ?number, height: ?number) {
42
42
  this.__setInternalX(x);
@@ -49,36 +49,36 @@ export default class DOMRectReadOnly {
49
49
  * The x coordinate of the `DOMRectReadOnly`'s origin.
50
50
  */
51
51
  get x(): number {
52
- return this._x;
52
+ return this.#x;
53
53
  }
54
54
 
55
55
  /**
56
56
  * The y coordinate of the `DOMRectReadOnly`'s origin.
57
57
  */
58
58
  get y(): number {
59
- return this._y;
59
+ return this.#y;
60
60
  }
61
61
 
62
62
  /**
63
63
  * The width of the `DOMRectReadOnly`.
64
64
  */
65
65
  get width(): number {
66
- return this._width;
66
+ return this.#width;
67
67
  }
68
68
 
69
69
  /**
70
70
  * The height of the `DOMRectReadOnly`.
71
71
  */
72
72
  get height(): number {
73
- return this._height;
73
+ return this.#height;
74
74
  }
75
75
 
76
76
  /**
77
77
  * Returns the top coordinate value of the `DOMRect` (has the same value as `y`, or `y + height` if `height` is negative).
78
78
  */
79
79
  get top(): number {
80
- const height = this._height;
81
- const y = this._y;
80
+ const height = this.#height;
81
+ const y = this.#y;
82
82
 
83
83
  if (height < 0) {
84
84
  return y + height;
@@ -91,8 +91,8 @@ export default class DOMRectReadOnly {
91
91
  * Returns the right coordinate value of the `DOMRect` (has the same value as ``x + width`, or `x` if `width` is negative).
92
92
  */
93
93
  get right(): number {
94
- const width = this._width;
95
- const x = this._x;
94
+ const width = this.#width;
95
+ const x = this.#x;
96
96
 
97
97
  if (width < 0) {
98
98
  return x;
@@ -105,8 +105,8 @@ export default class DOMRectReadOnly {
105
105
  * Returns the bottom coordinate value of the `DOMRect` (has the same value as `y + height`, or `y` if `height` is negative).
106
106
  */
107
107
  get bottom(): number {
108
- const height = this._height;
109
- const y = this._y;
108
+ const height = this.#height;
109
+ const y = this.#y;
110
110
 
111
111
  if (height < 0) {
112
112
  return y;
@@ -119,8 +119,8 @@ export default class DOMRectReadOnly {
119
119
  * Returns the left coordinate value of the `DOMRect` (has the same value as `x`, or `x + width` if `width` is negative).
120
120
  */
121
121
  get left(): number {
122
- const width = this._width;
123
- const x = this._x;
122
+ const width = this.#width;
123
+ const x = this.#x;
124
124
 
125
125
  if (width < 0) {
126
126
  return x + width;
@@ -155,34 +155,34 @@ export default class DOMRectReadOnly {
155
155
  }
156
156
 
157
157
  __getInternalX(): number {
158
- return this._x;
158
+ return this.#x;
159
159
  }
160
160
 
161
161
  __getInternalY(): number {
162
- return this._y;
162
+ return this.#y;
163
163
  }
164
164
 
165
165
  __getInternalWidth(): number {
166
- return this._width;
166
+ return this.#width;
167
167
  }
168
168
 
169
169
  __getInternalHeight(): number {
170
- return this._height;
170
+ return this.#height;
171
171
  }
172
172
 
173
173
  __setInternalX(x: ?number) {
174
- this._x = castToNumber(x);
174
+ this.#x = castToNumber(x);
175
175
  }
176
176
 
177
177
  __setInternalY(y: ?number) {
178
- this._y = castToNumber(y);
178
+ this.#y = castToNumber(y);
179
179
  }
180
180
 
181
181
  __setInternalWidth(width: ?number) {
182
- this._width = castToNumber(width);
182
+ this.#width = castToNumber(width);
183
183
  }
184
184
 
185
185
  __setInternalHeight(height: ?number) {
186
- this._height = castToNumber(height);
186
+ this.#height = castToNumber(height);
187
187
  }
188
188
  }
@@ -31,6 +31,7 @@ import {
31
31
  getPublicInstanceFromInternalInstanceHandle,
32
32
  getShadowNode,
33
33
  } from './ReadOnlyNode';
34
+ import NativeDOM from './specs/NativeDOM';
34
35
  import nullthrows from 'nullthrows';
35
36
 
36
37
  const noop = () => {};
@@ -43,7 +44,7 @@ export default class ReactNativeElement
43
44
  __nativeTag: number;
44
45
  __internalInstanceHandle: InternalInstanceHandle;
45
46
 
46
- _viewConfig: ViewConfig;
47
+ #viewConfig: ViewConfig;
47
48
 
48
49
  constructor(
49
50
  tag: number,
@@ -54,7 +55,7 @@ export default class ReactNativeElement
54
55
 
55
56
  this.__nativeTag = tag;
56
57
  this.__internalInstanceHandle = internalInstanceHandle;
57
- this._viewConfig = viewConfig;
58
+ this.#viewConfig = viewConfig;
58
59
  }
59
60
 
60
61
  get offsetHeight(): number {
@@ -67,10 +68,8 @@ export default class ReactNativeElement
67
68
  const node = getShadowNode(this);
68
69
 
69
70
  if (node != null) {
70
- const offset = nullthrows(getFabricUIManager()).getOffset(node);
71
- if (offset != null) {
72
- return Math.round(offset[2]);
73
- }
71
+ const offset = NativeDOM.getOffset(node);
72
+ return Math.round(offset[2]);
74
73
  }
75
74
 
76
75
  return 0;
@@ -80,11 +79,11 @@ export default class ReactNativeElement
80
79
  const node = getShadowNode(this);
81
80
 
82
81
  if (node != null) {
83
- const offset = nullthrows(getFabricUIManager()).getOffset(node);
82
+ const offset = NativeDOM.getOffset(node);
84
83
  // For children of the root node we currently return offset data
85
84
  // but a `null` parent because the root node is not accessible
86
85
  // in JavaScript yet.
87
- if (offset != null && offset[0] != null) {
86
+ if (offset[0] != null) {
88
87
  const offsetParentInstanceHandle = offset[0];
89
88
  const offsetParent = getPublicInstanceFromInternalInstanceHandle(
90
89
  offsetParentInstanceHandle,
@@ -102,10 +101,8 @@ export default class ReactNativeElement
102
101
  const node = getShadowNode(this);
103
102
 
104
103
  if (node != null) {
105
- const offset = nullthrows(getFabricUIManager()).getOffset(node);
106
- if (offset != null) {
107
- return Math.round(offset[1]);
108
- }
104
+ const offset = NativeDOM.getOffset(node);
105
+ return Math.round(offset[1]);
109
106
  }
110
107
 
111
108
  return 0;
@@ -175,12 +172,12 @@ export default class ReactNativeElement
175
172
 
176
173
  setNativeProps(nativeProps: {...}): void {
177
174
  if (__DEV__) {
178
- warnForStyleProps(nativeProps, this._viewConfig.validAttributes);
175
+ warnForStyleProps(nativeProps, this.#viewConfig.validAttributes);
179
176
  }
180
177
 
181
178
  const updatePayload = createAttributePayload(
182
179
  nativeProps,
183
- this._viewConfig.validAttributes,
180
+ this.#viewConfig.validAttributes,
184
181
  );
185
182
 
186
183
  const node = getShadowNode(this);
@@ -12,10 +12,9 @@
12
12
 
13
13
  import type ReadOnlyElement from './ReadOnlyElement';
14
14
 
15
- import {getFabricUIManager} from '../../../../../Libraries/ReactNative/FabricUIManager';
16
15
  import ReadOnlyNode, {getShadowNode} from './ReadOnlyNode';
16
+ import NativeDOM from './specs/NativeDOM';
17
17
  import {getElementSibling} from './utilities/Traversal';
18
- import nullthrows from 'nullthrows';
19
18
 
20
19
  export default class ReadOnlyCharacterData extends ReadOnlyNode {
21
20
  get nextElementSibling(): ReadOnlyElement | null {
@@ -30,7 +29,7 @@ export default class ReadOnlyCharacterData extends ReadOnlyNode {
30
29
  const shadowNode = getShadowNode(this);
31
30
 
32
31
  if (shadowNode != null) {
33
- return nullthrows(getFabricUIManager()).getTextContent(shadowNode);
32
+ return NativeDOM.getTextContent(shadowNode);
34
33
  }
35
34
 
36
35
  return '';
@@ -12,7 +12,6 @@
12
12
 
13
13
  import type HTMLCollection from '../oldstylecollections/HTMLCollection';
14
14
 
15
- import {getFabricUIManager} from '../../../../../Libraries/ReactNative/FabricUIManager';
16
15
  import DOMRect from '../geometry/DOMRect';
17
16
  import {createHTMLCollection} from '../oldstylecollections/HTMLCollection';
18
17
  import ReadOnlyNode, {
@@ -20,8 +19,8 @@ import ReadOnlyNode, {
20
19
  getInstanceHandle,
21
20
  getShadowNode,
22
21
  } from './ReadOnlyNode';
22
+ import NativeDOM from './specs/NativeDOM';
23
23
  import {getElementSibling} from './utilities/Traversal';
24
- import nullthrows from 'nullthrows';
25
24
 
26
25
  export default class ReadOnlyElement extends ReadOnlyNode {
27
26
  get childElementCount(): number {
@@ -36,10 +35,8 @@ export default class ReadOnlyElement extends ReadOnlyNode {
36
35
  const node = getShadowNode(this);
37
36
 
38
37
  if (node != null) {
39
- const innerSize = nullthrows(getFabricUIManager()).getInnerSize(node);
40
- if (innerSize != null) {
41
- return innerSize[1];
42
- }
38
+ const innerSize = NativeDOM.getInnerSize(node);
39
+ return innerSize[1];
43
40
  }
44
41
 
45
42
  return 0;
@@ -49,10 +46,8 @@ export default class ReadOnlyElement extends ReadOnlyNode {
49
46
  const node = getShadowNode(this);
50
47
 
51
48
  if (node != null) {
52
- const borderSize = nullthrows(getFabricUIManager()).getBorderSize(node);
53
- if (borderSize != null) {
54
- return borderSize[3];
55
- }
49
+ const borderSize = NativeDOM.getBorderWidth(node);
50
+ return borderSize[3];
56
51
  }
57
52
 
58
53
  return 0;
@@ -62,10 +57,8 @@ export default class ReadOnlyElement extends ReadOnlyNode {
62
57
  const node = getShadowNode(this);
63
58
 
64
59
  if (node != null) {
65
- const borderSize = nullthrows(getFabricUIManager()).getBorderSize(node);
66
- if (borderSize != null) {
67
- return borderSize[0];
68
- }
60
+ const borderSize = NativeDOM.getBorderWidth(node);
61
+ return borderSize[0];
69
62
  }
70
63
 
71
64
  return 0;
@@ -75,10 +68,8 @@ export default class ReadOnlyElement extends ReadOnlyNode {
75
68
  const node = getShadowNode(this);
76
69
 
77
70
  if (node != null) {
78
- const innerSize = nullthrows(getFabricUIManager()).getInnerSize(node);
79
- if (innerSize != null) {
80
- return innerSize[0];
81
- }
71
+ const innerSize = NativeDOM.getInnerSize(node);
72
+ return innerSize[0];
82
73
  }
83
74
 
84
75
  return 0;
@@ -138,10 +129,8 @@ export default class ReadOnlyElement extends ReadOnlyNode {
138
129
  const node = getShadowNode(this);
139
130
 
140
131
  if (node != null) {
141
- const scrollSize = nullthrows(getFabricUIManager()).getScrollSize(node);
142
- if (scrollSize != null) {
143
- return scrollSize[1];
144
- }
132
+ const scrollSize = NativeDOM.getScrollSize(node);
133
+ return scrollSize[1];
145
134
  }
146
135
 
147
136
  return 0;
@@ -151,12 +140,8 @@ export default class ReadOnlyElement extends ReadOnlyNode {
151
140
  const node = getShadowNode(this);
152
141
 
153
142
  if (node != null) {
154
- const scrollPosition = nullthrows(getFabricUIManager()).getScrollPosition(
155
- node,
156
- );
157
- if (scrollPosition != null) {
158
- return scrollPosition[0];
159
- }
143
+ const scrollPosition = NativeDOM.getScrollPosition(node);
144
+ return scrollPosition[0];
160
145
  }
161
146
 
162
147
  return 0;
@@ -166,12 +151,8 @@ export default class ReadOnlyElement extends ReadOnlyNode {
166
151
  const node = getShadowNode(this);
167
152
 
168
153
  if (node != null) {
169
- const scrollPosition = nullthrows(getFabricUIManager()).getScrollPosition(
170
- node,
171
- );
172
- if (scrollPosition != null) {
173
- return scrollPosition[1];
174
- }
154
+ const scrollPosition = NativeDOM.getScrollPosition(node);
155
+ return scrollPosition[1];
175
156
  }
176
157
 
177
158
  return 0;
@@ -181,10 +162,8 @@ export default class ReadOnlyElement extends ReadOnlyNode {
181
162
  const node = getShadowNode(this);
182
163
 
183
164
  if (node != null) {
184
- const scrollSize = nullthrows(getFabricUIManager()).getScrollSize(node);
185
- if (scrollSize != null) {
186
- return scrollSize[0];
187
- }
165
+ const scrollSize = NativeDOM.getScrollSize(node);
166
+ return scrollSize[0];
188
167
  }
189
168
 
190
169
  return 0;
@@ -194,7 +173,7 @@ export default class ReadOnlyElement extends ReadOnlyNode {
194
173
  const node = getShadowNode(this);
195
174
 
196
175
  if (node != null) {
197
- return nullthrows(getFabricUIManager()).getTagName(node);
176
+ return NativeDOM.getTagName(node);
198
177
  }
199
178
 
200
179
  return '';
@@ -204,7 +183,7 @@ export default class ReadOnlyElement extends ReadOnlyNode {
204
183
  const shadowNode = getShadowNode(this);
205
184
 
206
185
  if (shadowNode != null) {
207
- return nullthrows(getFabricUIManager()).getTextContent(shadowNode);
186
+ return NativeDOM.getTextContent(shadowNode);
208
187
  }
209
188
 
210
189
  return '';
@@ -220,10 +199,7 @@ export default class ReadOnlyElement extends ReadOnlyNode {
220
199
  hasPointerCapture(pointerId: number): boolean {
221
200
  const node = getShadowNode(this);
222
201
  if (node != null) {
223
- return nullthrows(getFabricUIManager()).hasPointerCapture(
224
- node,
225
- pointerId,
226
- );
202
+ return NativeDOM.hasPointerCapture(node, pointerId);
227
203
  }
228
204
  return false;
229
205
  }
@@ -231,14 +207,14 @@ export default class ReadOnlyElement extends ReadOnlyNode {
231
207
  setPointerCapture(pointerId: number): void {
232
208
  const node = getShadowNode(this);
233
209
  if (node != null) {
234
- nullthrows(getFabricUIManager()).setPointerCapture(node, pointerId);
210
+ NativeDOM.setPointerCapture(node, pointerId);
235
211
  }
236
212
  }
237
213
 
238
214
  releasePointerCapture(pointerId: number): void {
239
215
  const node = getShadowNode(this);
240
216
  if (node != null) {
241
- nullthrows(getFabricUIManager()).releasePointerCapture(node, pointerId);
217
+ NativeDOM.releasePointerCapture(node, pointerId);
242
218
  }
243
219
  }
244
220
  }
@@ -262,14 +238,8 @@ export function getBoundingClientRect(
262
238
  const shadowNode = getShadowNode(node);
263
239
 
264
240
  if (shadowNode != null) {
265
- const rect = nullthrows(getFabricUIManager()).getBoundingClientRect(
266
- shadowNode,
267
- includeTransform,
268
- );
269
-
270
- if (rect) {
271
- return new DOMRect(rect[0], rect[1], rect[2], rect[3]);
272
- }
241
+ const rect = NativeDOM.getBoundingClientRect(shadowNode, includeTransform);
242
+ return new DOMRect(rect[0], rect[1], rect[2], rect[3]);
273
243
  }
274
244
 
275
245
  // Empty rect if any of the above failed