@office-iss/react-native-win32 0.75.1 → 0.76.0-preview.1

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 (174) hide show
  1. package/.eslintrc.js +11 -0
  2. package/.flowconfig +5 -4
  3. package/CHANGELOG.json +172 -40
  4. package/CHANGELOG.md +57 -24
  5. package/Libraries/Alert/Alert.js +3 -0
  6. package/Libraries/Animated/AnimatedEvent.js +1 -1
  7. package/Libraries/Animated/AnimatedImplementation.js +7 -7
  8. package/Libraries/Animated/NativeAnimatedAllowlist.js +111 -0
  9. package/Libraries/Animated/animations/Animation.js +11 -1
  10. package/Libraries/Animated/animations/DecayAnimation.js +1 -1
  11. package/Libraries/Animated/animations/SpringAnimation.js +1 -1
  12. package/Libraries/Animated/animations/TimingAnimation.js +2 -1
  13. package/Libraries/Animated/components/AnimatedScrollView.js +3 -2
  14. package/Libraries/Animated/createAnimatedComponent.js +10 -9
  15. package/Libraries/Animated/nodes/AnimatedColor.js +1 -1
  16. package/Libraries/Animated/nodes/AnimatedInterpolation.js +3 -2
  17. package/Libraries/Animated/nodes/AnimatedNode.js +42 -33
  18. package/Libraries/Animated/nodes/AnimatedObject.js +56 -50
  19. package/Libraries/Animated/nodes/AnimatedProps.js +77 -40
  20. package/Libraries/Animated/nodes/AnimatedStyle.js +103 -59
  21. package/Libraries/Animated/nodes/AnimatedTracking.js +1 -1
  22. package/Libraries/Animated/nodes/AnimatedTransform.js +102 -67
  23. package/Libraries/Animated/nodes/AnimatedValue.js +2 -1
  24. package/Libraries/Animated/nodes/AnimatedWithChildren.js +21 -22
  25. package/Libraries/Animated/useAnimatedProps.js +142 -7
  26. package/Libraries/BatchedBridge/NativeModules.js +2 -0
  27. package/Libraries/Blob/FileReader.js +1 -1
  28. package/Libraries/Blob/URL.js +2 -62
  29. package/Libraries/Blob/URLSearchParams.js +71 -0
  30. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +1 -1
  31. package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +1 -1
  32. package/Libraries/Components/ScrollView/ScrollView.js +131 -169
  33. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +1 -1
  34. package/Libraries/Components/StatusBar/StatusBar.js +3 -1
  35. package/Libraries/Components/TextInput/TextInput.d.ts +32 -2
  36. package/Libraries/Components/TextInput/TextInput.js +230 -94
  37. package/Libraries/Components/TextInput/TextInput.win32.js +230 -100
  38. package/Libraries/Components/View/ReactNativeStyleAttributes.js +22 -0
  39. package/Libraries/Components/View/ReactNativeViewAttributes.js +2 -0
  40. package/Libraries/Components/View/ReactNativeViewAttributes.win32.js +2 -0
  41. package/Libraries/Components/View/ViewAccessibility.d.ts +15 -0
  42. package/Libraries/Components/View/ViewNativeComponent.js +0 -1
  43. package/Libraries/Components/View/ViewPropTypes.js +14 -0
  44. package/Libraries/Components/View/ViewPropTypes.win32.js +14 -0
  45. package/Libraries/Core/ExceptionsManager.js +2 -0
  46. package/Libraries/Core/InitializeCore.js +3 -1
  47. package/Libraries/Core/ReactFiberErrorDialog.js +3 -0
  48. package/Libraries/Core/ReactNativeVersion.js +4 -4
  49. package/Libraries/Core/ReactNativeVersionCheck.win32.js +1 -1
  50. package/Libraries/Core/setUpErrorHandling.js +7 -1
  51. package/Libraries/Core/setUpGlobals.js +1 -0
  52. package/Libraries/Core/setUpReactRefresh.js +0 -4
  53. package/Libraries/Image/AssetSourceResolver.js +28 -1
  54. package/Libraries/Image/Image.android.js +9 -14
  55. package/Libraries/Image/Image.ios.js +11 -22
  56. package/Libraries/Image/Image.win32.js +11 -24
  57. package/Libraries/Image/ImageBackground.js +1 -8
  58. package/Libraries/Image/ImageUtils.js +9 -9
  59. package/Libraries/Image/ImageViewNativeComponent.js +1 -0
  60. package/Libraries/Inspector/Inspector.js +3 -2
  61. package/Libraries/Inspector/Inspector.win32.js +3 -2
  62. package/Libraries/Inspector/InspectorPanel.js +16 -10
  63. package/Libraries/Inspector/NetworkOverlay.js +1 -1
  64. package/Libraries/Interaction/TaskQueue.js +1 -0
  65. package/Libraries/Lists/FlatList.js +1 -1
  66. package/Libraries/Lists/SectionList.js +2 -2
  67. package/Libraries/Lists/SectionListModern.js +3 -3
  68. package/Libraries/LogBox/Data/LogBoxData.js +24 -3
  69. package/Libraries/LogBox/LogBoxNotificationContainer.js +3 -2
  70. package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +9 -8
  71. package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +9 -29
  72. package/Libraries/Modal/Modal.js +0 -1
  73. package/Libraries/NativeComponent/BaseViewConfig.android.js +8 -0
  74. package/Libraries/NativeComponent/BaseViewConfig.ios.js +7 -0
  75. package/Libraries/NativeComponent/BaseViewConfig.win32.js +7 -0
  76. package/Libraries/NativeComponent/NativeComponentRegistry.js +22 -22
  77. package/Libraries/NativeComponent/StaticViewConfigValidator.js +0 -21
  78. package/Libraries/Network/XMLHttpRequest.js +4 -2
  79. package/Libraries/ReactNative/AppContainer-dev.js +1 -5
  80. package/Libraries/ReactNative/AppContainer-prod.js +1 -5
  81. package/Libraries/ReactNative/AppContainer.js +0 -1
  82. package/Libraries/ReactNative/AppRegistry.js +0 -6
  83. package/Libraries/ReactNative/BridgelessUIManager.js +1 -0
  84. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +1 -1
  85. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +5 -5
  86. package/Libraries/ReactNative/RendererImplementation.js +26 -4
  87. package/Libraries/ReactNative/getNativeComponentAttributes.js +8 -0
  88. package/Libraries/ReactNative/renderApplication.js +0 -2
  89. package/Libraries/Renderer/shims/ReactNativeTypes.js +11 -4
  90. package/Libraries/StyleSheet/StyleSheet.js +1 -1
  91. package/Libraries/StyleSheet/StyleSheet.win32.js +1 -1
  92. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +74 -15
  93. package/Libraries/StyleSheet/StyleSheetTypes.js +60 -5
  94. package/Libraries/StyleSheet/processBackgroundImage.js +384 -0
  95. package/Libraries/StyleSheet/processBoxShadow.js +211 -0
  96. package/Libraries/StyleSheet/processFilter.js +231 -42
  97. package/Libraries/Text/Text.js +394 -196
  98. package/Libraries/Text/Text.win32.js +442 -229
  99. package/Libraries/Text/TextNativeComponent.js +2 -1
  100. package/Libraries/Text/TextNativeComponent.win32.js +1 -1
  101. package/Libraries/TurboModule/TurboModuleRegistry.js +13 -50
  102. package/Libraries/Types/CodegenTypes.js +3 -1
  103. package/Libraries/Utilities/Appearance.js +108 -84
  104. package/Libraries/Utilities/DevLoadingView.js +2 -4
  105. package/Libraries/Utilities/HMRClient.js +2 -1
  106. package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
  107. package/Libraries/Utilities/createPerformanceLogger.js +0 -9
  108. package/Libraries/Utilities/stringifyViewConfig.js +22 -0
  109. package/Libraries/Utilities/useColorScheme.js +3 -3
  110. package/Libraries/WebSocket/WebSocket.js +1 -1
  111. package/Libraries/promiseRejectionTrackingOptions.js +1 -1
  112. package/Libraries/vendor/emitter/EventEmitter.js +6 -5
  113. package/flow/jest.js +2 -2
  114. package/index.js +3 -1
  115. package/index.win32.js +3 -1
  116. package/jest/mockComponent.js +4 -1
  117. package/jest/mockModal.js +1 -3
  118. package/jest/mockScrollView.js +1 -1
  119. package/jest/renderer.js +2 -2
  120. package/jest/setup.js +16 -13
  121. package/jest.config.js +1 -2
  122. package/overrides.json +22 -22
  123. package/package.json +27 -26
  124. package/src/private/animated/NativeAnimatedHelper.js +438 -0
  125. package/src/private/animated/NativeAnimatedHelper.win32.js +440 -0
  126. package/src/private/animated/NativeAnimatedValidation.js +64 -0
  127. package/src/private/components/HScrollViewNativeComponents.js +56 -0
  128. package/src/private/components/SafeAreaView_INTERNAL_DO_NOT_USE.js +27 -0
  129. package/src/private/components/VScrollViewNativeComponents.js +48 -0
  130. package/src/private/components/useSyncOnScroll.js +48 -0
  131. package/src/private/featureflags/ReactNativeFeatureFlags.js +166 -16
  132. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +29 -5
  133. package/src/private/fusebox/FuseboxSessionObserver.js +42 -0
  134. package/{Libraries/Core → src/private/renderer/errorhandling}/ErrorHandlers.js +14 -4
  135. package/src/private/setup/setUpDOM.js +28 -0
  136. package/src/private/setup/setUpIntersectionObserver.js +27 -0
  137. package/src/private/setup/setUpMutationObserver.js +26 -0
  138. package/src/private/setup/setUpPerformanceObserver.js +64 -0
  139. package/src/private/specs/modules/NativeAppearance.js +3 -3
  140. package/src/private/specs/modules/NativeLinkingManager.js +1 -1
  141. package/src/private/specs/modules/NativePlatformConstantsWin.js +7 -0
  142. package/src/private/specs/modules/NativeSampleTurboModule.js +14 -1
  143. package/src/private/webapis/dom/nodes/ReadOnlyNode.js +6 -4
  144. package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver}/IntersectionObserver.js +5 -3
  145. package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver}/IntersectionObserverEntry.js +3 -3
  146. package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver}/IntersectionObserverManager.js +14 -17
  147. package/src/private/{specs/modules → webapis/intersectionobserver/specs}/NativeIntersectionObserver.js +2 -2
  148. package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver/specs}/__mocks__/NativeIntersectionObserver.js +4 -4
  149. package/{Libraries/MutationObserver → src/private/webapis/mutationobserver}/MutationObserver.js +5 -3
  150. package/{Libraries/MutationObserver → src/private/webapis/mutationobserver}/MutationObserverManager.js +24 -15
  151. package/{Libraries/MutationObserver → src/private/webapis/mutationobserver}/MutationRecord.js +4 -6
  152. package/src/private/{specs/modules → webapis/mutationobserver/specs}/NativeMutationObserver.js +2 -2
  153. package/{Libraries/MutationObserver → src/private/webapis/mutationobserver/specs}/__mocks__/NativeMutationObserver.js +5 -5
  154. package/src/private/webapis/performance/{EventCounts.js → EventTiming.js} +65 -3
  155. package/src/private/webapis/performance/LongTasks.js +39 -0
  156. package/src/private/webapis/performance/Performance.js +22 -9
  157. package/src/private/webapis/performance/PerformanceEntry.js +36 -18
  158. package/src/private/webapis/performance/PerformanceObserver.js +29 -43
  159. package/src/private/webapis/performance/RawPerformanceEntry.js +24 -1
  160. package/src/private/webapis/performance/UserTiming.js +17 -12
  161. package/src/private/webapis/performance/specs/NativePerformanceObserver.js +1 -1
  162. package/src-win/Libraries/Components/View/ViewAccessibility.d.ts +15 -0
  163. package/types/experimental.d.ts +20 -1
  164. package/Libraries/Animated/NativeAnimatedHelper.js +0 -615
  165. package/Libraries/Animated/NativeAnimatedHelper.win32.js +0 -617
  166. package/Libraries/Core/setUpIntersectionObserver.js +0 -16
  167. package/Libraries/Core/setUpMutationObserver.js +0 -16
  168. package/Libraries/Core/setUpPerformanceObserver.js +0 -18
  169. package/Libraries/IntersectionObserver/NativeIntersectionObserver.js +0 -13
  170. package/Libraries/MutationObserver/NativeMutationObserver.js +0 -13
  171. package/Libraries/Utilities/verifyComponentAttributeEquivalence.js +0 -135
  172. package/src/private/core/setUpDOM.js +0 -18
  173. package/src/private/webapis/performance/PerformanceEventTiming.js +0 -55
  174. /package/src/private/{core → styles}/composeStyles.js +0 -0
