@office-iss/react-native-win32 0.84.0 → 0.85.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/.eslintignore +1 -0
- package/.flowconfig +1 -5
- package/CHANGELOG.json +67 -22
- package/CHANGELOG.md +14 -17
- package/IntegrationTests/IntegrationTestHarnessTest.js +1 -1
- package/IntegrationTests/LayoutEventsTest.js +1 -1
- package/IntegrationTests/TimersTest.js +1 -1
- package/Libraries/ActionSheetIOS/ActionSheetIOS.js +3 -3
- package/Libraries/Animated/Animated.d.ts +8 -1
- package/Libraries/Animated/AnimatedEvent.js +4 -4
- package/Libraries/Animated/AnimatedImplementation.js +2 -2
- package/Libraries/Animated/animations/Animation.js +3 -3
- package/Libraries/Animated/animations/DecayAnimation.js +4 -4
- package/Libraries/Animated/animations/SpringAnimation.js +5 -5
- package/Libraries/Animated/animations/TimingAnimation.js +5 -5
- package/Libraries/Animated/createAnimatedComponent.js +7 -7
- package/Libraries/Animated/nodes/AnimatedColor.js +2 -2
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +12 -12
- package/Libraries/Animated/nodes/AnimatedNode.js +3 -3
- package/Libraries/Animated/nodes/AnimatedObject.js +3 -3
- package/Libraries/Animated/nodes/AnimatedProps.js +6 -6
- package/Libraries/Animated/nodes/AnimatedStyle.js +7 -7
- package/Libraries/Animated/nodes/AnimatedTransform.js +13 -13
- package/Libraries/Animated/nodes/AnimatedValue.js +1 -1
- package/Libraries/Animated/nodes/AnimatedValueXY.js +1 -1
- package/Libraries/Animated/nodes/AnimatedWithChildren.js +1 -1
- package/Libraries/Animated/useAnimatedColor.d.ts +15 -0
- package/Libraries/Animated/useAnimatedColor.js +25 -0
- package/Libraries/Animated/useAnimatedValueXY.d.ts +15 -0
- package/Libraries/Animated/useAnimatedValueXY.js +26 -0
- package/Libraries/AppState/AppState.js +1 -1
- package/Libraries/BatchedBridge/MessageQueue.js +3 -3
- package/Libraries/BatchedBridge/NativeModules.js +12 -10
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +30 -26
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +34 -30
- package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +2 -2
- package/Libraries/Components/Button.js +2 -2
- package/Libraries/Components/Button.win32.js +2 -2
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js +2 -2
- package/Libraries/Components/EnterString.win32.js +2 -2
- package/Libraries/Components/EnterString.win32.js.map +1 -1
- package/Libraries/Components/Keyboard/Keyboard.js +6 -6
- package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +1 -1
- package/Libraries/Components/LayoutConformance/LayoutConformance.js +1 -1
- package/Libraries/Components/LayoutConformance/LayoutConformanceNativeComponent.js +1 -1
- package/Libraries/Components/Pressable/Pressable.d.ts +5 -0
- package/Libraries/Components/Pressable/Pressable.js +3 -3
- package/Libraries/Components/Pressable/Pressable.win32.js +3 -3
- package/Libraries/Components/Pressable/useAndroidRippleForView.js +4 -4
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js +1 -1
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidTypes.js +3 -3
- package/Libraries/Components/RefreshControl/RefreshControl.js +5 -5
- package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +8 -12
- package/Libraries/Components/ScrollView/ScrollView.d.ts +9 -0
- package/Libraries/Components/ScrollView/ScrollView.js +19 -9
- package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +8 -18
- package/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js +4 -3
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +1 -1
- package/Libraries/Components/StaticRenderer.js +1 -1
- package/Libraries/Components/StatusBar/StatusBar.js +8 -8
- package/Libraries/Components/Switch/Switch.js +3 -3
- package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +33 -48
- package/Libraries/Components/TextInput/InputAccessoryView.js +1 -1
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +6 -11
- package/Libraries/Components/TextInput/TextInput.flow.js +21 -20
- package/Libraries/Components/TextInput/TextInput.flow.win32.js +23 -22
- package/Libraries/Components/TextInput/TextInput.js +8 -4
- package/Libraries/Components/TextInput/TextInput.win32.js +3 -4
- package/Libraries/Components/Touchable/PooledClass.js +1 -1
- package/Libraries/Components/Touchable/Touchable.js +2 -2
- package/Libraries/Components/Touchable/Touchable.win32.js +2 -2
- package/Libraries/Components/Touchable/TouchableBounce.js +4 -4
- package/Libraries/Components/Touchable/TouchableHighlight.js +8 -8
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +7 -7
- package/Libraries/Components/Touchable/TouchableNativeFeedback.win32.js +7 -7
- package/Libraries/Components/Touchable/TouchableOpacity.js +4 -4
- package/Libraries/Components/Touchable/TouchableWin32.js +1 -1
- package/Libraries/Components/Touchable/TouchableWin32.js.map +1 -1
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +1 -1
- package/Libraries/Components/UnimplementedViews/UnimplementedView.js +1 -1
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +68 -31
- package/Libraries/Components/View/ViewAccessibility.js +7 -7
- package/Libraries/Components/View/ViewAccessibility.win32.js +7 -7
- package/Libraries/Components/View/ViewPropTypes.js +14 -14
- package/Libraries/Components/View/ViewPropTypes.win32.js +16 -16
- package/Libraries/Core/Devtools/parseHermesStack.js +8 -8
- package/Libraries/Core/Devtools/symbolicateStackTrace.js +2 -2
- package/Libraries/Core/ExceptionsManager.js +2 -2
- package/Libraries/Core/ExtendedError.js +3 -3
- package/Libraries/Core/RawEventEmitter.js +1 -1
- package/Libraries/Core/ReactNativeVersion.js +2 -2
- package/Libraries/Core/Timers/JSTimers.js +3 -2
- package/Libraries/Core/setUpDeveloperTools.js +1 -1
- package/Libraries/Core/setUpErrorHandling.js +4 -2
- package/Libraries/Core/setUpReactDevTools.js +23 -6
- package/Libraries/Core/setUpSegmentFetcher.js +1 -1
- package/Libraries/Debugging/DebuggingOverlay.js +2 -2
- package/Libraries/EventEmitter/NativeEventEmitter.js +7 -9
- package/Libraries/EventEmitter/RCTDeviceEventEmitter.js +1 -1
- package/Libraries/Image/AssetSourceResolver.js +1 -1
- package/Libraries/Image/Image.android.js +172 -306
- package/Libraries/Image/ImageProps.js +9 -11
- package/Libraries/Image/ImageSource.js +2 -2
- package/Libraries/Image/ImageSourceUtils.js +8 -4
- package/Libraries/Image/ImageTypes.flow.js +2 -2
- package/Libraries/Image/ImageViewNativeComponent.js +7 -16
- package/Libraries/Image/nativeImageSource.js +1 -1
- package/Libraries/Interaction/InteractionManager.js +5 -4
- package/Libraries/Interaction/PanResponder.js +1 -1
- package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -2
- package/Libraries/Linking/Linking.js +1 -1
- package/Libraries/Lists/FlatList.js +3 -3
- package/Libraries/Lists/SectionList.js +1 -1
- package/Libraries/Lists/SectionListModern.js +2 -2
- package/Libraries/LogBox/Data/LogBoxData.js +38 -24
- package/Libraries/LogBox/Data/LogBoxLog.js +43 -112
- package/Libraries/LogBox/Data/parseLogBoxLog.js +21 -117
- package/Libraries/LogBox/LogBox.js +42 -19
- package/Libraries/LogBox/LogBoxInspectorContainer.js +2 -2
- package/Libraries/LogBox/LogBoxNotificationContainer.js +2 -2
- package/Libraries/LogBox/UI/LogBoxButton.js +14 -16
- package/Libraries/LogBox/UI/LogBoxInspector.js +2 -2
- package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js +6 -9
- package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.win32.js +6 -9
- package/Libraries/LogBox/UI/LogBoxInspectorFooter.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorFooterButton.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorHeaderButton.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorMessageHeader.js +10 -15
- package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js +25 -18
- package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.win32.js +15 -16
- package/Libraries/LogBox/UI/LogBoxInspectorSection.js +5 -7
- package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +8 -10
- package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.win32.js +11 -13
- package/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js +8 -6
- package/Libraries/LogBox/UI/LogBoxInspectorStackFrame.win32.js +3 -5
- package/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js +17 -29
- package/Libraries/LogBox/UI/LogBoxMessage.js +28 -37
- package/Libraries/LogBox/UI/LogBoxNotification.js +1 -1
- package/Libraries/Modal/Modal.js +3 -3
- package/Libraries/NativeComponent/BaseViewConfig.android.js +28 -52
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +19 -21
- package/Libraries/NativeComponent/BaseViewConfig.win32.js +16 -16
- package/Libraries/Network/RCTNetworking.android.js +1 -1
- package/Libraries/Network/RCTNetworking.ios.js +1 -1
- package/Libraries/Network/RCTNetworking.js.flow +1 -1
- package/Libraries/Network/RCTNetworking.win32.js +1 -1
- package/Libraries/Network/RCTNetworkingEventDefinitions.flow.js +1 -1
- package/Libraries/Network/XMLHttpRequest.js +1 -1
- package/Libraries/PermissionsAndroid/PermissionsAndroid.js +3 -3
- package/Libraries/Pressability/Pressability.js +5 -5
- package/Libraries/Pressability/Pressability.win32.js +5 -5
- package/Libraries/Pressability/PressabilityDebug.js +1 -1
- package/Libraries/Pressability/PressabilityPerformanceEventEmitter.js +1 -1
- package/Libraries/Pressability/usePressability.js +3 -14
- package/Libraries/PushNotificationIOS/PushNotificationIOS.js +2 -2
- package/Libraries/ReactNative/AppContainer-dev.js +18 -1
- package/Libraries/ReactNative/AppContainer.js +1 -1
- package/Libraries/ReactNative/AppRegistry.flow.js +2 -2
- package/Libraries/ReactNative/AppRegistryImpl.js +2 -2
- package/Libraries/ReactNative/FabricUIManager.js +1 -1
- package/Libraries/ReactNative/RendererImplementation.js +4 -4
- package/Libraries/ReactNative/UIManagerProperties.js +1 -1
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +3 -2
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +3 -2
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +3 -2
- package/Libraries/Renderer/shims/ReactFabric.js +1 -3
- package/Libraries/Renderer/shims/ReactFeatureFlags.js +1 -3
- package/Libraries/Renderer/shims/ReactNative.js +3 -2
- package/Libraries/Renderer/shims/ReactNativeTypes.js +1 -3
- package/Libraries/Renderer/shims/ReactNativeTypes.win32.js +1 -3
- package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +1 -3
- package/Libraries/Renderer/shims/createReactNativeComponentClass.js +1 -3
- package/Libraries/StyleSheet/PointPropType.js +1 -1
- package/Libraries/StyleSheet/Rect.js +1 -1
- package/Libraries/StyleSheet/StyleSheet.d.ts +0 -5
- package/Libraries/StyleSheet/StyleSheet.js +1 -1
- package/Libraries/StyleSheet/StyleSheet.js.flow +1 -1
- package/Libraries/StyleSheet/StyleSheetExports.js +16 -25
- package/Libraries/StyleSheet/StyleSheetExports.js.flow +2 -7
- package/Libraries/StyleSheet/StyleSheetTypes.js +33 -35
- package/Libraries/StyleSheet/private/_StyleSheetTypesOverrides.js +5 -5
- package/Libraries/StyleSheet/private/_TransformStyle.js +7 -7
- package/Libraries/StyleSheet/processBackgroundImage.js +7 -7
- package/Libraries/StyleSheet/processBackgroundPosition.js +4 -4
- package/Libraries/StyleSheet/processBackgroundRepeat.js +4 -4
- package/Libraries/StyleSheet/processBackgroundSize.js +4 -4
- package/Libraries/StyleSheet/processBoxShadow.js +44 -4
- package/Libraries/StyleSheet/processColorArray.js +2 -2
- package/Libraries/StyleSheet/processFilter.js +2 -2
- package/Libraries/Text/Text.js +295 -627
- package/Libraries/Text/Text.win32.js +360 -744
- package/Libraries/Text/TextNativeComponent.js +14 -7
- package/Libraries/Text/TextNativeComponent.win32.js +14 -7
- package/Libraries/Text/TextProps.js +4 -4
- package/Libraries/Text/TextProps.win32.js +4 -4
- package/Libraries/Types/CodegenTypes.js +1 -1
- package/Libraries/Types/CoreEventTypes.js +21 -21
- package/Libraries/Types/CoreEventTypes.win32.js +22 -21
- package/Libraries/Types/ReactDevToolsTypes.js +2 -2
- package/Libraries/Utilities/Appearance.js +6 -1
- package/Libraries/Utilities/Dimensions.js +1 -1
- package/Libraries/Utilities/Dimensions.win32.js +1 -1
- package/Libraries/Utilities/HMRClient.js +32 -5
- package/Libraries/Utilities/IPerformanceLogger.js +4 -4
- package/Libraries/Utilities/codegenNativeCommands.js +4 -4
- package/Libraries/Utilities/codegenNativeComponent.d.ts +2 -0
- package/Libraries/Utilities/codegenNativeComponent.js +2 -2
- package/Libraries/Utilities/logError.js +1 -1
- package/Libraries/Utilities/stringifySafe.js +3 -3
- package/Libraries/Utilities/useMergeRefs.js +2 -2
- package/Libraries/vendor/core/ErrorUtils.js +4 -4
- package/Libraries/vendor/emitter/EventEmitter.js +16 -20
- package/flow/bom.js.flow +18 -17
- package/flow/dom.js.flow +12 -5
- package/flow/global.js +1 -1
- package/index.js +9 -0
- package/index.win32.js +9 -0
- package/index.win32.js.flow +8 -1
- package/jest/RefreshControlMock.js +2 -2
- package/jest/assetFileTransformer.js +8 -3
- package/jest/mockComponent.js +3 -4
- package/jest/mockNativeComponent.js +1 -1
- package/jest/mocks/ActivityIndicator.js +2 -2
- package/jest/mocks/Image.js +2 -2
- package/jest/mocks/Modal.js +2 -2
- package/jest/mocks/RefreshControl.js +3 -3
- package/jest/mocks/RendererProxy.js +2 -2
- package/jest/mocks/ScrollView.js +5 -5
- package/jest/mocks/Text.js +2 -2
- package/jest/mocks/TextInput.js +2 -2
- package/jest/mocks/View.js +2 -2
- package/jest/mocks/ViewNativeComponent.js +1 -1
- package/jest/mocks/requireNativeComponent.js +1 -1
- package/jest/mocks/useColorScheme.js +1 -1
- package/jest/setup.js +68 -31
- package/overrides.json +30 -36
- package/package.json +22 -19
- package/src/private/animated/NativeAnimatedHelper.js +2 -2
- package/src/private/animated/NativeAnimatedHelper.win32.js +2 -2
- package/src/private/animated/createAnimatedPropsMemoHook.js +19 -19
- package/src/private/components/virtualview/VirtualView.js +14 -21
- package/src/private/components/virtualview/VirtualViewExperimentalNativeComponent.js +11 -10
- package/src/private/components/virtualview/VirtualViewNativeComponent.js +4 -4
- package/src/private/devsupport/devmenu/elementinspector/BorderBox.js +2 -2
- package/src/private/devsupport/devmenu/elementinspector/BoxInspector.js +3 -3
- package/src/private/devsupport/devmenu/elementinspector/ElementBox.js +4 -4
- package/src/private/devsupport/devmenu/elementinspector/ElementProperties.js +1 -1
- package/src/private/devsupport/devmenu/elementinspector/Inspector.js +39 -17
- package/src/private/devsupport/devmenu/elementinspector/InspectorOverlay.js +15 -3
- package/src/private/devsupport/devmenu/elementinspector/InspectorPanel.js +2 -2
- package/src/private/devsupport/devmenu/elementinspector/ReactDevToolsOverlay.js +2 -8
- package/src/private/devsupport/devmenu/elementinspector/StyleInspector.js +1 -1
- package/src/private/devsupport/devmenu/elementinspector/resolveBoxStyle.js +1 -1
- package/src/private/devsupport/devmenu/elementinspector/useExternalInspection.js +102 -0
- package/src/private/devsupport/rndevtools/FuseboxSessionObserver.js +12 -25
- package/src/private/devsupport/rndevtools/GlobalStateObserver.js +56 -0
- package/src/private/devsupport/rndevtools/TracingStateObserver.js +28 -0
- package/src/private/featureflags/ReactNativeFeatureFlags.js +71 -79
- package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +2 -2
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +14 -12
- package/src/private/setup/setUpDefaultReactNativeEnvironment.js +6 -0
- package/src/private/specs_DEPRECATED/components/ActivityIndicatorViewNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/AndroidDrawerLayoutNativeComponent.js +3 -3
- package/src/private/specs_DEPRECATED/components/AndroidHorizontalScrollContentViewNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/AndroidSwipeRefreshLayoutNativeComponent.js +2 -2
- package/src/private/specs_DEPRECATED/components/AndroidSwitchNativeComponent.js +2 -2
- package/src/private/specs_DEPRECATED/components/DebuggingOverlayNativeComponent.js +3 -3
- package/src/private/specs_DEPRECATED/components/ProgressBarAndroidNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/PullToRefreshViewNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/RCTInputAccessoryViewNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/RCTModalHostViewNativeComponent.js +3 -3
- package/src/private/specs_DEPRECATED/components/RCTSafeAreaViewNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/SwitchNativeComponent.js +2 -2
- package/src/private/specs_DEPRECATED/components/UnimplementedNativeViewNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/modules/NativeImageLoaderIOS.js +1 -1
- package/src/private/styles/composeStyles.js +1 -1
- package/src/private/utilities/toError.js +27 -0
- package/src/private/utilities/toExtendedError.js +30 -0
- package/src/private/webapis/dom/events/Event.js +1 -1
- package/src/private/webapis/dom/events/EventHandlerAttributes.js +2 -2
- package/src/private/webapis/dom/events/EventTarget.js +3 -3
- package/src/private/webapis/dom/events/internals/EventInternals.js +2 -2
- package/src/private/webapis/dom/nodes/ReadOnlyElement.js +1 -1
- package/src/private/webapis/dom/nodes/ReadOnlyNode.js +2 -2
- package/src/private/webapis/dom/nodes/specs/NativeDOM.js +14 -14
- package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +2 -2
- package/src/private/webapis/dom/oldstylecollections/NodeList.js +2 -2
- package/src/private/webapis/geometry/DOMRectList.js +2 -2
- package/src/private/webapis/intersectionobserver/IntersectionObserver.js +8 -8
- package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +6 -6
- package/src/private/webapis/mutationobserver/MutationObserver.js +2 -2
- package/src/private/webapis/mutationobserver/MutationRecord.js +2 -2
- package/src/private/webapis/mutationobserver/internals/MutationObserverManager.js +1 -1
- package/src/private/webapis/mutationobserver/specs/NativeMutationObserver.js +3 -3
- package/src/private/webapis/performance/LongTasks.js +3 -3
- package/src/private/webapis/performance/Performance.js +4 -4
- package/src/private/webapis/performance/PerformanceEntry.js +1 -1
- package/src/private/webapis/performance/PerformanceObserver.js +2 -2
- package/src/private/webapis/performance/specs/NativePerformance.js +8 -8
- package/src/private/webapis/structuredClone/structuredClone.js +2 -2
- package/src/types/globals.d.ts +4 -4
- package/src-win/Libraries/Components/EnterString.win32.tsx +2 -2
- package/src-win/Libraries/Components/Touchable/TouchableWin32.tsx +14 -14
- package/src-win/index.win32.js.flow +8 -1
- package/types/index.d.ts +2 -0
- package/Libraries/Components/View/ReactNativeViewAttributes.js +0 -60
- package/Libraries/Components/View/ReactNativeViewAttributes.win32.js +0 -94
- package/Libraries/Image/TextInlineImageNativeComponent.js +0 -49
|
@@ -16,11 +16,11 @@ import requireNativeComponent from '../../Libraries/ReactNative/requireNativeCom
|
|
|
16
16
|
import UIManager from '../ReactNative/UIManager';
|
|
17
17
|
|
|
18
18
|
// TODO: import from CodegenSchema once workspaces are enabled
|
|
19
|
-
type NativeComponentOptions =
|
|
19
|
+
type NativeComponentOptions = Readonly<{
|
|
20
20
|
interfaceOnly?: boolean,
|
|
21
21
|
paperComponentName?: string,
|
|
22
22
|
paperComponentNameDeprecated?: string,
|
|
23
|
-
excludedPlatforms?:
|
|
23
|
+
excludedPlatforms?: ReadonlyArray<'iOS' | 'android'>,
|
|
24
24
|
}>;
|
|
25
25
|
|
|
26
26
|
export type NativeComponentType<T: {...}> = HostComponent<T>;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* `console.error` as a failure callback - it's not properly bound. If passes an
|
|
16
16
|
* `Error` object, it will print the message and stack.
|
|
17
17
|
*/
|
|
18
|
-
const logError = function (...args:
|
|
18
|
+
const logError = function (...args: ReadonlyArray<unknown>) {
|
|
19
19
|
if (args.length === 1 && args[0] instanceof Error) {
|
|
20
20
|
const err = args[0];
|
|
21
21
|
console.error('Error: "' + err.message + '". Stack:\n' + err.stack);
|
|
@@ -84,7 +84,7 @@ export function createStringifySafeWithLimits(limits: {
|
|
|
84
84
|
} else if (typeof arg === 'function') {
|
|
85
85
|
try {
|
|
86
86
|
return arg.toString();
|
|
87
|
-
} catch
|
|
87
|
+
} catch {
|
|
88
88
|
return '[function unknown]';
|
|
89
89
|
}
|
|
90
90
|
} else if (arg instanceof Error) {
|
|
@@ -98,12 +98,12 @@ export function createStringifySafeWithLimits(limits: {
|
|
|
98
98
|
return '["' + typeof arg + '" failed to stringify]';
|
|
99
99
|
}
|
|
100
100
|
return ret;
|
|
101
|
-
} catch
|
|
101
|
+
} catch {
|
|
102
102
|
if (typeof arg.toString === 'function') {
|
|
103
103
|
try {
|
|
104
104
|
// $FlowFixMe[incompatible-use] : toString shouldn't take any arguments in general.
|
|
105
105
|
return arg.toString();
|
|
106
|
-
} catch
|
|
106
|
+
} catch {}
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
}
|
|
@@ -22,11 +22,11 @@ import {useCallback} from 'react';
|
|
|
22
22
|
* lead to problems with the given refs being invoked more times than desired.
|
|
23
23
|
*/
|
|
24
24
|
export default function useMergeRefs<Instance>(
|
|
25
|
-
...refs:
|
|
25
|
+
...refs: ReadonlyArray<?React.RefSetter<Instance>>
|
|
26
26
|
): React.RefSetter<Instance> {
|
|
27
27
|
const refEffect = useCallback(
|
|
28
28
|
(current: Instance) => {
|
|
29
|
-
const cleanups:
|
|
29
|
+
const cleanups: ReadonlyArray<void | (() => void)> = refs.map(ref => {
|
|
30
30
|
if (ref == null) {
|
|
31
31
|
return undefined;
|
|
32
32
|
} else {
|
|
@@ -10,22 +10,22 @@
|
|
|
10
10
|
|
|
11
11
|
// From @react-native/js-polyfills
|
|
12
12
|
type ErrorHandler = (error: unknown, isFatal: boolean) => void;
|
|
13
|
-
type Fn<Args:
|
|
13
|
+
type Fn<Args: ReadonlyArray<unknown>, Return> = (...Args) => Return;
|
|
14
14
|
export type ErrorUtils = {
|
|
15
|
-
applyWithGuard<TArgs:
|
|
15
|
+
applyWithGuard<TArgs: ReadonlyArray<unknown>, TOut>(
|
|
16
16
|
fun: Fn<TArgs, TOut>,
|
|
17
17
|
context?: unknown,
|
|
18
18
|
args?: ?TArgs,
|
|
19
19
|
unused_onError?: null,
|
|
20
20
|
unused_name?: ?string,
|
|
21
21
|
): ?TOut,
|
|
22
|
-
applyWithGuardIfNeeded<TArgs:
|
|
22
|
+
applyWithGuardIfNeeded<TArgs: ReadonlyArray<unknown>, TOut>(
|
|
23
23
|
fun: Fn<TArgs, TOut>,
|
|
24
24
|
context?: unknown,
|
|
25
25
|
args?: ?TArgs,
|
|
26
26
|
): ?TOut,
|
|
27
27
|
getGlobalHandler(): ErrorHandler,
|
|
28
|
-
guard<TArgs:
|
|
28
|
+
guard<TArgs: ReadonlyArray<unknown>, TOut>(
|
|
29
29
|
fun: Fn<TArgs, TOut>,
|
|
30
30
|
name?: ?string,
|
|
31
31
|
context?: unknown,
|
|
@@ -16,22 +16,22 @@ export interface EventSubscription {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export interface IEventEmitter<
|
|
19
|
-
TEventToArgsMap:
|
|
19
|
+
TEventToArgsMap: Readonly<Record<string, ReadonlyArray<UnsafeEventObject>>>,
|
|
20
20
|
> {
|
|
21
|
-
addListener<TEvent:
|
|
21
|
+
addListener<TEvent: keyof TEventToArgsMap>(
|
|
22
22
|
eventType: TEvent,
|
|
23
23
|
listener: (...args: TEventToArgsMap[TEvent]) => unknown,
|
|
24
24
|
context?: unknown,
|
|
25
25
|
): EventSubscription;
|
|
26
26
|
|
|
27
|
-
emit<TEvent:
|
|
27
|
+
emit<TEvent: keyof TEventToArgsMap>(
|
|
28
28
|
eventType: TEvent,
|
|
29
29
|
...args: TEventToArgsMap[TEvent]
|
|
30
30
|
): void;
|
|
31
31
|
|
|
32
|
-
removeAllListeners<TEvent:
|
|
32
|
+
removeAllListeners<TEvent: keyof TEventToArgsMap>(eventType?: ?TEvent): void;
|
|
33
33
|
|
|
34
|
-
listenerCount<TEvent:
|
|
34
|
+
listenerCount<TEvent: keyof TEventToArgsMap>(eventType: TEvent): number;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
interface Registration<TArgs> {
|
|
@@ -41,7 +41,7 @@ interface Registration<TArgs> {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
type Registry<
|
|
44
|
-
TEventToArgsMap:
|
|
44
|
+
TEventToArgsMap: Readonly<Record<string, ReadonlyArray<UnsafeEventObject>>>,
|
|
45
45
|
> = {
|
|
46
46
|
[K in keyof TEventToArgsMap]: Set<Registration<TEventToArgsMap[K]>>,
|
|
47
47
|
};
|
|
@@ -67,9 +67,9 @@ type Registry<
|
|
|
67
67
|
*
|
|
68
68
|
*/
|
|
69
69
|
export default class EventEmitter<
|
|
70
|
-
TEventToArgsMap:
|
|
71
|
-
Record<string,
|
|
72
|
-
> =
|
|
70
|
+
TEventToArgsMap: Readonly<
|
|
71
|
+
Record<string, ReadonlyArray<UnsafeEventObject>>,
|
|
72
|
+
> = Readonly<Record<string, ReadonlyArray<UnsafeEventObject>>>,
|
|
73
73
|
> implements IEventEmitter<TEventToArgsMap>
|
|
74
74
|
{
|
|
75
75
|
#registry: Registry<TEventToArgsMap>;
|
|
@@ -83,7 +83,7 @@ export default class EventEmitter<
|
|
|
83
83
|
* Registers a listener that is called when the supplied event is emitted.
|
|
84
84
|
* Returns a subscription that has a `remove` method to undo registration.
|
|
85
85
|
*/
|
|
86
|
-
addListener<TEvent:
|
|
86
|
+
addListener<TEvent: keyof TEventToArgsMap>(
|
|
87
87
|
eventType: TEvent,
|
|
88
88
|
listener: (...args: TEventToArgsMap[TEvent]) => unknown,
|
|
89
89
|
context: unknown,
|
|
@@ -95,7 +95,7 @@ export default class EventEmitter<
|
|
|
95
95
|
}
|
|
96
96
|
const registrations = allocate<
|
|
97
97
|
TEventToArgsMap,
|
|
98
|
-
|
|
98
|
+
keyof TEventToArgsMap,
|
|
99
99
|
TEventToArgsMap[TEvent],
|
|
100
100
|
>(this.#registry, eventType);
|
|
101
101
|
const registration: Registration<TEventToArgsMap[TEvent]> = {
|
|
@@ -116,7 +116,7 @@ export default class EventEmitter<
|
|
|
116
116
|
* If a listener modifies the listeners registered for the same event, those
|
|
117
117
|
* changes will not be reflected in the current invocation of `emit`.
|
|
118
118
|
*/
|
|
119
|
-
emit<TEvent:
|
|
119
|
+
emit<TEvent: keyof TEventToArgsMap>(
|
|
120
120
|
eventType: TEvent,
|
|
121
121
|
...args: TEventToArgsMap[TEvent]
|
|
122
122
|
): void {
|
|
@@ -126,7 +126,6 @@ export default class EventEmitter<
|
|
|
126
126
|
// Copy `registrations` to take a snapshot when we invoke `emit`, in case
|
|
127
127
|
// registrations are added or removed when listeners are invoked.
|
|
128
128
|
for (const registration of Array.from(registrations)) {
|
|
129
|
-
// $FlowFixMe[incompatible-type]
|
|
130
129
|
registration.listener.apply(registration.context, args);
|
|
131
130
|
}
|
|
132
131
|
}
|
|
@@ -135,9 +134,7 @@ export default class EventEmitter<
|
|
|
135
134
|
/**
|
|
136
135
|
* Removes all registered listeners.
|
|
137
136
|
*/
|
|
138
|
-
removeAllListeners<TEvent:
|
|
139
|
-
eventType?: ?TEvent,
|
|
140
|
-
): void {
|
|
137
|
+
removeAllListeners<TEvent: keyof TEventToArgsMap>(eventType?: ?TEvent): void {
|
|
141
138
|
if (eventType == null) {
|
|
142
139
|
// $FlowFixMe[incompatible-type]
|
|
143
140
|
this.#registry = {};
|
|
@@ -149,7 +146,7 @@ export default class EventEmitter<
|
|
|
149
146
|
/**
|
|
150
147
|
* Returns the number of registered listeners for the supplied event.
|
|
151
148
|
*/
|
|
152
|
-
listenerCount<TEvent:
|
|
149
|
+
listenerCount<TEvent: keyof TEventToArgsMap>(eventType: TEvent): number {
|
|
153
150
|
const registrations: ?Set<Registration<TEventToArgsMap[TEvent]>> =
|
|
154
151
|
this.#registry[eventType];
|
|
155
152
|
return registrations == null ? 0 : registrations.size;
|
|
@@ -157,9 +154,8 @@ export default class EventEmitter<
|
|
|
157
154
|
}
|
|
158
155
|
|
|
159
156
|
function allocate<
|
|
160
|
-
TEventToArgsMap:
|
|
161
|
-
TEvent:
|
|
162
|
-
TEventArgs: TEventToArgsMap[TEvent],
|
|
157
|
+
TEventToArgsMap: Readonly<Record<string, ReadonlyArray<UnsafeEventObject>>>,
|
|
158
|
+
TEvent: keyof TEventToArgsMap,
|
|
163
159
|
>(
|
|
164
160
|
registry: Registry<TEventToArgsMap>,
|
|
165
161
|
eventType: TEvent,
|
package/flow/bom.js.flow
CHANGED
|
@@ -32,31 +32,31 @@ declare interface ConsoleTask {
|
|
|
32
32
|
// $FlowExpectedError[libdef-override] Flow core definitions are incomplete.
|
|
33
33
|
declare var console: {
|
|
34
34
|
// Logging
|
|
35
|
-
log(...data:
|
|
36
|
-
trace(...data:
|
|
37
|
-
debug(...data:
|
|
38
|
-
info(...data:
|
|
39
|
-
warn(...data:
|
|
40
|
-
error(...data:
|
|
35
|
+
log(...data: ReadonlyArray<unknown>): void,
|
|
36
|
+
trace(...data: ReadonlyArray<unknown>): void,
|
|
37
|
+
debug(...data: ReadonlyArray<unknown>): void,
|
|
38
|
+
info(...data: ReadonlyArray<unknown>): void,
|
|
39
|
+
warn(...data: ReadonlyArray<unknown>): void,
|
|
40
|
+
error(...data: ReadonlyArray<unknown>): void,
|
|
41
41
|
|
|
42
42
|
// Grouping
|
|
43
|
-
group(...data:
|
|
44
|
-
groupCollapsed(...data:
|
|
43
|
+
group(...data: ReadonlyArray<unknown>): void,
|
|
44
|
+
groupCollapsed(...data: ReadonlyArray<unknown>): void,
|
|
45
45
|
groupEnd(): void,
|
|
46
46
|
|
|
47
47
|
// Printing
|
|
48
48
|
table(
|
|
49
49
|
tabularData:
|
|
50
|
-
|
|
|
51
|
-
|
|
|
52
|
-
|
|
|
50
|
+
| Readonly<{[key: string]: unknown, ...}>
|
|
51
|
+
| ReadonlyArray<Readonly<{[key: string]: unknown, ...}>>
|
|
52
|
+
| ReadonlyArray<ReadonlyArray<unknown>>,
|
|
53
53
|
): void,
|
|
54
|
-
dir(...data:
|
|
55
|
-
dirxml(...data:
|
|
54
|
+
dir(...data: ReadonlyArray<unknown>): void,
|
|
55
|
+
dirxml(...data: ReadonlyArray<unknown>): void,
|
|
56
56
|
clear(): void,
|
|
57
57
|
|
|
58
58
|
// Utilities
|
|
59
|
-
assert(condition: unknown, ...data:
|
|
59
|
+
assert(condition: unknown, ...data: ReadonlyArray<unknown>): void,
|
|
60
60
|
|
|
61
61
|
// Profiling
|
|
62
62
|
profile(name?: string): void,
|
|
@@ -172,7 +172,7 @@ declare class TaskAttributionTiming extends PerformanceEntry {
|
|
|
172
172
|
|
|
173
173
|
// https://w3c.github.io/longtasks/#sec-PerformanceLongTaskTiming
|
|
174
174
|
declare class PerformanceLongTaskTiming extends PerformanceEntry {
|
|
175
|
-
attribution:
|
|
175
|
+
attribution: ReadonlyArray<TaskAttributionTiming>;
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
// https://www.w3.org/TR/user-timing/#extensions-performance-interface
|
|
@@ -609,12 +609,13 @@ declare class AbortController {
|
|
|
609
609
|
}
|
|
610
610
|
|
|
611
611
|
declare class AbortSignal extends EventTarget {
|
|
612
|
-
abort(reason?: $FlowFixMe): AbortSignal;
|
|
612
|
+
static abort(reason?: $FlowFixMe): AbortSignal;
|
|
613
|
+
static any(signals: Iterable<AbortSignal>): AbortSignal;
|
|
613
614
|
+aborted: boolean;
|
|
614
615
|
onabort: (event: Event) => unknown;
|
|
615
616
|
+reason: $FlowFixMe;
|
|
616
617
|
throwIfAborted(): void;
|
|
617
|
-
timeout(time: number): AbortSignal;
|
|
618
|
+
static timeout(time: number): AbortSignal;
|
|
618
619
|
}
|
|
619
620
|
|
|
620
621
|
declare function fetch(
|
package/flow/dom.js.flow
CHANGED
|
@@ -58,7 +58,7 @@ declare type FilePropertyBag = {
|
|
|
58
58
|
};
|
|
59
59
|
declare class File extends Blob {
|
|
60
60
|
constructor(
|
|
61
|
-
fileBits:
|
|
61
|
+
fileBits: ReadonlyArray<string | BufferDataSource | Blob>,
|
|
62
62
|
filename: string,
|
|
63
63
|
options?: FilePropertyBag,
|
|
64
64
|
): void;
|
|
@@ -1216,7 +1216,7 @@ type ClipboardItemOptions = {
|
|
|
1216
1216
|
};
|
|
1217
1217
|
|
|
1218
1218
|
declare class ClipboardItem {
|
|
1219
|
-
+types:
|
|
1219
|
+
+types: ReadonlyArray<string>;
|
|
1220
1220
|
getType(type: string): Promise<Blob>;
|
|
1221
1221
|
constructor(
|
|
1222
1222
|
items: {[type: string]: ClipboardItemData},
|
|
@@ -1315,7 +1315,7 @@ declare class Node extends EventTarget {
|
|
|
1315
1315
|
normalize(): void;
|
|
1316
1316
|
removeChild<T: Node>(oldChild: T): T;
|
|
1317
1317
|
replaceChild<T: Node>(newChild: Node, oldChild: T): T;
|
|
1318
|
-
replaceChildren(...nodes:
|
|
1318
|
+
replaceChildren(...nodes: ReadonlyArray<Node | string>): void;
|
|
1319
1319
|
static ATTRIBUTE_NODE: number;
|
|
1320
1320
|
static CDATA_SECTION_NODE: number;
|
|
1321
1321
|
static COMMENT_NODE: number;
|
|
@@ -3797,7 +3797,7 @@ declare class CanvasRenderingContext2D {
|
|
|
3797
3797
|
y: number,
|
|
3798
3798
|
w: number,
|
|
3799
3799
|
h: number,
|
|
3800
|
-
radii?: number | DOMPointInit |
|
|
3800
|
+
radii?: number | DOMPointInit | ReadonlyArray<number | DOMPointInit>,
|
|
3801
3801
|
): void;
|
|
3802
3802
|
strokeRect(x: number, y: number, w: number, h: number): void;
|
|
3803
3803
|
|
|
@@ -5948,12 +5948,19 @@ declare class Comment extends CharacterData {
|
|
|
5948
5948
|
text: string;
|
|
5949
5949
|
}
|
|
5950
5950
|
|
|
5951
|
+
interface StringLike {
|
|
5952
|
+
toString(): string;
|
|
5953
|
+
}
|
|
5954
|
+
|
|
5951
5955
|
declare class URL {
|
|
5952
5956
|
static canParse(url: string, base?: string): boolean;
|
|
5953
5957
|
static createObjectURL(blob: Blob): string;
|
|
5954
5958
|
static createObjectURL(mediaSource: MediaSource): string;
|
|
5955
5959
|
static revokeObjectURL(url: string): void;
|
|
5956
|
-
constructor(
|
|
5960
|
+
constructor(
|
|
5961
|
+
url: string | URL | StringLike,
|
|
5962
|
+
base?: string | URL | StringLike,
|
|
5963
|
+
): void;
|
|
5957
5964
|
hash: string;
|
|
5958
5965
|
host: string;
|
|
5959
5966
|
hostname: string;
|
package/flow/global.js
CHANGED
package/index.js
CHANGED
|
@@ -42,6 +42,9 @@ module.exports = {
|
|
|
42
42
|
return require('./Libraries/Components/DrawerAndroid/DrawerLayoutAndroid')
|
|
43
43
|
.default;
|
|
44
44
|
},
|
|
45
|
+
get EventEmitter() {
|
|
46
|
+
return require('./Libraries/vendor/emitter/EventEmitter').default;
|
|
47
|
+
},
|
|
45
48
|
get FlatList() {
|
|
46
49
|
return require('./Libraries/Lists/FlatList').default;
|
|
47
50
|
},
|
|
@@ -338,6 +341,12 @@ module.exports = {
|
|
|
338
341
|
get useAnimatedValue() {
|
|
339
342
|
return require('./Libraries/Animated/useAnimatedValue').default;
|
|
340
343
|
},
|
|
344
|
+
get useAnimatedValueXY() {
|
|
345
|
+
return require('./Libraries/Animated/useAnimatedValueXY').default;
|
|
346
|
+
},
|
|
347
|
+
get useAnimatedColor() {
|
|
348
|
+
return require('./Libraries/Animated/useAnimatedColor').default;
|
|
349
|
+
},
|
|
341
350
|
get useColorScheme() {
|
|
342
351
|
return require('./Libraries/Utilities/useColorScheme').default;
|
|
343
352
|
},
|
package/index.win32.js
CHANGED
|
@@ -42,6 +42,9 @@ module.exports = {
|
|
|
42
42
|
return require('./Libraries/Components/DrawerAndroid/DrawerLayoutAndroid')
|
|
43
43
|
.default;
|
|
44
44
|
},
|
|
45
|
+
get EventEmitter() {
|
|
46
|
+
return require('./Libraries/vendor/emitter/EventEmitter').default;
|
|
47
|
+
},
|
|
45
48
|
get FlatList() {
|
|
46
49
|
return require('./Libraries/Lists/FlatList').default;
|
|
47
50
|
},
|
|
@@ -341,6 +344,12 @@ module.exports = {
|
|
|
341
344
|
get useAnimatedValue() {
|
|
342
345
|
return require('./Libraries/Animated/useAnimatedValue').default;
|
|
343
346
|
},
|
|
347
|
+
get useAnimatedValueXY() {
|
|
348
|
+
return require('./Libraries/Animated/useAnimatedValueXY').default;
|
|
349
|
+
},
|
|
350
|
+
get useAnimatedColor() {
|
|
351
|
+
return require('./Libraries/Animated/useAnimatedColor').default;
|
|
352
|
+
},
|
|
344
353
|
get useColorScheme() {
|
|
345
354
|
return require('./Libraries/Utilities/useColorScheme').default;
|
|
346
355
|
},
|
package/index.win32.js.flow
CHANGED
|
@@ -324,7 +324,6 @@ export * as NativeComponentRegistry from './Libraries/NativeComponent/NativeComp
|
|
|
324
324
|
export {default as NativeDialogManagerAndroid} from './Libraries/NativeModules/specs/NativeDialogManagerAndroid';
|
|
325
325
|
|
|
326
326
|
export type {
|
|
327
|
-
EventSubscription,
|
|
328
327
|
EmitterSubscription,
|
|
329
328
|
NativeEventSubscription,
|
|
330
329
|
} from './Libraries/EventEmitter/NativeEventEmitter';
|
|
@@ -412,6 +411,8 @@ export * as TurboModuleRegistry from './Libraries/TurboModule/TurboModuleRegistr
|
|
|
412
411
|
export {default as UIManager} from './Libraries/ReactNative/UIManager';
|
|
413
412
|
export {unstable_batchedUpdates} from './Libraries/ReactNative/RendererProxy';
|
|
414
413
|
export {default as useAnimatedValue} from './Libraries/Animated/useAnimatedValue';
|
|
414
|
+
export {default as useAnimatedValueXY} from './Libraries/Animated/useAnimatedValueXY';
|
|
415
|
+
export {default as useAnimatedColor} from './Libraries/Animated/useAnimatedColor';
|
|
415
416
|
export type {
|
|
416
417
|
PressabilityConfig,
|
|
417
418
|
EventHandlers as PressabilityEventHandlers,
|
|
@@ -467,6 +468,12 @@ export type {
|
|
|
467
468
|
PublicTextInstance,
|
|
468
469
|
} from './Libraries/ReactPrivate/ReactNativePrivateInterface';
|
|
469
470
|
|
|
471
|
+
export type {
|
|
472
|
+
EventSubscription,
|
|
473
|
+
IEventEmitter,
|
|
474
|
+
} from './Libraries/vendor/emitter/EventEmitter';
|
|
475
|
+
export {default as EventEmitter} from './Libraries/vendor/emitter/EventEmitter';
|
|
476
|
+
|
|
470
477
|
export {
|
|
471
478
|
default as unstable_VirtualView,
|
|
472
479
|
VirtualViewMode,
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
import type {HostComponent} from '
|
|
13
|
+
import type {HostComponent} from 'react-native/src/private/types/HostComponent';
|
|
14
14
|
|
|
15
|
-
import requireNativeComponent from '../Libraries/ReactNative/requireNativeComponent';
|
|
16
15
|
import * as React from 'react';
|
|
16
|
+
import requireNativeComponent from 'react-native/Libraries/ReactNative/requireNativeComponent';
|
|
17
17
|
|
|
18
18
|
const RCTRefreshControl: HostComponent<{}> = requireNativeComponent<{}>(
|
|
19
19
|
'RCTRefreshControl',
|
|
@@ -16,6 +16,13 @@ const createCacheKeyFunction =
|
|
|
16
16
|
require('@jest/create-cache-key-function').default;
|
|
17
17
|
const path = require('path');
|
|
18
18
|
|
|
19
|
+
// NOTE: This file used to be at `react-native/jest/assetFileTransformer.js`
|
|
20
|
+
// To keep the mock `testUri` paths the same, we create a fake path that outputs the same relative path as before
|
|
21
|
+
const basePath = path.resolve(
|
|
22
|
+
require.resolve('react-native/package.json'),
|
|
23
|
+
'../jest/',
|
|
24
|
+
);
|
|
25
|
+
|
|
19
26
|
module.exports = {
|
|
20
27
|
// Mocks asset requires to return the filename. Makes it possible to test that
|
|
21
28
|
// the correct images are loaded for components. Essentially
|
|
@@ -24,9 +31,7 @@ module.exports = {
|
|
|
24
31
|
process: (_, filename) => ({
|
|
25
32
|
code: `module.exports = {
|
|
26
33
|
testUri:
|
|
27
|
-
${JSON.stringify(
|
|
28
|
-
path.relative(__dirname, filename).replace(/\\/g, '/'),
|
|
29
|
-
)}
|
|
34
|
+
${JSON.stringify(path.relative(basePath, filename).replace(/\\/g, '/'))}
|
|
30
35
|
};`,
|
|
31
36
|
}),
|
|
32
37
|
getCacheKey: createCacheKeyFunction([__filename]),
|
package/jest/mockComponent.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
import * as React from 'react';
|
|
12
12
|
import {createElement} from 'react';
|
|
13
13
|
|
|
14
|
-
type Modulish<T> = T |
|
|
14
|
+
type Modulish<T> = T | Readonly<{default: T}>;
|
|
15
15
|
type ModuleDefault<T> = T['default'];
|
|
16
16
|
|
|
17
17
|
type TComponentType = React.ComponentType<{...}>;
|
|
@@ -27,9 +27,8 @@ export default function mockComponent<
|
|
|
27
27
|
moduleName: string,
|
|
28
28
|
instanceMethods: ?interface {},
|
|
29
29
|
isESModule: TIsESModule,
|
|
30
|
-
): TIsESModule extends true
|
|
31
|
-
?
|
|
32
|
-
ModuleDefault<TComponentModule & typeof instanceMethods>
|
|
30
|
+
): TIsESModule extends true // $FlowFixMe[incompatible-use]
|
|
31
|
+
? ModuleDefault<TComponentModule & typeof instanceMethods>
|
|
33
32
|
: TComponentModule & typeof instanceMethods {
|
|
34
33
|
const RealComponent: TComponentType = isESModule
|
|
35
34
|
? // $FlowFixMe[prop-missing]
|
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import typeof TActivityIndicator from '../../Libraries/Components/ActivityIndicator/ActivityIndicator';
|
|
12
11
|
import typeof * as TmockComponent from '../mockComponent';
|
|
12
|
+
import typeof TActivityIndicator from 'react-native/Libraries/Components/ActivityIndicator/ActivityIndicator';
|
|
13
13
|
|
|
14
14
|
const mockComponent =
|
|
15
15
|
jest.requireActual<TmockComponent>('../mockComponent').default;
|
|
16
16
|
|
|
17
17
|
const ActivityIndicator = mockComponent(
|
|
18
|
-
'
|
|
18
|
+
'react-native/Libraries/Components/ActivityIndicator/ActivityIndicator',
|
|
19
19
|
null, // instanceMethods
|
|
20
20
|
true, // isESModule
|
|
21
21
|
) as TActivityIndicator;
|
package/jest/mocks/Image.js
CHANGED
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import typeof TImage from '../../Libraries/Image/Image';
|
|
12
11
|
import typeof * as TmockComponent from '../mockComponent';
|
|
12
|
+
import typeof TImage from 'react-native/Libraries/Image/Image';
|
|
13
13
|
|
|
14
14
|
const mockComponent =
|
|
15
15
|
jest.requireActual<TmockComponent>('../mockComponent').default;
|
|
16
16
|
|
|
17
17
|
const Image = mockComponent(
|
|
18
|
-
'
|
|
18
|
+
'react-native/Libraries/Image/Image',
|
|
19
19
|
null, // instanceMethods
|
|
20
20
|
true, // isESModule
|
|
21
21
|
) as TImage;
|
package/jest/mocks/Modal.js
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type {ModalProps} from '../../Libraries/Modal/Modal';
|
|
12
11
|
import typeof * as TmockComponent from '../mockComponent';
|
|
12
|
+
import type {ModalProps} from 'react-native/Libraries/Modal/Modal';
|
|
13
13
|
|
|
14
14
|
const mockComponent =
|
|
15
15
|
jest.requireActual<TmockComponent>('../mockComponent').default;
|
|
@@ -17,7 +17,7 @@ const mockComponent =
|
|
|
17
17
|
type TModal = component(...ModalProps);
|
|
18
18
|
|
|
19
19
|
const BaseComponent = mockComponent(
|
|
20
|
-
'
|
|
20
|
+
'react-native/Libraries/Modal/Modal',
|
|
21
21
|
null, // instanceMethods
|
|
22
22
|
true, // isESModule
|
|
23
23
|
) as TModal;
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type {RefreshControlProps} from '
|
|
12
|
-
import type {HostComponent} from '
|
|
11
|
+
import type {RefreshControlProps} from 'react-native/Libraries/Components/RefreshControl/RefreshControl';
|
|
12
|
+
import type {HostComponent} from 'react-native/src/private/types/HostComponent';
|
|
13
13
|
|
|
14
|
-
import requireNativeComponent from '../../Libraries/ReactNative/requireNativeComponent';
|
|
15
14
|
import * as React from 'react';
|
|
15
|
+
import requireNativeComponent from 'react-native/Libraries/ReactNative/requireNativeComponent';
|
|
16
16
|
|
|
17
17
|
const RCTRefreshControl: HostComponent<{}> = requireNativeComponent<{}>(
|
|
18
18
|
'RCTRefreshControl',
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
// In tests, we can use the default version without dependency injection.
|
|
12
12
|
|
|
13
|
-
import typeof * as TRendererImplementation from '
|
|
13
|
+
import typeof * as TRendererImplementation from 'react-native/Libraries/ReactNative/RendererImplementation';
|
|
14
14
|
|
|
15
15
|
const {
|
|
16
16
|
dispatchCommand,
|
|
@@ -26,7 +26,7 @@ const {
|
|
|
26
26
|
unmountComponentAtNodeAndRemoveContainer,
|
|
27
27
|
unstable_batchedUpdates,
|
|
28
28
|
} = jest.requireActual<TRendererImplementation>(
|
|
29
|
-
'
|
|
29
|
+
'react-native/Libraries/ReactNative/RendererImplementation',
|
|
30
30
|
) as TRendererImplementation;
|
|
31
31
|
|
|
32
32
|
export {
|
package/jest/mocks/ScrollView.js
CHANGED
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import typeof TScrollView from '../../Libraries/Components/ScrollView/ScrollView';
|
|
12
|
-
import type {ScrollViewNativeProps} from '../../Libraries/Components/ScrollView/ScrollViewNativeComponentType';
|
|
13
11
|
import typeof * as TmockComponent from '../mockComponent';
|
|
14
12
|
import typeof * as TMockNativeMethods from '../MockNativeMethods';
|
|
13
|
+
import typeof TScrollView from 'react-native/Libraries/Components/ScrollView/ScrollView';
|
|
14
|
+
import type {ScrollViewNativeProps} from 'react-native/Libraries/Components/ScrollView/ScrollViewNativeComponentType';
|
|
15
15
|
|
|
16
|
-
import View from '../../Libraries/Components/View/View';
|
|
17
|
-
import requireNativeComponent from '../../Libraries/ReactNative/requireNativeComponent';
|
|
18
16
|
import * as React from 'react';
|
|
17
|
+
import View from 'react-native/Libraries/Components/View/View';
|
|
18
|
+
import requireNativeComponent from 'react-native/Libraries/ReactNative/requireNativeComponent';
|
|
19
19
|
|
|
20
20
|
const mockComponent =
|
|
21
21
|
jest.requireActual<TmockComponent>('../mockComponent').default;
|
|
@@ -27,7 +27,7 @@ const RCTScrollView =
|
|
|
27
27
|
requireNativeComponent<ScrollViewNativeProps>('RCTScrollView');
|
|
28
28
|
|
|
29
29
|
const BaseComponent = mockComponent(
|
|
30
|
-
'
|
|
30
|
+
'react-native/Libraries/Components/ScrollView/ScrollView',
|
|
31
31
|
{
|
|
32
32
|
...MockNativeMethods,
|
|
33
33
|
getScrollResponder: jest.fn(),
|
package/jest/mocks/Text.js
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import typeof TText from '../../Libraries/Text/Text';
|
|
12
11
|
import typeof * as TmockComponent from '../mockComponent';
|
|
13
12
|
import typeof * as TMockNativeMethods from '../MockNativeMethods';
|
|
13
|
+
import typeof TText from 'react-native/Libraries/Text/Text';
|
|
14
14
|
|
|
15
15
|
const mockComponent =
|
|
16
16
|
jest.requireActual<TmockComponent>('../mockComponent').default;
|
|
@@ -19,7 +19,7 @@ const MockNativeMethods = jest.requireActual<TMockNativeMethods>(
|
|
|
19
19
|
).default;
|
|
20
20
|
|
|
21
21
|
const Text = mockComponent(
|
|
22
|
-
'
|
|
22
|
+
'react-native/Libraries/Text/Text',
|
|
23
23
|
MockNativeMethods, // instanceMethods
|
|
24
24
|
true, // isESModule
|
|
25
25
|
) as TText;
|
package/jest/mocks/TextInput.js
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import typeof TTextInput from '../../Libraries/Components/TextInput/TextInput';
|
|
12
11
|
import typeof * as TmockComponent from '../mockComponent';
|
|
13
12
|
import typeof * as TMockNativeMethods from '../MockNativeMethods';
|
|
13
|
+
import typeof TTextInput from 'react-native/Libraries/Components/TextInput/TextInput';
|
|
14
14
|
|
|
15
15
|
const mockComponent =
|
|
16
16
|
jest.requireActual<TmockComponent>('../mockComponent').default;
|
|
@@ -19,7 +19,7 @@ const MockNativeMethods = jest.requireActual<TMockNativeMethods>(
|
|
|
19
19
|
).default;
|
|
20
20
|
|
|
21
21
|
const TextInput = mockComponent(
|
|
22
|
-
'
|
|
22
|
+
'react-native/Libraries/Components/TextInput/TextInput',
|
|
23
23
|
{
|
|
24
24
|
...MockNativeMethods,
|
|
25
25
|
isFocused: jest.fn(),
|