@office-iss/react-native-win32 0.79.0-preview.2 → 0.80.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/.flowconfig +10 -3
- package/CHANGELOG.json +120 -12
- package/CHANGELOG.md +50 -7
- package/IntegrationTests/ImageCachePolicyTest.js +1 -1
- package/IntegrationTests/LayoutEventsTest.js +1 -4
- package/Libraries/Alert/Alert.d.ts +4 -1
- package/Libraries/Alert/Alert.js +3 -0
- package/Libraries/Alert/RCTAlertManager.js +17 -0
- package/Libraries/Animated/Animated.js.flow +1 -3
- package/Libraries/Animated/AnimatedEvent.js +4 -3
- package/Libraries/Animated/AnimatedExports.js +2 -2
- package/Libraries/Animated/AnimatedExports.js.flow +140 -0
- package/Libraries/Animated/AnimatedImplementation.js +2 -123
- package/Libraries/Animated/Easing.js +13 -15
- package/Libraries/Animated/animations/Animation.js +8 -4
- package/Libraries/Animated/components/AnimatedFlatList.js +7 -6
- package/Libraries/Animated/components/AnimatedScrollView.js +48 -42
- package/Libraries/Animated/components/AnimatedSectionList.js +11 -7
- package/Libraries/Animated/createAnimatedComponent.js +105 -57
- package/Libraries/Animated/nodes/AnimatedNode.js +4 -3
- package/Libraries/Animated/nodes/AnimatedProps.js +46 -26
- package/Libraries/Animated/nodes/AnimatedValue.js +16 -7
- package/Libraries/Animated/nodes/AnimatedValueXY.js +3 -1
- package/Libraries/AppState/AppState.js +7 -2
- package/Libraries/BatchedBridge/MessageQueue.js +2 -2
- package/Libraries/BatchedBridge/NativeModules.js +2 -0
- package/Libraries/Blob/BlobManager.js +1 -0
- package/Libraries/Blob/FileReader.js +219 -8
- package/Libraries/Blob/URL.js +37 -12
- package/Libraries/Blob/URLSearchParams.js +106 -31
- package/Libraries/Blob/URLSearchParams.js.flow +12 -7
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +1 -1
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +1 -1
- package/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.js +17 -0
- package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +1 -0
- package/Libraries/Components/Button.js +1 -1
- package/Libraries/Components/Button.win32.js +1 -1
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +1 -3
- package/Libraries/{NewAppScreen/components/Colors.js → Components/DrawerAndroid/DrawerLayoutAndroid.ios.js} +6 -10
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +6 -66
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js.flow +18 -0
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidFallback.js +71 -0
- package/Libraries/Components/Keyboard/Keyboard.js +5 -3
- package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +6 -3
- package/Libraries/Components/Pressable/Pressable.js +20 -4
- package/Libraries/Components/Pressable/Pressable.win32.js +20 -4
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js +25 -3
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidTypes.js +29 -20
- package/Libraries/Components/RefreshControl/RefreshControl.js +1 -1
- package/Libraries/Components/ScrollView/ScrollView.d.ts +3 -3
- package/Libraries/Components/ScrollView/ScrollView.js +132 -122
- package/Libraries/Components/StaticRenderer.js +1 -1
- package/Libraries/Components/Switch/Switch.d.ts +3 -0
- package/Libraries/Components/Switch/Switch.js +8 -4
- package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +2 -1
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +2 -4
- package/Libraries/Components/TextInput/Tests/TextInputTest.d.ts +2 -1
- package/Libraries/Components/TextInput/Tests/TextInputTest.js.map +1 -1
- package/Libraries/Components/TextInput/TextInput.d.ts +70 -33
- package/Libraries/Components/TextInput/TextInput.flow.js +100 -51
- package/Libraries/Components/TextInput/TextInput.flow.win32.js +1208 -0
- package/Libraries/Components/TextInput/TextInput.js +88 -1027
- package/Libraries/Components/TextInput/TextInput.win32.js +89 -1059
- package/Libraries/Components/TextInput/TextInputState.js +1 -1
- package/Libraries/Components/TextInput/TextInputState.win32.js +1 -1
- package/Libraries/{Modal/ModalInjection.js → Components/ToastAndroid/ToastAndroid.ios.js} +3 -5
- package/Libraries/Components/ToastAndroid/ToastAndroid.js +4 -32
- package/Libraries/Components/ToastAndroid/ToastAndroid.js.flow +109 -0
- package/Libraries/Components/ToastAndroid/ToastAndroid.win32.js +4 -32
- package/Libraries/Components/ToastAndroid/ToastAndroidFallback.js +45 -0
- package/Libraries/Components/Touchable/Tests/TouchableWin32Test.d.ts +2 -1
- package/Libraries/Components/Touchable/Tests/TouchableWin32Test.js.map +1 -1
- package/Libraries/Components/Touchable/Touchable.js +5 -5
- package/Libraries/Components/Touchable/Touchable.win32.js +5 -5
- package/Libraries/Components/Touchable/TouchableBounce.js +14 -7
- package/Libraries/Components/Touchable/TouchableHighlight.js +10 -7
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +6 -6
- package/Libraries/Components/Touchable/TouchableNativeFeedback.win32.js +6 -6
- package/Libraries/Components/Touchable/TouchableOpacity.js +13 -6
- package/Libraries/Components/View/View.js +18 -21
- package/Libraries/Components/View/View.win32.js +21 -24
- package/Libraries/Components/View/ViewAccessibility.js +25 -1
- package/Libraries/Components/View/ViewAccessibility.win32.js +9 -1
- package/Libraries/Components/View/ViewPropTypes.js +49 -3
- package/Libraries/Components/View/ViewPropTypes.win32.js +49 -3
- package/Libraries/Core/ReactNativeVersion.js +2 -2
- package/Libraries/Core/setUpReactDevTools.js +5 -5
- package/Libraries/Debugging/DebuggingOverlayRegistry.js +3 -3
- package/Libraries/EventEmitter/NativeEventEmitter.js +9 -4
- package/Libraries/Image/AssetSourceResolver.js +17 -4
- package/Libraries/Image/Image.d.ts +26 -10
- package/Libraries/Image/Image.js +17 -0
- package/Libraries/Image/Image.js.flow +5 -5
- package/Libraries/Image/ImageBackground.js +2 -0
- package/Libraries/Image/ImageInjection.js +1 -1
- package/Libraries/Image/ImageProps.js +22 -17
- package/Libraries/Image/ImageSource.js +3 -1
- package/Libraries/Image/ImageSourceUtils.js +4 -2
- package/Libraries/Image/ImageTypes.flow.js +1 -1
- package/Libraries/Image/Tests/ImageWin32Test.d.ts +2 -1
- package/Libraries/Image/Tests/ImageWin32Test.js.map +1 -1
- package/Libraries/Interaction/InteractionManager.d.ts +13 -0
- package/Libraries/Interaction/InteractionManager.js +1 -1
- package/Libraries/Interaction/PanResponder.js +3 -3
- package/Libraries/Interaction/TaskQueue.js +1 -0
- package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -2
- package/Libraries/Linking/Linking.js +1 -1
- package/Libraries/Lists/FlatList.d.ts +2 -2
- package/Libraries/Lists/FlatList.js +8 -11
- package/Libraries/Lists/SectionList.js +39 -42
- package/Libraries/Lists/SectionListModern.js +25 -34
- package/Libraries/Lists/VirtualizedList.js +1 -0
- package/Libraries/Lists/VirtualizedSectionList.js +1 -0
- package/Libraries/LogBox/Data/LogBoxData.js +1 -1
- package/Libraries/LogBox/LogBoxNotificationContainer.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.win32.js +140 -0
- package/Libraries/Modal/Modal.js +33 -7
- package/Libraries/NativeComponent/BaseViewConfig.android.js +2 -0
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +2 -0
- package/Libraries/NativeComponent/BaseViewConfig.js +17 -0
- package/Libraries/NativeComponent/BaseViewConfig.win32.js +1 -0
- package/Libraries/NativeComponent/PlatformBaseViewConfig.js +2 -2
- package/Libraries/NativeModules/specs/NativeDevMenu.js +2 -2
- package/Libraries/Network/RCTNetworking.android.js +1 -1
- package/Libraries/Network/RCTNetworking.ios.js +1 -1
- package/Libraries/Network/RCTNetworking.js +17 -0
- package/Libraries/Network/RCTNetworking.js.flow +1 -1
- package/Libraries/Network/RCTNetworking.win32.js +1 -1
- package/Libraries/Network/XMLHttpRequest.js +781 -10
- package/Libraries/Performance/Systrace.js +7 -7
- package/Libraries/Pressability/Pressability.js +1 -1
- package/Libraries/Pressability/Pressability.win32.js +1 -1
- package/Libraries/ReactNative/AppContainer-dev.js +5 -4
- package/Libraries/ReactNative/AppRegistry.flow.js +49 -0
- package/Libraries/ReactNative/AppRegistry.js +2 -322
- package/Libraries/ReactNative/AppRegistry.js.flow +23 -0
- package/Libraries/ReactNative/AppRegistryImpl.js +316 -0
- package/Libraries/ReactNative/FabricUIManager.js +10 -0
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +2 -4
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +1 -4
- package/Libraries/ReactNative/RendererImplementation.js +10 -5
- package/Libraries/ReactNative/getNativeComponentAttributes.js +1 -0
- package/Libraries/ReactNative/renderApplication.js +9 -0
- package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +3 -3
- package/Libraries/ReactPrivate/ReactNativePrivateInterface.js.flow +51 -0
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +4840 -4748
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +4947 -4829
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +3998 -3888
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +5005 -4948
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +2744 -2652
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +5020 -4933
- package/Libraries/Renderer/shims/ReactNativeTypes.js +3 -3
- package/Libraries/Settings/Settings.ios.js +1 -0
- package/Libraries/Settings/Settings.js +13 -19
- package/Libraries/Settings/Settings.win32.js +19 -20
- package/Libraries/Settings/SettingsFallback.js +33 -0
- package/Libraries/StyleSheet/PlatformColorValueTypes.js +15 -0
- package/Libraries/StyleSheet/PlatformColorValueTypesIOS.js +6 -0
- package/Libraries/StyleSheet/Rect.js +1 -0
- package/Libraries/StyleSheet/StyleSheet.js +31 -200
- package/Libraries/StyleSheet/StyleSheet.js.flow +188 -0
- package/Libraries/StyleSheet/{StyleSheet.win32.js → StyleSheetExports.js} +2 -151
- package/Libraries/StyleSheet/StyleSheetExports.js.flow +112 -0
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +1 -1
- package/Libraries/StyleSheet/StyleSheetTypes.js +130 -52
- package/Libraries/StyleSheet/flattenStyle.js +14 -4
- package/Libraries/StyleSheet/private/_TransformStyle.js +49 -21
- package/Libraries/StyleSheet/processBackgroundImage.js +670 -214
- package/Libraries/Text/Text.d.ts +2 -5
- package/Libraries/Text/Text.js +3 -3
- package/Libraries/Text/Text.win32.js +3 -3
- package/Libraries/Text/TextNativeComponent.js +0 -4
- package/Libraries/Text/TextNativeComponent.win32.js +0 -4
- package/Libraries/Text/TextProps.js +5 -33
- package/Libraries/Text/TextProps.win32.js +5 -30
- package/Libraries/Types/CodegenTypesNamespace.d.ts +45 -0
- package/Libraries/{Blob/__mocks__/BlobModule.js → Types/CodegenTypesNamespace.js} +4 -6
- package/Libraries/Types/CoreEventTypes.d.ts +6 -1
- package/Libraries/Types/CoreEventTypes.js +1 -1
- package/Libraries/Types/CoreEventTypes.win32.js +1 -1
- package/Libraries/Utilities/Appearance.js +2 -0
- package/Libraries/Utilities/BackHandler.js +17 -0
- package/Libraries/Utilities/DeviceInfo.js +2 -0
- package/Libraries/Utilities/Dimensions.js +1 -1
- package/Libraries/Utilities/Dimensions.win32.js +1 -1
- package/Libraries/Utilities/Platform.js +17 -0
- package/Libraries/Utilities/PlatformTypes.js +11 -3
- package/Libraries/Utilities/ReactNativeTestTools.js +2 -2
- package/Libraries/Utilities/codegenNativeCommands.d.ts +18 -0
- package/Libraries/Utilities/codegenNativeComponent.d.ts +26 -0
- package/Libraries/WebSocket/WebSocket.js +313 -8
- package/Libraries/vendor/core/ErrorUtils.js +28 -2
- package/Libraries/vendor/emitter/EventEmitter.js +6 -2
- package/flow/global.js +1 -0
- package/index.js +51 -331
- package/index.win32.js +71 -352
- package/interface.js +0 -4
- package/jest/resolver.js +31 -0
- package/overrides.json +45 -47
- package/package.json +24 -24
- package/src/private/animated/NativeAnimatedHelper.js +21 -8
- package/src/private/animated/NativeAnimatedHelper.win32.js +21 -8
- package/src/private/animated/createAnimatedPropsHook.js +11 -16
- package/src/private/animated/createAnimatedPropsMemoHook.js +1 -2
- package/src/private/components/{SafeAreaView_INTERNAL_DO_NOT_USE.js → safeareaview/SafeAreaView_INTERNAL_DO_NOT_USE.js} +6 -6
- package/src/private/components/{HScrollViewNativeComponents.js → scrollview/HScrollViewNativeComponents.js} +8 -8
- package/src/private/components/scrollview/VScrollViewNativeComponents.js +25 -0
- package/src/private/{devmenu → devsupport/devmenu}/DevMenu.js +1 -1
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/BorderBox.js +3 -3
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/BoxInspector.js +6 -5
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/ElementBox.js +8 -6
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/ElementProperties.js +11 -10
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/Inspector.js +14 -12
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/InspectorOverlay.js +5 -4
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/InspectorPanel.js +9 -8
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/NetworkOverlay.js +10 -9
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/ReactDevToolsOverlay.js +7 -7
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/StyleInspector.js +7 -6
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/XHRInterceptor.js +2 -2
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/getInspectorDataForViewAtPoint.js +4 -4
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/resolveBoxStyle.js +1 -1
- package/src/private/{inspector → devsupport/devmenu/perfmonitor}/PerformanceOverlay.js +6 -5
- package/src/private/{specs_DEPRECATED/modules → devsupport/devmenu/specs}/NativeDevMenu.js +2 -2
- package/src/private/{debugging → devsupport/rndevtools}/ReactDevToolsSettingsManager.android.js +1 -1
- package/src/private/{debugging → devsupport/rndevtools}/ReactDevToolsSettingsManager.ios.js +1 -1
- package/src/private/{debugging → devsupport/rndevtools}/ReactDevToolsSettingsManager.win32.js +1 -1
- package/src/private/{debugging → devsupport/rndevtools}/setUpFuseboxReactDevToolsDispatcher.js +1 -1
- package/src/private/{fusebox → devsupport/rndevtools}/specs/NativeReactDevToolsRuntimeSettingsModule.js +2 -2
- package/src/private/{specs_DEPRECATED/modules → devsupport/rndevtools/specs}/NativeReactDevToolsSettingsManager.js +2 -2
- package/src/private/featureflags/ReactNativeFeatureFlags.js +82 -80
- package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +9 -1
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +17 -13
- package/src/private/renderer/errorhandling/ErrorHandlers.js +2 -2
- package/src/private/specs_DEPRECATED/modules/NativeAnimatedModule.js +1 -1
- package/src/private/specs_DEPRECATED/modules/NativeAnimatedTurboModule.js +1 -1
- package/src/private/specs_DEPRECATED/modules/NativeSampleTurboModule.js +3 -0
- package/src/private/styles/composeStyles.js +12 -5
- package/src/private/types/HostComponent.js +1 -1
- package/src/private/types/HostInstance.js +67 -1
- package/src/private/webapis/dom/nodes/ReactNativeElement.js +2 -5
- package/src/private/webapis/dom/nodes/ReadOnlyNode.js +5 -18
- package/src/private/webapis/dom/nodes/internals/NodeInternals.js +6 -0
- package/src/private/webapis/performance/Performance.js +1 -3
- package/src/private/webapis/performance/PerformanceEntry.js +6 -1
- package/src/private/webapis/performance/internals/RawPerformanceEntry.js +3 -0
- package/src/private/webapis/performance/specs/NativePerformance.js +10 -1
- package/src/types/globals.d.ts +42 -0
- package/src-win/Libraries/Components/TextInput/Tests/TextInputTest.tsx +7 -7
- package/src-win/Libraries/Components/Touchable/Tests/TouchableWin32Test.tsx +3 -3
- package/src-win/Libraries/Image/Tests/ImageWin32Test.tsx +1 -1
- package/src-win/Libraries/Text/Text.d.ts +2 -5
- package/types/index.d.ts +6 -3
- package/types/public/ReactNativeTypes.d.ts +2 -2
- package/Libraries/BatchedBridge/__mocks__/MessageQueueTestConfig.js +0 -38
- package/Libraries/BatchedBridge/__mocks__/MessageQueueTestModule.js +0 -22
- package/Libraries/Blob/FileReader_new.js +0 -231
- package/Libraries/Blob/FileReader_old.js +0 -186
- package/Libraries/Blob/__mocks__/FileReaderModule.js +0 -20
- package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +0 -32
- package/Libraries/Core/__mocks__/ErrorUtils.js +0 -33
- package/Libraries/Core/__mocks__/NativeExceptionsManager.js +0 -19
- package/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js +0 -49
- package/Libraries/Events/CustomEvent.js +0 -32
- package/Libraries/Events/EventPolyfill.js +0 -239
- package/Libraries/Lists/__flowtests__/FlatList-flowtest.js +0 -118
- package/Libraries/Lists/__flowtests__/SectionList-flowtest.js +0 -134
- package/Libraries/Network/XMLHttpRequest_new.js +0 -794
- package/Libraries/Network/XMLHttpRequest_old.js +0 -701
- package/Libraries/NewAppScreen/components/DebugInstructions.js +0 -41
- package/Libraries/NewAppScreen/components/Header.js +0 -77
- package/Libraries/NewAppScreen/components/HermesBadge.js +0 -53
- package/Libraries/NewAppScreen/components/LearnMoreLinks.js +0 -148
- package/Libraries/NewAppScreen/components/ReloadInstructions.js +0 -39
- package/Libraries/NewAppScreen/components/logo.png +0 -0
- package/Libraries/NewAppScreen/index.js +0 -25
- package/Libraries/StyleSheet/__flowtests__/StyleSheet-flowtest.js +0 -58
- package/Libraries/Utilities/DeviceInfo.win32.js +0 -19
- package/Libraries/Utilities/__mocks__/BackHandler.js +0 -45
- package/Libraries/Utilities/__mocks__/GlobalPerformanceLogger.js +0 -16
- package/Libraries/Utilities/__mocks__/PixelRatio.js +0 -25
- package/Libraries/WebSocket/WebSocketEvent.js +0 -30
- package/Libraries/WebSocket/WebSocket_new.js +0 -325
- package/Libraries/WebSocket/WebSocket_old.js +0 -297
- package/Libraries/WebSocket/__mocks__/event-target-shim.js +0 -27
- package/Libraries/__flowtests__/ReactNativeTypes-flowtest.js +0 -30
- package/Libraries/vendor/emitter/__flowtests__/EventEmitter-flowtest.js +0 -81
- package/flow/jest.js +0 -1287
- package/jest/__tests__/setup-test.js +0 -18
- package/src/private/components/VScrollViewNativeComponents.js +0 -25
- package/src/private/utilities/ensureInstance.js +0 -21
- package/src/private/webapis/performance/specs/__mocks__/NativePerformanceMock.js +0 -267
- package/types/modules/LaunchScreen.d.ts +0 -18
- /package/src/private/{devmenu → devsupport/devmenu}/DevMenu.d.ts +0 -0
- /package/src/private/{debugging → devsupport/rndevtools}/FuseboxSessionObserver.js +0 -0
|
@@ -10,18 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
import type {
|
|
14
|
-
____ColorValue_Internal,
|
|
15
|
-
____DangerouslyImpreciseStyle_Internal,
|
|
16
|
-
____DangerouslyImpreciseStyleProp_Internal,
|
|
17
|
-
____ImageStyle_Internal,
|
|
18
|
-
____ImageStyleProp_Internal,
|
|
19
|
-
____Styles_Internal,
|
|
20
|
-
____TextStyle_Internal,
|
|
21
|
-
____TextStyleProp_Internal,
|
|
22
|
-
____ViewStyle_Internal,
|
|
23
|
-
____ViewStyleProp_Internal,
|
|
24
|
-
} from './StyleSheetTypes';
|
|
13
|
+
import type {____Styles_Internal} from './StyleSheetTypes';
|
|
25
14
|
|
|
26
15
|
import composeStyles from '../../src/private/styles/composeStyles';
|
|
27
16
|
import flatten from './flattenStyle';
|
|
@@ -29,146 +18,8 @@ import flatten from './flattenStyle';
|
|
|
29
18
|
const ReactNativeStyleAttributes =
|
|
30
19
|
require('../Components/View/ReactNativeStyleAttributes').default;
|
|
31
20
|
const PixelRatio = require('../Utilities/PixelRatio').default;
|
|
32
|
-
const Platform = require('../Utilities/Platform').default; // [Win32]
|
|
33
21
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* This type should be used as the type for anything that is a color. It is
|
|
38
|
-
* most useful when using DynamicColorIOS which can be a string or a dynamic
|
|
39
|
-
* color object.
|
|
40
|
-
*
|
|
41
|
-
* type props = {backgroundColor: ColorValue};
|
|
42
|
-
*/
|
|
43
|
-
export type ColorValue = ____ColorValue_Internal;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* This type should be used as the type for a prop that is passed through
|
|
47
|
-
* to a <View>'s `style` prop. This ensures call sites of the component
|
|
48
|
-
* can't pass styles that View doesn't support such as `fontSize`.`
|
|
49
|
-
*
|
|
50
|
-
* type Props = {style: ViewStyleProp}
|
|
51
|
-
* const MyComponent = (props: Props) => <View style={props.style} />
|
|
52
|
-
*/
|
|
53
|
-
export type ViewStyleProp = ____ViewStyleProp_Internal;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* This type should be used as the type for a prop that is passed through
|
|
57
|
-
* to a <Text>'s `style` prop. This ensures call sites of the component
|
|
58
|
-
* can't pass styles that Text doesn't support such as `resizeMode`.`
|
|
59
|
-
*
|
|
60
|
-
* type Props = {style: TextStyleProp}
|
|
61
|
-
* const MyComponent = (props: Props) => <Text style={props.style} />
|
|
62
|
-
*/
|
|
63
|
-
export type TextStyleProp = ____TextStyleProp_Internal;
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* This type should be used as the type for a prop that is passed through
|
|
67
|
-
* to an <Image>'s `style` prop. This ensures call sites of the component
|
|
68
|
-
* can't pass styles that Image doesn't support such as `fontSize`.`
|
|
69
|
-
*
|
|
70
|
-
* type Props = {style: ImageStyleProp}
|
|
71
|
-
* const MyComponent = (props: Props) => <Image style={props.style} />
|
|
72
|
-
*/
|
|
73
|
-
export type ImageStyleProp = ____ImageStyleProp_Internal;
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* WARNING: You probably shouldn't be using this type. This type
|
|
77
|
-
* is similar to the ones above except it allows styles that are accepted
|
|
78
|
-
* by all of View, Text, or Image. It is therefore very unsafe to pass this
|
|
79
|
-
* through to an underlying component. Using this is almost always a mistake
|
|
80
|
-
* and using one of the other more restrictive types is likely the right choice.
|
|
81
|
-
*/
|
|
82
|
-
export type DangerouslyImpreciseStyleProp =
|
|
83
|
-
____DangerouslyImpreciseStyleProp_Internal;
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Utility type for getting the values for specific style keys.
|
|
87
|
-
*
|
|
88
|
-
* The following is bad because position is more restrictive than 'string':
|
|
89
|
-
* ```
|
|
90
|
-
* type Props = {position: string};
|
|
91
|
-
* ```
|
|
92
|
-
*
|
|
93
|
-
* You should use the following instead:
|
|
94
|
-
*
|
|
95
|
-
* ```
|
|
96
|
-
* type Props = {position: TypeForStyleKey<'position'>};
|
|
97
|
-
* ```
|
|
98
|
-
*
|
|
99
|
-
* This will correctly give you the type 'absolute' | 'relative'
|
|
100
|
-
*/
|
|
101
|
-
export type TypeForStyleKey<
|
|
102
|
-
+key: $Keys<____DangerouslyImpreciseStyle_Internal>,
|
|
103
|
-
> = $ElementType<____DangerouslyImpreciseStyle_Internal, key>;
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* This type is an object of the different possible style
|
|
107
|
-
* properties that can be specified for View.
|
|
108
|
-
*
|
|
109
|
-
* Note that this isn't a safe way to type a style prop for a component as
|
|
110
|
-
* results from StyleSheet.create return an internal identifier, not
|
|
111
|
-
* an object of styles.
|
|
112
|
-
*
|
|
113
|
-
* If you want to type the style prop of a function,
|
|
114
|
-
* consider using ViewStyleProp.
|
|
115
|
-
*
|
|
116
|
-
* A reasonable usage of this type is for helper functions that return an
|
|
117
|
-
* object of styles to pass to a View that can't be precomputed with
|
|
118
|
-
* StyleSheet.create.
|
|
119
|
-
*/
|
|
120
|
-
export type ViewStyle = ____ViewStyle_Internal;
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* This type is an object of the different possible style
|
|
124
|
-
* properties that can be specified for Text.
|
|
125
|
-
*
|
|
126
|
-
* Note that this isn't a safe way to type a style prop for a component as
|
|
127
|
-
* results from StyleSheet.create return an internal identifier, not
|
|
128
|
-
* an object of styles.
|
|
129
|
-
*
|
|
130
|
-
* If you want to type the style prop of a function,
|
|
131
|
-
* consider using TextStyleProp.
|
|
132
|
-
*
|
|
133
|
-
* A reasonable usage of this type is for helper functions that return an
|
|
134
|
-
* object of styles to pass to a Text that can't be precomputed with
|
|
135
|
-
* StyleSheet.create.
|
|
136
|
-
*/
|
|
137
|
-
export type TextStyle = ____TextStyle_Internal;
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* This type is an object of the different possible style
|
|
141
|
-
* properties that can be specified for Image.
|
|
142
|
-
*
|
|
143
|
-
* Note that this isn't a safe way to type a style prop for a component as
|
|
144
|
-
* results from StyleSheet.create return an internal identifier, not
|
|
145
|
-
* an object of styles.
|
|
146
|
-
*
|
|
147
|
-
* If you want to type the style prop of a function,
|
|
148
|
-
* consider using ImageStyleProp.
|
|
149
|
-
*
|
|
150
|
-
* A reasonable usage of this type is for helper functions that return an
|
|
151
|
-
* object of styles to pass to an Image that can't be precomputed with
|
|
152
|
-
* StyleSheet.create.
|
|
153
|
-
*/
|
|
154
|
-
export type ImageStyle = ____ImageStyle_Internal;
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* WARNING: You probably shouldn't be using this type. This type is an object
|
|
158
|
-
* with all possible style keys and their values. Note that this isn't
|
|
159
|
-
* a safe way to type a style prop for a component as results from
|
|
160
|
-
* StyleSheet.create return an internal identifier, not an object of styles.
|
|
161
|
-
*
|
|
162
|
-
* If you want to type the style prop of a function, consider using
|
|
163
|
-
* ViewStyleProp, TextStyleProp, or ImageStyleProp.
|
|
164
|
-
*
|
|
165
|
-
* This should only be used by very core utilities that operate on an object
|
|
166
|
-
* containing any possible style value.
|
|
167
|
-
*/
|
|
168
|
-
export type DangerouslyImpreciseStyle = ____DangerouslyImpreciseStyle_Internal;
|
|
169
|
-
|
|
170
|
-
let hairlineWidth: number =
|
|
171
|
-
Platform.OS === 'win32' ? 0.5 : PixelRatio.roundToNearestPixel(0.4); // TODO(windows ISS) - Avoid calls to PixelRatio - needs multi window support
|
|
22
|
+
let hairlineWidth: number = PixelRatio.roundToNearestPixel(0.4);
|
|
172
23
|
if (hairlineWidth === 0) {
|
|
173
24
|
hairlineWidth = 1 / PixelRatio.get();
|
|
174
25
|
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {____Styles_Internal} from './StyleSheetTypes';
|
|
12
|
+
|
|
13
|
+
import composeStyles from '../../src/private/styles/composeStyles';
|
|
14
|
+
import flattenStyle from './flattenStyle';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* This is defined as the width of a thin line on the platform. It can be
|
|
18
|
+
* used as the thickness of a border or division between two elements.
|
|
19
|
+
* Example:
|
|
20
|
+
* ```
|
|
21
|
+
* {
|
|
22
|
+
* borderBottomColor: '#bbb',
|
|
23
|
+
* borderBottomWidth: StyleSheet.hairlineWidth
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* This constant will always be a round number of pixels (so a line defined
|
|
28
|
+
* by it look crisp) and will try to match the standard width of a thin line
|
|
29
|
+
* on the underlying platform. However, you should not rely on it being a
|
|
30
|
+
* constant size, because on different platforms and screen densities its
|
|
31
|
+
* value may be calculated differently.
|
|
32
|
+
*/
|
|
33
|
+
declare export const hairlineWidth: number;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* A very common pattern is to create overlays with position absolute and zero positioning,
|
|
37
|
+
* so `absoluteFill` can be used for convenience and to reduce duplication of these repeated
|
|
38
|
+
* styles.
|
|
39
|
+
*/
|
|
40
|
+
declare export const absoluteFill: any;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Sometimes you may want `absoluteFill` but with a couple tweaks - `absoluteFillObject` can be
|
|
44
|
+
* used to create a customized entry in a `StyleSheet`, e.g.:
|
|
45
|
+
*
|
|
46
|
+
* const styles = StyleSheet.create({
|
|
47
|
+
* wrapper: {
|
|
48
|
+
* ...StyleSheet.absoluteFillObject,
|
|
49
|
+
* top: 10,
|
|
50
|
+
* backgroundColor: 'transparent',
|
|
51
|
+
* },
|
|
52
|
+
* });
|
|
53
|
+
*/
|
|
54
|
+
declare export const absoluteFillObject: {
|
|
55
|
+
+bottom: 0,
|
|
56
|
+
+left: 0,
|
|
57
|
+
+position: 'absolute',
|
|
58
|
+
+right: 0,
|
|
59
|
+
+top: 0,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Combines two styles such that style2 will override any styles in style1.
|
|
64
|
+
* If either style is falsy, the other one is returned without allocating
|
|
65
|
+
* an array, saving allocations and maintaining reference equality for
|
|
66
|
+
* PureComponent checks.
|
|
67
|
+
*/
|
|
68
|
+
declare export const compose: typeof composeStyles;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Flattens an array of style objects, into one aggregated style object.
|
|
72
|
+
*
|
|
73
|
+
* Example:
|
|
74
|
+
* ```
|
|
75
|
+
* const styles = StyleSheet.create({
|
|
76
|
+
* listItem: {
|
|
77
|
+
* flex: 1,
|
|
78
|
+
* fontSize: 16,
|
|
79
|
+
* color: 'white'
|
|
80
|
+
* },
|
|
81
|
+
* selectedListItem: {
|
|
82
|
+
* color: 'green'
|
|
83
|
+
* }
|
|
84
|
+
* });
|
|
85
|
+
*
|
|
86
|
+
* StyleSheet.flatten([styles.listItem, styles.selectedListItem])
|
|
87
|
+
* // returns { flex: 1, fontSize: 16, color: 'green' }
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
declare export const flatten: typeof flattenStyle;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* WARNING: EXPERIMENTAL. Breaking changes will probably happen a lot and will
|
|
94
|
+
* not be reliably announced. The whole thing might be deleted, who knows? Use
|
|
95
|
+
* at your own risk.
|
|
96
|
+
*
|
|
97
|
+
* Sets a function to use to pre-process a style property value. This is used
|
|
98
|
+
* internally to process color and transform values. You should not use this
|
|
99
|
+
* unless you really know what you are doing and have exhausted other options.
|
|
100
|
+
*/
|
|
101
|
+
declare export const setStyleAttributePreprocessor: (
|
|
102
|
+
property: string,
|
|
103
|
+
process: (nextProp: any) => any,
|
|
104
|
+
) => void;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* An identity function for creating style sheets.
|
|
108
|
+
*/
|
|
109
|
+
// $FlowFixMe[unsupported-variance-annotation]
|
|
110
|
+
declare export const create: <+S: ____Styles_Internal>(
|
|
111
|
+
obj: S & ____Styles_Internal,
|
|
112
|
+
) => $ReadOnly<S>;
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
+
import type {WithAnimatedValue} from '../Animated/createAnimatedComponent';
|
|
13
14
|
import type AnimatedNode from '../Animated/nodes/AnimatedNode';
|
|
14
15
|
import type {ImageResizeMode} from './../Image/ImageResizeMode';
|
|
15
16
|
import type {
|
|
@@ -20,6 +21,9 @@ import type {
|
|
|
20
21
|
____ViewStyle_InternalOverrides,
|
|
21
22
|
} from './private/_StyleSheetTypesOverrides';
|
|
22
23
|
import type {____TransformStyle_Internal} from './private/_TransformStyle';
|
|
24
|
+
import type {ColorValue} from './StyleSheet';
|
|
25
|
+
|
|
26
|
+
export type {____TransformStyle_Internal};
|
|
23
27
|
|
|
24
28
|
declare export opaque type NativeColorValue;
|
|
25
29
|
export type ____ColorValue_Internal = null | string | number | NativeColorValue;
|
|
@@ -35,8 +39,7 @@ export type EdgeInsetsValue = {
|
|
|
35
39
|
bottom: number,
|
|
36
40
|
};
|
|
37
41
|
|
|
38
|
-
export type DimensionValue = number | string | 'auto' |
|
|
39
|
-
export type AnimatableNumericValue = number | AnimatedNode;
|
|
42
|
+
export type DimensionValue = number | string | 'auto' | null;
|
|
40
43
|
|
|
41
44
|
export type CursorValue = 'auto' | 'pointer';
|
|
42
45
|
|
|
@@ -691,7 +694,7 @@ export type ____ShadowStyle_InternalCore = $ReadOnly<{
|
|
|
691
694
|
* Sets the drop shadow opacity (multiplied by the color's alpha component)
|
|
692
695
|
* @platform ios
|
|
693
696
|
*/
|
|
694
|
-
shadowOpacity?:
|
|
697
|
+
shadowOpacity?: number,
|
|
695
698
|
/**
|
|
696
699
|
* Sets the drop shadow blur radius
|
|
697
700
|
* @platform ios
|
|
@@ -723,8 +726,8 @@ export type DropShadowValue = {
|
|
|
723
726
|
color?: ____ColorValue_Internal,
|
|
724
727
|
};
|
|
725
728
|
|
|
726
|
-
|
|
727
|
-
type: '
|
|
729
|
+
type LinearGradientValue = {
|
|
730
|
+
type: 'linear-gradient',
|
|
728
731
|
// Angle or direction enums
|
|
729
732
|
direction?: string,
|
|
730
733
|
colorStops: $ReadOnlyArray<{
|
|
@@ -733,6 +736,50 @@ export type GradientValue = {
|
|
|
733
736
|
}>,
|
|
734
737
|
};
|
|
735
738
|
|
|
739
|
+
type RadialExtent =
|
|
740
|
+
| 'closest-corner'
|
|
741
|
+
| 'closest-side'
|
|
742
|
+
| 'farthest-corner'
|
|
743
|
+
| 'farthest-side';
|
|
744
|
+
export type RadialGradientPosition =
|
|
745
|
+
| {
|
|
746
|
+
top: number | string,
|
|
747
|
+
left: number | string,
|
|
748
|
+
}
|
|
749
|
+
| {
|
|
750
|
+
top: number | string,
|
|
751
|
+
right: number | string,
|
|
752
|
+
}
|
|
753
|
+
| {
|
|
754
|
+
bottom: number | string,
|
|
755
|
+
left: number | string,
|
|
756
|
+
}
|
|
757
|
+
| {
|
|
758
|
+
bottom: number | string,
|
|
759
|
+
right: number | string,
|
|
760
|
+
};
|
|
761
|
+
|
|
762
|
+
export type RadialGradientShape = 'circle' | 'ellipse';
|
|
763
|
+
export type RadialGradientSize =
|
|
764
|
+
| RadialExtent
|
|
765
|
+
| {
|
|
766
|
+
x: string | number,
|
|
767
|
+
y: string | number,
|
|
768
|
+
};
|
|
769
|
+
|
|
770
|
+
type RadialGradientValue = {
|
|
771
|
+
type: 'radial-gradient',
|
|
772
|
+
shape: RadialGradientShape,
|
|
773
|
+
size: RadialGradientSize,
|
|
774
|
+
position: RadialGradientPosition,
|
|
775
|
+
colorStops: $ReadOnlyArray<{
|
|
776
|
+
color: ____ColorValue_Internal,
|
|
777
|
+
positions?: $ReadOnlyArray<string>,
|
|
778
|
+
}>,
|
|
779
|
+
};
|
|
780
|
+
|
|
781
|
+
export type BackgroundImageValue = LinearGradientValue | RadialGradientValue;
|
|
782
|
+
|
|
736
783
|
export type BoxShadowValue = {
|
|
737
784
|
offsetX: number | string,
|
|
738
785
|
offsetY: number | string,
|
|
@@ -760,10 +807,7 @@ type ____BlendMode_Internal =
|
|
|
760
807
|
| 'color'
|
|
761
808
|
| 'luminosity';
|
|
762
809
|
|
|
763
|
-
export type
|
|
764
|
-
...$Exact<____LayoutStyle_Internal>,
|
|
765
|
-
...$Exact<____ShadowStyle_Internal>,
|
|
766
|
-
...$Exact<____TransformStyle_Internal>,
|
|
810
|
+
export type ____ViewStyle_InternalBase = $ReadOnly<{
|
|
767
811
|
backfaceVisibility?: 'visible' | 'hidden',
|
|
768
812
|
backgroundColor?: ____ColorValue_Internal,
|
|
769
813
|
borderColor?: ____ColorValue_Internal,
|
|
@@ -777,42 +821,49 @@ export type ____ViewStyle_InternalCore = $ReadOnly<{
|
|
|
777
821
|
borderBlockColor?: ____ColorValue_Internal,
|
|
778
822
|
borderBlockEndColor?: ____ColorValue_Internal,
|
|
779
823
|
borderBlockStartColor?: ____ColorValue_Internal,
|
|
780
|
-
borderRadius?:
|
|
781
|
-
borderBottomEndRadius?:
|
|
782
|
-
borderBottomLeftRadius?:
|
|
783
|
-
borderBottomRightRadius?:
|
|
784
|
-
borderBottomStartRadius?:
|
|
785
|
-
borderEndEndRadius?:
|
|
786
|
-
borderEndStartRadius?:
|
|
787
|
-
borderStartEndRadius?:
|
|
788
|
-
borderStartStartRadius?:
|
|
789
|
-
borderTopEndRadius?:
|
|
790
|
-
borderTopLeftRadius?:
|
|
791
|
-
borderTopRightRadius?:
|
|
792
|
-
borderTopStartRadius?:
|
|
824
|
+
borderRadius?: number | string,
|
|
825
|
+
borderBottomEndRadius?: number | string,
|
|
826
|
+
borderBottomLeftRadius?: number | string,
|
|
827
|
+
borderBottomRightRadius?: number | string,
|
|
828
|
+
borderBottomStartRadius?: number | string,
|
|
829
|
+
borderEndEndRadius?: number | string,
|
|
830
|
+
borderEndStartRadius?: number | string,
|
|
831
|
+
borderStartEndRadius?: number | string,
|
|
832
|
+
borderStartStartRadius?: number | string,
|
|
833
|
+
borderTopEndRadius?: number | string,
|
|
834
|
+
borderTopLeftRadius?: number | string,
|
|
835
|
+
borderTopRightRadius?: number | string,
|
|
836
|
+
borderTopStartRadius?: number | string,
|
|
793
837
|
borderStyle?: 'solid' | 'dotted' | 'dashed',
|
|
794
|
-
borderWidth?:
|
|
795
|
-
borderBottomWidth?:
|
|
796
|
-
borderEndWidth?:
|
|
797
|
-
borderLeftWidth?:
|
|
798
|
-
borderRightWidth?:
|
|
799
|
-
borderStartWidth?:
|
|
800
|
-
borderTopWidth?:
|
|
801
|
-
opacity?:
|
|
838
|
+
borderWidth?: number,
|
|
839
|
+
borderBottomWidth?: number,
|
|
840
|
+
borderEndWidth?: number,
|
|
841
|
+
borderLeftWidth?: number,
|
|
842
|
+
borderRightWidth?: number,
|
|
843
|
+
borderStartWidth?: number,
|
|
844
|
+
borderTopWidth?: number,
|
|
845
|
+
opacity?: number,
|
|
802
846
|
outlineColor?: ____ColorValue_Internal,
|
|
803
|
-
outlineOffset?:
|
|
847
|
+
outlineOffset?: number,
|
|
804
848
|
outlineStyle?: 'solid' | 'dotted' | 'dashed',
|
|
805
|
-
outlineWidth?:
|
|
849
|
+
outlineWidth?: number,
|
|
806
850
|
elevation?: number,
|
|
807
851
|
pointerEvents?: 'auto' | 'none' | 'box-none' | 'box-only',
|
|
808
852
|
cursor?: CursorValue,
|
|
809
853
|
boxShadow?: $ReadOnlyArray<BoxShadowValue> | string,
|
|
810
854
|
filter?: $ReadOnlyArray<FilterFunction> | string,
|
|
811
855
|
mixBlendMode?: ____BlendMode_Internal,
|
|
812
|
-
experimental_backgroundImage?: $ReadOnlyArray<
|
|
856
|
+
experimental_backgroundImage?: $ReadOnlyArray<BackgroundImageValue> | string,
|
|
813
857
|
isolation?: 'auto' | 'isolate',
|
|
814
858
|
}>;
|
|
815
859
|
|
|
860
|
+
export type ____ViewStyle_InternalCore = $ReadOnly<{
|
|
861
|
+
...$Exact<____LayoutStyle_Internal>,
|
|
862
|
+
...$Exact<____ShadowStyle_Internal>,
|
|
863
|
+
...$Exact<____TransformStyle_Internal>,
|
|
864
|
+
...____ViewStyle_InternalBase,
|
|
865
|
+
}>;
|
|
866
|
+
|
|
816
867
|
export type ____ViewStyle_Internal = $ReadOnly<{
|
|
817
868
|
...____ViewStyle_InternalCore,
|
|
818
869
|
...____ViewStyle_InternalOverrides,
|
|
@@ -867,7 +918,7 @@ export type ____FontWeight_Internal =
|
|
|
867
918
|
| 'heavy'
|
|
868
919
|
| 'black';
|
|
869
920
|
|
|
870
|
-
export type
|
|
921
|
+
export type ____FontVariant_Internal =
|
|
871
922
|
| 'small-caps'
|
|
872
923
|
| 'oldstyle-nums'
|
|
873
924
|
| 'lining-nums'
|
|
@@ -900,11 +951,12 @@ export type ____FontVariantArray_Internal = $ReadOnlyArray<
|
|
|
900
951
|
| 'stylistic-seventeen'
|
|
901
952
|
| 'stylistic-eighteen'
|
|
902
953
|
| 'stylistic-nineteen'
|
|
903
|
-
| 'stylistic-twenty'
|
|
904
|
-
>;
|
|
954
|
+
| 'stylistic-twenty';
|
|
905
955
|
|
|
906
|
-
export type
|
|
907
|
-
|
|
956
|
+
export type ____FontVariantArray_Internal =
|
|
957
|
+
$ReadOnlyArray<____FontVariant_Internal>;
|
|
958
|
+
|
|
959
|
+
type ____TextStyle_InternalBase = $ReadOnly<{
|
|
908
960
|
color?: ____ColorValue_Internal,
|
|
909
961
|
fontFamily?: string,
|
|
910
962
|
fontSize?: number,
|
|
@@ -935,6 +987,11 @@ export type ____TextStyle_InternalCore = $ReadOnly<{
|
|
|
935
987
|
writingDirection?: 'auto' | 'ltr' | 'rtl',
|
|
936
988
|
}>;
|
|
937
989
|
|
|
990
|
+
export type ____TextStyle_InternalCore = $ReadOnly<{
|
|
991
|
+
...$Exact<____ViewStyle_Internal>,
|
|
992
|
+
...____TextStyle_InternalBase,
|
|
993
|
+
}>;
|
|
994
|
+
|
|
938
995
|
export type ____TextStyle_Internal = $ReadOnly<{
|
|
939
996
|
...____TextStyle_InternalCore,
|
|
940
997
|
...____TextStyle_InternalOverrides,
|
|
@@ -945,7 +1002,8 @@ export type ____ImageStyle_InternalCore = $ReadOnly<{
|
|
|
945
1002
|
resizeMode?: ImageResizeMode,
|
|
946
1003
|
objectFit?: 'cover' | 'contain' | 'fill' | 'scale-down' | 'none',
|
|
947
1004
|
tintColor?: ____ColorValue_Internal,
|
|
948
|
-
overlayColor?:
|
|
1005
|
+
overlayColor?: ColorValue,
|
|
1006
|
+
overflow?: 'visible' | 'hidden',
|
|
949
1007
|
}>;
|
|
950
1008
|
|
|
951
1009
|
export type ____ImageStyle_Internal = $ReadOnly<{
|
|
@@ -958,7 +1016,7 @@ export type ____DangerouslyImpreciseStyle_InternalCore = $ReadOnly<{
|
|
|
958
1016
|
resizeMode?: ImageResizeMode,
|
|
959
1017
|
objectFit?: 'cover' | 'contain' | 'fill' | 'scale-down' | 'none',
|
|
960
1018
|
tintColor?: ____ColorValue_Internal,
|
|
961
|
-
overlayColor?:
|
|
1019
|
+
overlayColor?: ColorValue,
|
|
962
1020
|
}>;
|
|
963
1021
|
|
|
964
1022
|
export type ____DangerouslyImpreciseStyle_Internal = $ReadOnly<{
|
|
@@ -967,24 +1025,28 @@ export type ____DangerouslyImpreciseStyle_Internal = $ReadOnly<{
|
|
|
967
1025
|
...
|
|
968
1026
|
}>;
|
|
969
1027
|
|
|
970
|
-
type
|
|
1028
|
+
export type StyleProp<+T> =
|
|
971
1029
|
| null
|
|
972
1030
|
| void
|
|
973
1031
|
| T
|
|
974
1032
|
| false
|
|
975
1033
|
| ''
|
|
976
|
-
| $ReadOnlyArray<
|
|
1034
|
+
| $ReadOnlyArray<StyleProp<T>>;
|
|
977
1035
|
|
|
978
|
-
export type ____DangerouslyImpreciseStyleProp_Internal =
|
|
1036
|
+
export type ____DangerouslyImpreciseStyleProp_Internal = StyleProp<
|
|
979
1037
|
Partial<____DangerouslyImpreciseStyle_Internal>,
|
|
980
1038
|
>;
|
|
981
|
-
|
|
1039
|
+
|
|
1040
|
+
export type ____DangerouslyImpreciseAnimatedStyleProp_Internal =
|
|
1041
|
+
WithAnimatedValue<StyleProp<Partial<____DangerouslyImpreciseStyle_Internal>>>;
|
|
1042
|
+
|
|
1043
|
+
export type ____ViewStyleProp_Internal = StyleProp<
|
|
982
1044
|
$ReadOnly<Partial<____ViewStyle_Internal>>,
|
|
983
1045
|
>;
|
|
984
|
-
export type ____TextStyleProp_Internal =
|
|
1046
|
+
export type ____TextStyleProp_Internal = StyleProp<
|
|
985
1047
|
$ReadOnly<Partial<____TextStyle_Internal>>,
|
|
986
1048
|
>;
|
|
987
|
-
export type ____ImageStyleProp_Internal =
|
|
1049
|
+
export type ____ImageStyleProp_Internal = StyleProp<
|
|
988
1050
|
$ReadOnly<Partial<____ImageStyle_Internal>>,
|
|
989
1051
|
>;
|
|
990
1052
|
|
|
@@ -995,10 +1057,26 @@ export type ____Styles_Internal = {
|
|
|
995
1057
|
...
|
|
996
1058
|
};
|
|
997
1059
|
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1060
|
+
// A depth limiter, to avoid TS2589 in TypeScript. This and
|
|
1061
|
+
// ____FlattenStyleProp_Helper should be considered internal.
|
|
1062
|
+
type FlattenDepthLimiter = [void, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
|
|
1063
|
+
type ____FlattenStyleProp_Helper<
|
|
1064
|
+
+TStyleProp: StyleProp<mixed>,
|
|
1065
|
+
Depth: $Values<FlattenDepthLimiter> = 9,
|
|
1066
|
+
> = Depth extends 0
|
|
1001
1067
|
? empty
|
|
1002
|
-
: TStyleProp extends
|
|
1003
|
-
?
|
|
1004
|
-
: TStyleProp
|
|
1068
|
+
: TStyleProp extends null | void | false | ''
|
|
1069
|
+
? empty
|
|
1070
|
+
: // When TStyleProp is an array, recurse with decremented Depth
|
|
1071
|
+
TStyleProp extends $ReadOnlyArray<infer V>
|
|
1072
|
+
? ____FlattenStyleProp_Helper<
|
|
1073
|
+
V,
|
|
1074
|
+
Depth extends number ? FlattenDepthLimiter[Depth] : 0,
|
|
1075
|
+
>
|
|
1076
|
+
: TStyleProp;
|
|
1077
|
+
|
|
1078
|
+
export type ____FlattenStyleProp_Internal<+TStyleProp: StyleProp<mixed>> =
|
|
1079
|
+
____FlattenStyleProp_Helper<TStyleProp> extends empty
|
|
1080
|
+
? // $FlowFixMe[unclear-type]
|
|
1081
|
+
any
|
|
1082
|
+
: ____FlattenStyleProp_Helper<TStyleProp>;
|
|
@@ -10,13 +10,22 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
import type
|
|
14
|
-
import type {
|
|
13
|
+
import type AnimatedNode from '../Animated/nodes/AnimatedNode';
|
|
14
|
+
import type {
|
|
15
|
+
____DangerouslyImpreciseAnimatedStyleProp_Internal,
|
|
16
|
+
____FlattenStyleProp_Internal,
|
|
17
|
+
} from './StyleSheetTypes';
|
|
15
18
|
|
|
16
|
-
|
|
19
|
+
type NonAnimatedNodeObject<TStyleProp> = TStyleProp extends AnimatedNode
|
|
20
|
+
? empty
|
|
21
|
+
: TStyleProp;
|
|
22
|
+
|
|
23
|
+
function flattenStyle<
|
|
24
|
+
TStyleProp: ____DangerouslyImpreciseAnimatedStyleProp_Internal,
|
|
25
|
+
>(
|
|
17
26
|
style: ?TStyleProp,
|
|
18
27
|
// $FlowFixMe[underconstrained-implicit-instantiation]
|
|
19
|
-
): ?____FlattenStyleProp_Internal<TStyleProp
|
|
28
|
+
): ?NonAnimatedNodeObject<____FlattenStyleProp_Internal<TStyleProp>> {
|
|
20
29
|
if (style === null || typeof style !== 'object') {
|
|
21
30
|
return undefined;
|
|
22
31
|
}
|
|
@@ -35,6 +44,7 @@ function flattenStyle<TStyleProp: DangerouslyImpreciseStyleProp>(
|
|
|
35
44
|
for (const key in computedStyle) {
|
|
36
45
|
// $FlowFixMe[incompatible-use]
|
|
37
46
|
// $FlowFixMe[invalid-computed-prop]
|
|
47
|
+
// $FlowFixMe[prop-missing]
|
|
38
48
|
result[key] = computedStyle[key];
|
|
39
49
|
}
|
|
40
50
|
}
|