@@ -18,7 +18,10 @@ export type ResolvedAssetSource = {|
18
18
  +scale: number,
19
19
  |};
20
20
 
21
- import type {PackagerAsset} from '@react-native/assets-registry/registry';
21
+ import type {
22
+ AssetDestPathResolver,
23
+ PackagerAsset,
24
+ } from '@react-native/assets-registry/registry';
22
25
 
23
26
  const PixelRatio = require('../Utilities/PixelRatio').default;
24
27
  const Platform = require('../Utilities/Platform');
@@ -76,6 +79,10 @@ class AssetSourceResolver {
76
79
  return this.assetServerURL();
77
80
  }
78
81
 
82
+ if (this.asset.resolver != null) {
83
+ return this.getAssetUsingResolver(this.asset.resolver);
84
+ }
85
+
79
86
  if (Platform.OS === 'android') {
80
87
  return this.isLoadedFromFileSystem()
81
88
  ? this.drawableFolderInBundle()
@@ -85,6 +92,26 @@ class AssetSourceResolver {
85
92
  }
86
93
  }
87
94
 
95
+ getAssetUsingResolver(resolver: AssetDestPathResolver): ResolvedAssetSource {
96
+ switch (resolver) {
97
+ case 'android':
98
+ return this.isLoadedFromFileSystem()
99
+ ? this.drawableFolderInBundle()
100
+ : this.resourceIdentifierWithoutScale();
101
+ case 'generic':
102
+ return this.scaledAssetURLNearBundle();
103
+ default:
104
+ throw new Error(
105
+ "Don't know how to get asset via provided resolver: " +
106
+ resolver +
107
+ '\nAsset: ' +
108
+ JSON.stringify(this.asset, null, '\t') +
109
+ '\nPossible resolvers are:' +
110
+ JSON.stringify(['android', 'generic'], null, '\t'),
111
+ );
112
+ }
113
+ }
114
+
88
115
  /**
89
116
  * Returns an absolute URL which can be used to fetch the asset
90
117
  * from the devserver
@@ -150,24 +150,20 @@ let BaseImage: AbstractImageAndroid = React.forwardRef(
150
150
  );
151
151
  }
152
152
 
153
- let style;
153
+ let style: ImageStyleProp;
154
154
  let sources;
155
155
  if (Array.isArray(source)) {
156
- style = flattenStyle<ImageStyleProp>([styles.base, props.style]);
156
+ style = [styles.base, props.style];
157
157
  sources = source;
158
158
  } else {
159
159
  const {uri} = source;
160
- const width = source.width ?? props.width;
161
- const height = source.height ?? props.height;
162
- style = flattenStyle<ImageStyleProp>([
163
- {width, height},
164
- styles.base,
165
- props.style,
166
- ]);
167
- sources = [source];
168
160
  if (uri === '') {
169
161
  console.warn('source.uri should not be an empty string');
170
162
  }
163
+ const width = source.width ?? props.width;
164
+ const height = source.height ?? props.height;
165
+ style = [{width, height}, styles.base, props.style];
166
+ sources = [source];
171
167
  }
172
168
 
173
169
  const {height, width, ...restProps} = props;
@@ -203,11 +199,10 @@ let BaseImage: AbstractImageAndroid = React.forwardRef(
203
199
  },
204
200
  };
205
201
 
206
- const objectFit = style?.objectFit
207
- ? convertObjectFitToResizeMode(style.objectFit)
208
- : null;
202
+ const flattenedStyle = flattenStyle<ImageStyleProp>(style);
203
+ const objectFit = convertObjectFitToResizeMode(flattenedStyle?.objectFit);
209
204
  const resizeMode =
210
- objectFit || props.resizeMode || style?.resizeMode || 'cover';
205
+ objectFit || props.resizeMode || flattenedStyle?.resizeMode || 'cover';
211
206
 
212
207
  const actualRef = useWrapRefWithImageAttachedCallbacks(forwardedRef);
213
208
 
@@ -8,7 +8,7 @@
8
8
  * @format
9
9
  */
