@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.
- package/.eslintrc.js +11 -0
- package/.flowconfig +5 -4
- package/CHANGELOG.json +172 -40
- package/CHANGELOG.md +57 -24
- package/Libraries/Alert/Alert.js +3 -0
- package/Libraries/Animated/AnimatedEvent.js +1 -1
- package/Libraries/Animated/AnimatedImplementation.js +7 -7
- package/Libraries/Animated/NativeAnimatedAllowlist.js +111 -0
- package/Libraries/Animated/animations/Animation.js +11 -1
- package/Libraries/Animated/animations/DecayAnimation.js +1 -1
- package/Libraries/Animated/animations/SpringAnimation.js +1 -1
- package/Libraries/Animated/animations/TimingAnimation.js +2 -1
- package/Libraries/Animated/components/AnimatedScrollView.js +3 -2
- package/Libraries/Animated/createAnimatedComponent.js +10 -9
- package/Libraries/Animated/nodes/AnimatedColor.js +1 -1
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +3 -2
- package/Libraries/Animated/nodes/AnimatedNode.js +42 -33
- package/Libraries/Animated/nodes/AnimatedObject.js +56 -50
- package/Libraries/Animated/nodes/AnimatedProps.js +77 -40
- package/Libraries/Animated/nodes/AnimatedStyle.js +103 -59
- package/Libraries/Animated/nodes/AnimatedTracking.js +1 -1
- package/Libraries/Animated/nodes/AnimatedTransform.js +102 -67
- package/Libraries/Animated/nodes/AnimatedValue.js +2 -1
- package/Libraries/Animated/nodes/AnimatedWithChildren.js +21 -22
- package/Libraries/Animated/useAnimatedProps.js +142 -7
- package/Libraries/BatchedBridge/NativeModules.js +2 -0
- package/Libraries/Blob/FileReader.js +1 -1
- package/Libraries/Blob/URL.js +2 -62
- package/Libraries/Blob/URLSearchParams.js +71 -0
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +1 -1
- package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +1 -1
- package/Libraries/Components/ScrollView/ScrollView.js +131 -169
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +1 -1
- package/Libraries/Components/StatusBar/StatusBar.js +3 -1
- package/Libraries/Components/TextInput/TextInput.d.ts +32 -2
- package/Libraries/Components/TextInput/TextInput.js +230 -94
- package/Libraries/Components/TextInput/TextInput.win32.js +230 -100
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +22 -0
- package/Libraries/Components/View/ReactNativeViewAttributes.js +2 -0
- package/Libraries/Components/View/ReactNativeViewAttributes.win32.js +2 -0
- package/Libraries/Components/View/ViewAccessibility.d.ts +15 -0
- package/Libraries/Components/View/ViewNativeComponent.js +0 -1
- package/Libraries/Components/View/ViewPropTypes.js +14 -0
- package/Libraries/Components/View/ViewPropTypes.win32.js +14 -0
- package/Libraries/Core/ExceptionsManager.js +2 -0
- package/Libraries/Core/InitializeCore.js +3 -1
- package/Libraries/Core/ReactFiberErrorDialog.js +3 -0
- package/Libraries/Core/ReactNativeVersion.js +4 -4
- package/Libraries/Core/ReactNativeVersionCheck.win32.js +1 -1
- package/Libraries/Core/setUpErrorHandling.js +7 -1
- package/Libraries/Core/setUpGlobals.js +1 -0
- package/Libraries/Core/setUpReactRefresh.js +0 -4
- package/Libraries/Image/AssetSourceResolver.js +28 -1
- package/Libraries/Image/Image.android.js +9 -14
- package/Libraries/Image/Image.ios.js +11 -22
- package/Libraries/Image/Image.win32.js +11 -24
- package/Libraries/Image/ImageBackground.js +1 -8
- package/Libraries/Image/ImageUtils.js +9 -9
- package/Libraries/Image/ImageViewNativeComponent.js +1 -0
- package/Libraries/Inspector/Inspector.js +3 -2
- package/Libraries/Inspector/Inspector.win32.js +3 -2
- package/Libraries/Inspector/InspectorPanel.js +16 -10
- package/Libraries/Inspector/NetworkOverlay.js +1 -1
- package/Libraries/Interaction/TaskQueue.js +1 -0
- package/Libraries/Lists/FlatList.js +1 -1
- package/Libraries/Lists/SectionList.js +2 -2
- package/Libraries/Lists/SectionListModern.js +3 -3
- package/Libraries/LogBox/Data/LogBoxData.js +24 -3
- package/Libraries/LogBox/LogBoxNotificationContainer.js +3 -2
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +9 -8
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +9 -29
- package/Libraries/Modal/Modal.js +0 -1
- package/Libraries/NativeComponent/BaseViewConfig.android.js +8 -0
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +7 -0
- package/Libraries/NativeComponent/BaseViewConfig.win32.js +7 -0
- package/Libraries/NativeComponent/NativeComponentRegistry.js +22 -22
- package/Libraries/NativeComponent/StaticViewConfigValidator.js +0 -21
- package/Libraries/Network/XMLHttpRequest.js +4 -2
- package/Libraries/ReactNative/AppContainer-dev.js +1 -5
- package/Libraries/ReactNative/AppContainer-prod.js +1 -5
- package/Libraries/ReactNative/AppContainer.js +0 -1
- package/Libraries/ReactNative/AppRegistry.js +0 -6
- package/Libraries/ReactNative/BridgelessUIManager.js +1 -0
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +1 -1
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +5 -5
- package/Libraries/ReactNative/RendererImplementation.js +26 -4
- package/Libraries/ReactNative/getNativeComponentAttributes.js +8 -0
- package/Libraries/ReactNative/renderApplication.js +0 -2
- package/Libraries/Renderer/shims/ReactNativeTypes.js +11 -4
- package/Libraries/StyleSheet/StyleSheet.js +1 -1
- package/Libraries/StyleSheet/StyleSheet.win32.js +1 -1
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +74 -15
- package/Libraries/StyleSheet/StyleSheetTypes.js +60 -5
- package/Libraries/StyleSheet/processBackgroundImage.js +384 -0
- package/Libraries/StyleSheet/processBoxShadow.js +211 -0
- package/Libraries/StyleSheet/processFilter.js +231 -42
- package/Libraries/Text/Text.js +394 -196
- package/Libraries/Text/Text.win32.js +442 -229
- package/Libraries/Text/TextNativeComponent.js +2 -1
- package/Libraries/Text/TextNativeComponent.win32.js +1 -1
- package/Libraries/TurboModule/TurboModuleRegistry.js +13 -50
- package/Libraries/Types/CodegenTypes.js +3 -1
- package/Libraries/Utilities/Appearance.js +108 -84
- package/Libraries/Utilities/DevLoadingView.js +2 -4
- package/Libraries/Utilities/HMRClient.js +2 -1
- package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
- package/Libraries/Utilities/createPerformanceLogger.js +0 -9
- package/Libraries/Utilities/stringifyViewConfig.js +22 -0
- package/Libraries/Utilities/useColorScheme.js +3 -3
- package/Libraries/WebSocket/WebSocket.js +1 -1
- package/Libraries/promiseRejectionTrackingOptions.js +1 -1
- package/Libraries/vendor/emitter/EventEmitter.js +6 -5
- package/flow/jest.js +2 -2
- package/index.js +3 -1
- package/index.win32.js +3 -1
- package/jest/mockComponent.js +4 -1
- package/jest/mockModal.js +1 -3
- package/jest/mockScrollView.js +1 -1
- package/jest/renderer.js +2 -2
- package/jest/setup.js +16 -13
- package/jest.config.js +1 -2
- package/overrides.json +22 -22
- package/package.json +27 -26
- package/src/private/animated/NativeAnimatedHelper.js +438 -0
- package/src/private/animated/NativeAnimatedHelper.win32.js +440 -0
- package/src/private/animated/NativeAnimatedValidation.js +64 -0
- package/src/private/components/HScrollViewNativeComponents.js +56 -0
- package/src/private/components/SafeAreaView_INTERNAL_DO_NOT_USE.js +27 -0
- package/src/private/components/VScrollViewNativeComponents.js +48 -0
- package/src/private/components/useSyncOnScroll.js +48 -0
- package/src/private/featureflags/ReactNativeFeatureFlags.js +166 -16
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +29 -5
- package/src/private/fusebox/FuseboxSessionObserver.js +42 -0
- package/{Libraries/Core → src/private/renderer/errorhandling}/ErrorHandlers.js +14 -4
- package/src/private/setup/setUpDOM.js +28 -0
- package/src/private/setup/setUpIntersectionObserver.js +27 -0
- package/src/private/setup/setUpMutationObserver.js +26 -0
- package/src/private/setup/setUpPerformanceObserver.js +64 -0
- package/src/private/specs/modules/NativeAppearance.js +3 -3
- package/src/private/specs/modules/NativeLinkingManager.js +1 -1
- package/src/private/specs/modules/NativePlatformConstantsWin.js +7 -0
- package/src/private/specs/modules/NativeSampleTurboModule.js +14 -1
- package/src/private/webapis/dom/nodes/ReadOnlyNode.js +6 -4
- package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver}/IntersectionObserver.js +5 -3
- package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver}/IntersectionObserverEntry.js +3 -3
- package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver}/IntersectionObserverManager.js +14 -17
- package/src/private/{specs/modules → webapis/intersectionobserver/specs}/NativeIntersectionObserver.js +2 -2
- package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver/specs}/__mocks__/NativeIntersectionObserver.js +4 -4
- package/{Libraries/MutationObserver → src/private/webapis/mutationobserver}/MutationObserver.js +5 -3
- package/{Libraries/MutationObserver → src/private/webapis/mutationobserver}/MutationObserverManager.js +24 -15
- package/{Libraries/MutationObserver → src/private/webapis/mutationobserver}/MutationRecord.js +4 -6
- package/src/private/{specs/modules → webapis/mutationobserver/specs}/NativeMutationObserver.js +2 -2
- package/{Libraries/MutationObserver → src/private/webapis/mutationobserver/specs}/__mocks__/NativeMutationObserver.js +5 -5
- package/src/private/webapis/performance/{EventCounts.js → EventTiming.js} +65 -3
- package/src/private/webapis/performance/LongTasks.js +39 -0
- package/src/private/webapis/performance/Performance.js +22 -9
- package/src/private/webapis/performance/PerformanceEntry.js +36 -18
- package/src/private/webapis/performance/PerformanceObserver.js +29 -43
- package/src/private/webapis/performance/RawPerformanceEntry.js +24 -1
- package/src/private/webapis/performance/UserTiming.js +17 -12
- package/src/private/webapis/performance/specs/NativePerformanceObserver.js +1 -1
- package/src-win/Libraries/Components/View/ViewAccessibility.d.ts +15 -0
- package/types/experimental.d.ts +20 -1
- package/Libraries/Animated/NativeAnimatedHelper.js +0 -615
- package/Libraries/Animated/NativeAnimatedHelper.win32.js +0 -617
- package/Libraries/Core/setUpIntersectionObserver.js +0 -16
- package/Libraries/Core/setUpMutationObserver.js +0 -16
- package/Libraries/Core/setUpPerformanceObserver.js +0 -18
- package/Libraries/IntersectionObserver/NativeIntersectionObserver.js +0 -13
- package/Libraries/MutationObserver/NativeMutationObserver.js +0 -13
- package/Libraries/Utilities/verifyComponentAttributeEquivalence.js +0 -135
- package/src/private/core/setUpDOM.js +0 -18
- package/src/private/webapis/performance/PerformanceEventTiming.js +0 -55
- /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 {
|
|
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 =
|
|
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
|
|
207
|
-
|
|
208
|
-
: null;
|
|
202
|
+
const flattenedStyle = flattenStyle<ImageStyleProp>(style);
|
|
203
|
+
const objectFit = convertObjectFitToResizeMode(flattenedStyle?.objectFit);
|
|
209
204
|
const resizeMode =
|
|
210
|
-
objectFit || props.resizeMode ||
|
|
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 {
|
|
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
|
|
141
|
-
|
|
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 ||
|
|
146
|
-
const tintColor = props.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 {
|
|
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
|
|
160
|
-
|
|
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 ||
|
|
165
|
-
const tintColor = props.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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
}
|
|
@@ -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
|
-
<
|
|
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
|
-
</
|
|
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
|
-
<
|
|
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
|
-
</
|
|
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
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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.
|
|
338
|
+
}: RenderItemProps<NetworkRequestInfo>): React.MixedElement => {
|
|
339
339
|
const tableRowViewStyle = [
|
|
340
340
|
styles.tableRow,
|
|
341
341
|
index % 2 === 1 ? styles.tableRowOdd : styles.tableRowEven,
|
|
@@ -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.
|
|
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.
|
|
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.
|
|
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,
|
|
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.
|
|
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 |
|
|
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
|
-
//
|
|
201
|
-
|
|
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
|
-
<
|
|
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
|
-
</
|
|
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
|
|
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
|
-
<
|
|
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
|
-
</
|
|
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
|
-
<
|
|
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
|
-
</
|
|
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
|
|
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
|
-
<
|
|
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
|
-
</
|
|
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
|
-
<
|
|
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
|
-
</
|
|
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
|
});
|