@office-iss/react-native-win32 0.0.0-canary.245 → 0.0.0-canary.247

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 (40) hide show
  1. package/.flowconfig +1 -2
  2. package/CHANGELOG.json +100 -1
  3. package/CHANGELOG.md +33 -8
  4. package/Libraries/Animated/createAnimatedComponent.js +20 -3
  5. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +13 -1
  6. package/Libraries/Components/TextInput/TextInput.win32.js +2 -2
  7. package/Libraries/Components/Touchable/TouchableHighlight.d.ts +4 -10
  8. package/Libraries/Components/Touchable/TouchableOpacity.d.ts +4 -15
  9. package/Libraries/Core/Devtools/loadBundleFromServer.js +3 -3
  10. package/Libraries/Core/ErrorHandlers.js +116 -0
  11. package/Libraries/Core/ReactNativeVersion.js +1 -1
  12. package/Libraries/Core/setUpReactDevTools.js +70 -10
  13. package/Libraries/Debugging/DebuggingOverlayRegistry.js +1 -1
  14. package/Libraries/Inspector/ElementBox.js +2 -3
  15. package/Libraries/NativeComponent/NativeComponentRegistry.js +12 -5
  16. package/Libraries/ReactNative/BridgelessUIManager.js +1 -21
  17. package/Libraries/ReactNative/RendererImplementation.js +20 -2
  18. package/Libraries/ReactNative/UIManager.d.ts +0 -21
  19. package/Libraries/ReactNative/UIManagerProperties.js +0 -3
  20. package/Libraries/ReactNative/getNativeComponentAttributes.js +3 -6
  21. package/Libraries/Renderer/shims/ReactFabric.js +3 -0
  22. package/Libraries/Renderer/shims/ReactFeatureFlags.js +3 -0
  23. package/Libraries/Renderer/shims/ReactNative.js +3 -0
  24. package/Libraries/Renderer/shims/ReactNativeTypes.js +25 -1
  25. package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +3 -0
  26. package/Libraries/Renderer/shims/createReactNativeComponentClass.js +3 -0
  27. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +3 -3
  28. package/Libraries/StyleSheet/StyleSheetTypes.js +3 -3
  29. package/Libraries/Utilities/{LoadingView.android.js → DevLoadingView.js} +33 -11
  30. package/Libraries/Utilities/HMRClient.js +8 -8
  31. package/overrides.json +2 -8
  32. package/package.json +17 -16
  33. package/src/private/featureflags/ReactNativeFeatureFlags.js +16 -6
  34. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +4 -2
  35. package/src/private/fusebox/setUpFuseboxReactDevToolsDispatcher.js +108 -0
  36. package/src/private/specs/modules/NativeUIManager.js +0 -7
  37. package/src/private/webapis/performance/PerformanceObserver.js +11 -5
  38. package/Libraries/Components/ScrollView/ScrollView.win32.js +0 -1983
  39. package/Libraries/Utilities/LoadingView.ios.js +0 -50
  40. package/Libraries/Utilities/LoadingView.js +0 -16
@@ -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
+ });
@@ -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
@@ -100,11 +100,17 @@ const onPerformanceEntry = () => {
100
100
  const durationThreshold = observerConfig.entryTypes.get(entry.entryType);
101
101
  return entry.duration >= (durationThreshold ?? 0);
102
102
  });
103
- observerConfig.callback(
104
- new PerformanceObserverEntryList(entriesForObserver),
105
- observer,
106
- droppedEntriesCount,
107
- );
103
+ if (entriesForObserver.length !== 0) {
104
+ try {
105
+ observerConfig.callback(
106
+ new PerformanceObserverEntryList(entriesForObserver),
107
+ observer,
108
+ droppedEntriesCount,
109
+ );
110
+ } catch (error) {
111
+ console.error(error);
112
+ }
113
+ }
108
114
  }
109
115
  };
110
116