10
10
 
11
- import type {ImageStyle, ImageStyleProp} from '../StyleSheet/StyleSheet';
11
+ import type {ImageStyleProp} from '../StyleSheet/StyleSheet';
12
12
  import type {RootTag} from '../Types/RootTagTypes';
13
13
  import type {AbstractImageIOS, ImageIOS} from './ImageTypes.flow';
14
14
  import type {ImageSize} from './NativeImageLoaderAndroid';
@@ -112,38 +112,27 @@ let BaseImage: AbstractImageIOS = React.forwardRef((props, forwardedRef) => {
112
112
  height: undefined,
113
113
  };
114
114
 
115
+ let style: ImageStyleProp;
115
116
  let sources;
116
- let style: ImageStyle;
117
-
118
117
  if (Array.isArray(source)) {
119
- style =
120
- flattenStyle<ImageStyleProp>([styles.base, props.style]) ||
121
- ({}: ImageStyle);
118
+ style = [styles.base, props.style];
122
119
  sources = source;
123
120
  } else {
124
121
  const {uri} = source;
125
- const width = source.width ?? props.width;
126
- const height = source.height ?? props.height;
127
- style =
128
- flattenStyle<ImageStyleProp>([
129
- {width, height},
130
- styles.base,
131
- props.style,
132
- ]) || ({}: ImageStyle);
133
- sources = [source];
134
-
135
122
  if (uri === '') {
136
123
  console.warn('source.uri should not be an empty string');
137
124
  }
125
+ const width = source.width ?? props.width;
126
+ const height = source.height ?? props.height;
127
+ style = [{width, height}, styles.base, props.style];
128
+ sources = [source];
138
129
  }
139
130
 
140
- const objectFit =
141
- style.objectFit != null
142
- ? convertObjectFitToResizeMode(style.objectFit)
143
- : null;
131
+ const flattenedStyle = flattenStyle<ImageStyleProp>(style);
132
+ const objectFit = convertObjectFitToResizeMode(flattenedStyle?.objectFit);
144
133
  const resizeMode =
145
- objectFit || props.resizeMode || style.resizeMode || 'cover';
146
- const tintColor = props.tintColor ?? style.tintColor;
134
+ objectFit || props.resizeMode || flattenedStyle?.resizeMode || 'cover';
135
+ const tintColor = props.tintColor ?? flattenedStyle?.tintColor;
147
136
 
148
137
  if (props.children != null) {
149
138
  throw new Error(
@@ -13,9 +13,7 @@ import type {AbstractImageIOS, ImageIOS} from './ImageTypes.flow';
13
13
  import TextAncestor from '../Text/TextAncestor'; // [Windows]
14
14
  import invariant from 'invariant'; // [Windows]
15
15
 
16
- import type {ImageProps as ImagePropsType} from './ImageProps';
17
-
18
- import type {ImageStyle, ImageStyleProp} from '../StyleSheet/StyleSheet';
16
+ import type {ImageStyleProp} from '../StyleSheet/StyleSheet';
19
17
  import NativeImageLoaderWin32 from './NativeImageLoaderWin32'; // [Win32] Replace iOS
20
18
 
21
19
  import {createRootTag} from '../ReactNative/RootTag';
@@ -131,38 +129,27 @@ let BaseImage: AbstractImageIOS = React.forwardRef((props, forwardedRef) => {
131
129
  height: undefined,
132
130
  };
133
131
 
132
+ let style: ImageStyleProp;
134
133
  let sources;
135
- let style: ImageStyle;
136
-
137
134
  if (Array.isArray(source)) {
138
- style =
139
- flattenStyle<ImageStyleProp>([styles.base, props.style]) ||
140
- ({}: ImageStyle);
135
+ style = [styles.base, props.style];
141
136
  sources = source;
142
137
  } else {
143
138
  const {uri} = source;
144
- const width = source.width ?? props.width;
145
- const height = source.height ?? props.height;
146
- style =
147
- flattenStyle<ImageStyleProp>([
148
- {width, height},
149
- styles.base,
150
- props.style,
151
- ]) || ({}: ImageStyle);
152
- sources = [source];
153
-
154
139
  if (uri === '') {
155
140
  console.warn('source.uri should not be an empty string');
156
141
  }
142
+ const width = source.width ?? props.width;
143
+ const height = source.height ?? props.height;
144
+ style = [{width, height}, styles.base, props.style];
145
+ sources = [source];
157
146
  }
158
147
 
159
- const objectFit =
160
- style.objectFit != null
161
- ? convertObjectFitToResizeMode(style.objectFit)
162
- : null;
148
+ const flattenedStyle = flattenStyle<ImageStyleProp>(style);
149
+ const objectFit = convertObjectFitToResizeMode(flattenedStyle?.objectFit);
163
150
  const resizeMode =
164
- objectFit || props.resizeMode || style.resizeMode || 'cover';
165
- const tintColor = props.tintColor ?? style.tintColor;
151
+ objectFit || props.resizeMode || flattenedStyle?.resizeMode || 'cover';
152
+ const tintColor = props.tintColor ?? flattenedStyle?.tintColor;
166
153
 
167
154
  if (props.children != null) {
168
155
  throw new Error(
@@ -55,14 +55,7 @@ class ImageBackground extends React.Component<ImageBackgroundProps> {
55
55
 
56
56
  _viewRef: ?React.ElementRef<typeof View> = null;
57
57
 
58
- _captureRef = (
59
- ref: null | React$ElementRef<
60
- React$AbstractComponent<
61
- ViewProps,
62
- React.ElementRef<HostComponent<ViewProps>>,
63
- >,
64
- >,
65
- ) => {
58
+ _captureRef = (ref: null | React.ElementRef<HostComponent<ViewProps>>) => {
66
59
  this._viewRef = ref;
67
60
  };
68
61
 
@@ -10,13 +10,13 @@
10
10
 
11
11
  type ResizeMode = 'cover' | 'contain' | 'stretch' | 'repeat' | 'center';
12
12
 
13
- export function convertObjectFitToResizeMode(objectFit: string): ResizeMode {
14
- const objectFitMap = {
15
- contain: 'contain',
16
- cover: 'cover',
17
- fill: 'stretch',
18
- 'scale-down': 'contain',
19
- };
20
- // $FlowFixMe[invalid-computed-prop]
21
- return objectFitMap[objectFit];
13
+ const objectFitMap: {[string]: ResizeMode} = {
14
+ contain: 'contain',
15
+ cover: 'cover',
16
+ fill: 'stretch',
17
+ 'scale-down': 'contain',
18
+ };
19
+
20
+ export function convertObjectFitToResizeMode(objectFit: ?string): ?ResizeMode {
21
+ return objectFit != null ? objectFitMap[objectFit] : undefined;
22
22
  }
@@ -50,6 +50,7 @@ interface NativeCommands {
50
50
  +setIsVisible_EXPERIMENTAL: (
51
51
  viewRef: ElementRef<HostComponent<mixed>>,
52
52
  isVisible: boolean,
53
+ time: number,
53
54
  ) => void;
54
55
  }
55
56
 
@@ -17,6 +17,7 @@ import type {
17
17
  } from '../Renderer/shims/ReactNativeTypes';
18
18
  import type {ViewStyleProp} from '../StyleSheet/StyleSheet';
19
19
  import type {ReactDevToolsAgent} from '../Types/ReactDevToolsTypes';
20
+ import SafeAreaView from '../../src/private/components/SafeAreaView_INTERNAL_DO_NOT_USE';
20
21
 
21
22
  const View = require('../Components/View/View');
22
23
  const PressabilityDebug = require('../Pressability/PressabilityDebug');
@@ -164,7 +165,7 @@ function Inspector({
164
165
  />
165
166
  )}
166
167
 
167
- <View style={[styles.panelContainer, panelContainerStyle]}>
168
+ <SafeAreaView style={[styles.panelContainer, panelContainerStyle]}>
168
169
  <InspectorPanel
169
170
  devtoolsIsOpen={!!reactDevToolsAgent}
170
171
  inspecting={selectedTab === 'elements-inspector'}
@@ -180,7 +181,7 @@ function Inspector({
180
181
  networking={selectedTab === 'network-profiling'}
181
182
  setNetworking={setNetworking}
182
183
  />
183
- </View>
184
+ </SafeAreaView>
184
185
  </View>
185
186
  );
186
187
  }
@@ -17,6 +17,7 @@ import type {
17
17
  } from '../Renderer/shims/ReactNativeTypes';
18
18
  import type {ViewStyleProp} from '../StyleSheet/StyleSheet';
19
19
  import type {ReactDevToolsAgent} from '../Types/ReactDevToolsTypes';
20
+ import SafeAreaView from '../../src/private/components/SafeAreaView_INTERNAL_DO_NOT_USE';
20
21
 
21
22
  const PressabilityDebug = require('../Pressability/PressabilityDebug');
22
23
  const ReactNative = require('../Renderer/shims/ReactNative');
@@ -170,7 +171,7 @@ function Inspector({
170
171
  />
171
172
  )}
172
173
 
173
- <View style={[styles.panelContainer, panelContainerStyle]}>
174
+ <SafeAreaView style={[styles.panelContainer, panelContainerStyle]}>
174
175
  <InspectorPanel
175
176
  devtoolsIsOpen={!!reactDevToolsAgent}
176
177
  inspecting={selectedTab === 'elements-inspector'}
@@ -186,7 +187,7 @@ function Inspector({
186
187
  networking={selectedTab === 'network-profiling'}
187
188
  setNetworking={setNetworking}
188
189
  />
189
- </View>
190
+ </SafeAreaView>
190
191
  </View>
191
192
  );
192
193
  }
@@ -80,16 +80,22 @@ class InspectorPanel extends React.Component<Props> {
80
80
  pressed={this.props.inspecting}
81
81
  onClick={this.props.setInspecting}
82
82
  />
83
- <InspectorPanelButton
84
- title={'Perf'}
85
- pressed={this.props.perfing}
86
- onClick={this.props.setPerfing}
87
- />
88
- <InspectorPanelButton
89
- title={'Network'}
90
- pressed={this.props.networking}
91
- onClick={this.props.setNetworking}
92
- />
83
+ {global.RN$Bridgeless === true ? null : (
84
+ // These Inspector Panel sub-features are removed under the New Arch.
85
+ // See https://github.com/react-native-community/discussions-and-proposals/pull/777
86
+ <>
87
+ <InspectorPanelButton
88
+ title={'Perf'}
89
+ pressed={this.props.perfing}
90
+ onClick={this.props.setPerfing}
91
+ />
92
+ <InspectorPanelButton
93
+ title={'Network'}
94
+ pressed={this.props.networking}
95
+ onClick={this.props.setNetworking}
96
+ />
97
+ </>
98
+ )}
93
99
  <InspectorPanelButton
94
100
  title={'Touchables'}
95
101
  pressed={this.props.touchTargeting}
@@ -335,7 +335,7 @@ class NetworkOverlay extends React.Component<Props, State> {
335
335
  _renderItem = ({
336
336
  item,
337
337
  index,
338
- }: RenderItemProps<NetworkRequestInfo>): React.Element<any> => {
338
+ }: RenderItemProps<NetworkRequestInfo>): React.MixedElement => {
339
339
  const tableRowViewStyle = [
340
340
  styles.tableRow,
341
341
  index % 2 === 1 ? styles.tableRowOdd : styles.tableRowEven,
@@ -116,6 +116,7 @@ class TaskQueue {
116
116
  }
117
117
  } catch (e) {
118
118
  e.message =
119
+ // $FlowFixMe[incompatible-type]
119
120
  'TaskQueue: Error with task ' + (task.name || '') + ': ' + e.message;
120
121
  throw e;
121
122
  }
@@ -617,7 +617,7 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
617
617
  }
618
618
 
619
619
  _renderer = (
620
- ListItemComponent: ?(React.ComponentType<any> | React.Element<any>),
620
+ ListItemComponent: ?(React.ComponentType<any> | React.MixedElement),
621
621
  renderItem: ?RenderItemType<ItemT>,
622
622
  columnWrapperStyle: ?ViewStyleProp,
623
623
  numColumns: ?number,
@@ -33,7 +33,7 @@ type RequiredProps<SectionT: SectionBase<any>> = {|
33
33
  *
34
34
  * sections: $ReadOnlyArray<{
35
35
  * data: $ReadOnlyArray<SectionItem>,
36
- * renderItem?: ({item: SectionItem, ...}) => ?React.Element<*>,
36
+ * renderItem?: ({item: SectionItem, ...}) => ?React.MixedElement,
37
37
  * ItemSeparatorComponent?: ?ReactClass<{highlighted: boolean, ...}>,
38
38
  * }>
39
39
  */
@@ -55,7 +55,7 @@ type OptionalProps<SectionT: SectionBase<any>> = {|
55
55
  ...
56
56
  },
57
57
  ...
58
- }) => null | React.Element<any>,
58
+ }) => null | React.Node,
59
59
  /**
60
60
  * A marker property for telling the list to re-render (since it implements `PureComponent`). If
61
61
  * any of your `renderItem`, Header, Footer, etc. functions depend on anything outside of the
@@ -16,7 +16,7 @@ import type {
16
16
  SectionBase as _SectionBase,
17
17
  VirtualizedSectionListProps,
18
18
  } from '@react-native/virtualized-lists';
19
- import type {AbstractComponent, Element, ElementRef} from 'react';
19
+ import type {AbstractComponent, ElementRef} from 'react';
20
20
 
21
21
  import Platform from '../Utilities/Platform';
22
22
  import {VirtualizedSectionList} from '@react-native/virtualized-lists';
@@ -34,7 +34,7 @@ type RequiredProps<SectionT: SectionBase<any>> = {|
34
34
  *
35
35
  * sections: $ReadOnlyArray<{
36
36
  * data: $ReadOnlyArray<SectionItem>,
37
- * renderItem?: ({item: SectionItem, ...}) => ?React.Element<*>,
37
+ * renderItem?: ({item: SectionItem, ...}) => ?React.MixedElement,
38
38
  * ItemSeparatorComponent?: ?ReactClass<{highlighted: boolean, ...}>,
39
39
  * }>
40
40
  */
@@ -56,7 +56,7 @@ type OptionalProps<SectionT: SectionBase<any>> = {|
56
56
  ...
57
57
  },
58
58
  ...
59
- }) => null | Element<any>,
59
+ }) => null | React.MixedElement,
60
60
  /**
61
61
  * A marker property for telling the list to re-render (since it implements `PureComponent`). If
62
62
  * any of your `renderItem`, Header, Footer, etc. functions depend on anything outside of the
@@ -18,6 +18,7 @@ import type {
18
18
  Message,
19
19
  } from './parseLogBoxLog';
20
20
 
21
+ import DebuggerSessionObserver from '../../../src/private/fusebox/FuseboxSessionObserver';
21
22
  import parseErrorStack from '../../Core/Devtools/parseErrorStack';
22
23
  import NativeDevSettings from '../../NativeModules/specs/NativeDevSettings';
23
24
  import NativeLogBox from '../../NativeModules/specs/NativeLogBox';
@@ -75,6 +76,7 @@ let updateTimeout: $FlowFixMe | null = null;
75
76
  let _isDisabled = false;
76
77
  let _selectedIndex = -1;
77
78
  let hasShownFuseboxWarningsMigrationMessage = false;
79
+ let hostTargetSessionObserverSubscription = null;
78
80
 
79
81
  let warningFilter: WarningFilter = function (format) {
80
82
  return {
@@ -196,11 +198,30 @@ function appendNewLog(newLog: LogBoxLog) {
196
198
  }
197
199
 
198
200
  export function addLog(log: LogData): void {
201
+ if (hostTargetSessionObserverSubscription == null) {
202
+ hostTargetSessionObserverSubscription = DebuggerSessionObserver.subscribe(
203
+ hasActiveSession => {
204
+ if (hasActiveSession) {
205
+ clearWarnings();
206
+ } else {
207
+ // Reset the flag so that we can show the message again if new warning was emitted
208
+ hasShownFuseboxWarningsMigrationMessage = false;
209
+ }
210
+ },
211
+ );
212
+ }
213
+
214
+ // If Host has Fusebox support
199
215
  if (log.level === 'warn' && global.__FUSEBOX_HAS_FULL_CONSOLE_SUPPORT__) {
200
- // Under Fusebox, don't report warnings to LogBox.
201
- showFuseboxWarningsMigrationMessageOnce();
216
+ // And there is no active debugging session
217
+ if (!DebuggerSessionObserver.hasActiveSession()) {
218
+ showFuseboxWarningsMigrationMessageOnce();
219
+ }
220
+
221
+ // Don't show LogBox warnings when Host has active debugging session
202
222
  return;
203
223
  }
224
+
204
225
  const errorForStackTrace = new Error();
205
226
 
206
227
  // Parsing logs are expensive so we schedule this
@@ -419,6 +440,7 @@ export function withSubscription(
419
440
  componentDidCatch(err: Error, errorInfo: {componentStack: string, ...}) {
420
441
  /* $FlowFixMe[class-object-subtyping] added when improving typing for
421
442
  * this parameters */
443
+ // $FlowFixMe[incompatible-call]
422
444
  reportLogBoxError(err, errorInfo.componentStack);
423
445
  }
424
446
 
@@ -483,7 +505,6 @@ function showFuseboxWarningsMigrationMessageOnce() {
483
505
  if (NativeDevSettings.openDebugger) {
484
506
  NativeDevSettings.openDebugger();
485
507
  }
486
- clearWarnings();
487
508
  },
488
509
  }),
489
510
  );
@@ -14,6 +14,7 @@ import * as LogBoxData from './Data/LogBoxData';
14
14
  import LogBoxLog from './Data/LogBoxLog';
15
15
  import LogBoxLogNotification from './UI/LogBoxNotification';
16
16
  import * as React from 'react';
17
+ import SafeAreaView from '../../src/private/components/SafeAreaView_INTERNAL_DO_NOT_USE';
17
18
 
18
19
  type Props = $ReadOnly<{|
19
20
  logs: $ReadOnlyArray<LogBoxLog>,
@@ -58,7 +59,7 @@ export function _LogBoxNotificationContainer(props: Props): React.Node {
58
59
  log => log.level === 'error' || log.level === 'fatal',
59
60
  );
60
61
  return (
61
- <View style={styles.list}>
62
+ <SafeAreaView style={styles.list}>
62
63
  {warnings.length > 0 && (
63
64
  <View style={styles.toast}>
64
65
  <LogBoxLogNotification
@@ -81,7 +82,7 @@ export function _LogBoxNotificationContainer(props: Props): React.Node {
81
82
  />
82
83
  </View>
83
84
  )}
84
- </View>
85
+ </SafeAreaView>
85
86
  );
86
87
  }
87
88
 
@@ -8,9 +8,10 @@
8
8
  * @format
9
9
  */
10
10
 
11
+ import type {ViewProps} from '../../Components/View/ViewPropTypes';
11
12
  import type {LogLevel} from '../Data/LogBoxLog';
12
13
 
13
- import StatusBar from '../../Components/StatusBar/StatusBar';
14
+ import SafeAreaView from '../../Components/SafeAreaView/SafeAreaView';
14
15
  import View from '../../Components/View/View';
15
16
  import StyleSheet from '../../StyleSheet/StyleSheet';
16
17
  import Text from '../../Text/Text';
@@ -26,16 +27,19 @@ type Props = $ReadOnly<{
26
27
  level: LogLevel,
27
28
  }>;
28
29
 
30
+ const LogBoxInspectorHeaderSafeArea: React.AbstractComponent<ViewProps> =
31
+ Platform.OS === 'android' ? View : SafeAreaView;
32
+
29
33
  export default function LogBoxInspectorHeader(props: Props): React.Node {
30
34
  if (props.level === 'syntax') {
31
35
  return (
32
- <View style={[styles.safeArea, styles[props.level]]}>
36
+ <LogBoxInspectorHeaderSafeArea style={styles[props.level]}>
33
37
  <View style={styles.header}>
34
38
  <View style={styles.title}>
35
39
  <Text style={styles.titleText}>Failed to compile</Text>
36
40
  </View>
37
41
  </View>
38
- </View>
42
+ </LogBoxInspectorHeaderSafeArea>
39
43
  );
40
44
  }
41
45
 
@@ -47,7 +51,7 @@ export default function LogBoxInspectorHeader(props: Props): React.Node {
47
51
  const titleText = `Log ${props.selectedIndex + 1} of ${props.total}`;
48
52
 
49
53
  return (
50
- <View style={[styles.safeArea, styles[props.level]]}>
54
+ <LogBoxInspectorHeaderSafeArea style={styles[props.level]}>
51
55
  <View style={styles.header}>
52
56
  <LogBoxInspectorHeaderButton
53
57
  disabled={props.total <= 1}
@@ -65,7 +69,7 @@ export default function LogBoxInspectorHeader(props: Props): React.Node {
65
69
  onPress={() => props.onSelectIndex(nextIndex)}
66
70
  />
67
71
  </View>
68
- </View>
72
+ </LogBoxInspectorHeaderSafeArea>
69
73
  );
70
74
  }
71
75
 
@@ -101,7 +105,4 @@ const styles = StyleSheet.create({
101
105
  includeFontPadding: false,
102
106
  lineHeight: 20,
103
107
  },
104
- safeArea: {
105
- paddingTop: Platform.OS === 'android' ? StatusBar.currentHeight : 40,
106
- },
107
108
  });
@@ -10,9 +10,10 @@
10
10
 
11
11
  'use strict';
12
12
 
13
+ import type {ViewProps} from '../../Components/View/ViewPropTypes';
13
14
  import type {LogLevel} from '../Data/LogBoxLog';
14
15
 
15
- import StatusBar from '../../Components/StatusBar/StatusBar';
16
+ import SafeAreaView from '../../Components/SafeAreaView/SafeAreaView';
16
17
  import View from '../../Components/View/View';
17
18
  import StyleSheet from '../../StyleSheet/StyleSheet';
18
19
  import Text from '../../Text/Text';
@@ -28,16 +29,19 @@ type Props = $ReadOnly<{
28
29
  level: LogLevel,
29
30
  }>;
30
31
 
32
+ const LogBoxInspectorHeaderSafeArea: React.AbstractComponent<ViewProps> =
33
+ Platform.OS === 'android' ? View : SafeAreaView;
34
+
31
35
  export default function LogBoxInspectorHeader(props: Props): React.Node {
32
36
  if (props.level === 'syntax') {
33
37
  return (
34
- <View style={[styles.safeArea, styles[props.level]]}>
38
+ <LogBoxInspectorHeaderSafeArea style={styles[props.level]}>
35
39
  <View style={styles.header}>
36
40
  <View style={styles.title}>
37
41
  <Text style={styles.titleText}>Failed to compile</Text>
38
42
  </View>
39
43
  </View>
40
- </View>
44
+ </LogBoxInspectorHeaderSafeArea>
41
45
  );
42
46
  }
43
47
 
@@ -49,7 +53,7 @@ export default function LogBoxInspectorHeader(props: Props): React.Node {
49
53
  const titleText = `Log ${props.selectedIndex + 1} of ${props.total}`;
50
54
 
51
55
  return (
52
- <View style={[styles.safeArea, styles[props.level]]}>
56
+ <LogBoxInspectorHeaderSafeArea style={styles[props.level]}>
53
57
  <View style={styles.header}>
54
58
  <LogBoxInspectorHeaderButton
55
59
  disabled={props.total <= 1}
@@ -67,31 +71,10 @@ export default function LogBoxInspectorHeader(props: Props): React.Node {
67
71
  onPress={() => props.onSelectIndex(nextIndex)}
68
72
  />
69
73
  </View>
70
- </View>
74
+ </LogBoxInspectorHeaderSafeArea>
71
75
  );
72
76
  }
73
77
 
74
- const backgroundForLevel = (level: LogLevel) =>
75
- ({
76
- warn: {
77
- default: 'transparent',
78
- pressed: LogBoxStyle.getWarningDarkColor(),
79
- },
80
- error: {
81
- default: 'transparent',
82
- pressed: LogBoxStyle.getErrorDarkColor(),
83
- },
84
- fatal: {
85
- default: 'transparent',
86
- pressed: LogBoxStyle.getFatalDarkColor(),
87
- },
88
- syntax: {
89
- default: 'transparent',
90
- pressed: LogBoxStyle.getFatalDarkColor(),
91
- },
92
- })[level];
93
-
94
-
95
78
  const styles = StyleSheet.create({
96
79
  syntax: {
97
80
  backgroundColor: LogBoxStyle.getFatalColor(),
@@ -127,7 +110,4 @@ const styles = StyleSheet.create({
127
110
  includeFontPadding: false,
128
111
  lineHeight: 20,
129
112
  },
130
- safeArea: {
131
- paddingTop: Platform.OS === 'android' ? StatusBar.currentHeight : 40,
132
- },
133
113
  });
@@ -218,7 +218,6 @@ class Modal extends React.Component<Props, State> {
218
218
  }
219
219
 
220
220
  componentWillUnmount() {
221
- this.setState({isRendered: false});
222
221
  if (this._eventSubscription) {
223
222
  this._eventSubscription.remove();
224
223
  }