@office-iss/react-native-win32 0.74.4 → 0.75.0-preview.2
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 +9 -4
- package/CHANGELOG.json +569 -51
- package/CHANGELOG.md +173 -30
- package/Libraries/Animated/AnimatedImplementation.js +2 -0
- package/Libraries/Animated/NativeAnimatedHelper.js +4 -0
- package/Libraries/Animated/NativeAnimatedHelper.win32.js +4 -0
- package/Libraries/Animated/createAnimatedComponent.js +10 -4
- package/Libraries/Animated/useAnimatedProps.js +56 -28
- package/Libraries/BatchedBridge/MessageQueue.js +1 -0
- package/Libraries/Components/Button.js +10 -5
- package/Libraries/Components/Button.win32.js +1 -0
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +11 -2
- package/Libraries/Components/Pressable/Pressable.js +13 -6
- package/Libraries/Components/Pressable/Pressable.win32.js +13 -6
- package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +4 -0
- package/Libraries/Components/ScrollView/ScrollView.js +109 -29
- package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +6 -0
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +13 -1
- package/Libraries/Components/StatusBar/StatusBar.js +1 -21
- package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +0 -15
- package/Libraries/Components/TextInput/InputAccessoryView.js +10 -1
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +0 -12
- package/Libraries/Components/TextInput/TextInput.d.ts +0 -19
- package/Libraries/Components/TextInput/TextInput.js +14 -70
- package/Libraries/Components/TextInput/TextInput.win32.js +15 -72
- package/Libraries/Components/Touchable/Touchable.js +2 -2
- package/Libraries/Components/Touchable/TouchableHighlight.d.ts +4 -10
- package/Libraries/Components/Touchable/TouchableHighlight.js +3 -1
- package/Libraries/Components/Touchable/TouchableOpacity.d.ts +4 -32
- package/Libraries/Components/Touchable/TouchableOpacity.js +3 -1
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.d.ts +8 -0
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +117 -111
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +6 -0
- package/Libraries/Components/View/ReactNativeViewAttributes.js +1 -0
- package/Libraries/Components/View/ReactNativeViewAttributes.win32.js +1 -0
- package/Libraries/Components/View/View.js +0 -11
- package/Libraries/Components/View/View.win32.js +0 -11
- package/Libraries/Components/View/ViewAccessibility.js +4 -4
- package/Libraries/Components/View/ViewAccessibility.win32.js +6 -6
- package/Libraries/Components/View/ViewPropTypes.d.ts +7 -49
- package/Libraries/Components/View/ViewPropTypes.js +7 -0
- package/Libraries/Components/View/ViewPropTypes.win32.js +7 -0
- package/Libraries/Core/Devtools/loadBundleFromServer.js +3 -3
- package/Libraries/Core/Devtools/loadBundleFromServer.win32.js +153 -0
- package/Libraries/Core/Devtools/parseErrorStack.js +5 -5
- package/Libraries/Core/Devtools/parseHermesStack.js +22 -16
- package/Libraries/Core/ErrorHandlers.js +116 -0
- package/Libraries/Core/ExceptionsManager.js +2 -2
- package/Libraries/Core/ReactNativeVersion.js +3 -3
- package/Libraries/Core/setUpDeveloperTools.js +3 -1
- package/Libraries/Core/setUpPerformance.js +6 -4
- package/Libraries/Core/setUpReactDevTools.js +70 -10
- package/Libraries/Core/setUpTimers.js +50 -31
- package/Libraries/Debugging/DebuggingOverlayRegistry.js +1 -1
- package/Libraries/Image/Image.android.js +23 -13
- package/Libraries/Image/Image.d.ts +14 -15
- package/Libraries/Image/Image.ios.js +21 -11
- package/Libraries/Image/Image.win32.js +5 -3
- package/Libraries/Image/ImageProps.js +16 -5
- package/Libraries/Image/ImageTypes.flow.js +7 -2
- package/Libraries/Image/ImageUtils.js +1 -0
- package/Libraries/Image/ImageViewNativeComponent.js +2 -1
- package/Libraries/Inspector/ElementBox.js +6 -3
- package/Libraries/Inspector/ElementProperties.js +1 -1
- package/Libraries/Interaction/TouchHistoryMath.js +4 -4
- package/Libraries/IntersectionObserver/IntersectionObserverManager.js +6 -26
- package/Libraries/JSInspector/NetworkAgent.js +1 -1
- package/Libraries/LogBox/Data/LogBoxData.js +39 -29
- package/Libraries/LogBox/Data/LogBoxLog.js +114 -2
- package/Libraries/LogBox/Data/parseLogBoxLog.js +168 -53
- package/Libraries/LogBox/LogBox.js +29 -12
- package/Libraries/LogBox/LogBoxNotificationContainer.js +4 -0
- package/Libraries/LogBox/UI/LogBoxInspector.js +8 -70
- package/Libraries/LogBox/UI/LogBoxInspectorBody.js +87 -0
- package/Libraries/LogBox/UI/LogBoxInspectorFooter.js +6 -42
- package/Libraries/LogBox/UI/LogBoxInspectorFooterButton.js +58 -0
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +5 -66
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +8 -52
- package/Libraries/LogBox/UI/LogBoxInspectorHeaderButton.js +76 -0
- package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js +8 -5
- package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.win32.js +8 -5
- package/Libraries/LogBox/UI/LogBoxNotification.js +13 -152
- package/Libraries/LogBox/UI/LogBoxNotificationCountBadge.js +63 -0
- package/Libraries/LogBox/UI/LogBoxNotificationDismissButton.js +67 -0
- package/Libraries/LogBox/UI/LogBoxNotificationMessage.js +57 -0
- package/Libraries/NativeComponent/BaseViewConfig.android.js +5 -0
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +5 -0
- package/Libraries/NativeComponent/BaseViewConfig.win32.js +5 -0
- package/Libraries/NativeComponent/NativeComponentRegistry.js +12 -5
- package/Libraries/NativeComponent/StaticViewConfigValidator.js +3 -0
- package/Libraries/Network/XMLHttpRequest.js +5 -1
- package/Libraries/NewAppScreen/components/LearnMoreLinks.js +3 -3
- package/Libraries/Pressability/Pressability.js +3 -51
- package/Libraries/Pressability/Pressability.win32.js +3 -51
- package/Libraries/ReactNative/AppContainer-dev.js +3 -2
- package/Libraries/ReactNative/AppContainer-prod.js +2 -1
- package/Libraries/ReactNative/AppContainer.js +2 -0
- package/Libraries/ReactNative/AppRegistry.d.ts +7 -0
- package/Libraries/ReactNative/AppRegistry.js +10 -4
- package/Libraries/ReactNative/BridgelessUIManager.js +1 -21
- package/Libraries/ReactNative/FabricUIManager.js +0 -51
- package/Libraries/ReactNative/ReactFabricPublicInstance/warnForStyleProps.js +1 -0
- package/Libraries/ReactNative/RendererImplementation.js +20 -2
- package/Libraries/ReactNative/UIManager.d.ts +0 -21
- package/Libraries/ReactNative/UIManagerProperties.js +0 -3
- package/Libraries/ReactNative/__mocks__/FabricUIManager.js +5 -341
- package/Libraries/ReactNative/getNativeComponentAttributes.js +8 -8
- package/Libraries/ReactNative/renderApplication.js +3 -0
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +15682 -27088
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +5082 -4381
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +3480 -2571
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +15943 -27543
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +5303 -4606
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +3450 -2572
- package/Libraries/Renderer/shims/ReactFabric.js +2 -2
- package/Libraries/Renderer/shims/ReactFeatureFlags.js +2 -2
- package/Libraries/Renderer/shims/ReactNative.js +2 -3
- package/Libraries/Renderer/shims/ReactNativeTypes.js +24 -3
- package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +2 -2
- package/Libraries/Renderer/shims/createReactNativeComponentClass.js +2 -2
- package/Libraries/Share/Share.d.ts +16 -10
- package/Libraries/Share/Share.js +14 -15
- package/Libraries/StyleSheet/StyleSheet.d.ts +1 -1
- package/Libraries/StyleSheet/StyleSheet.js +3 -10
- package/Libraries/StyleSheet/StyleSheet.win32.js +3 -10
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +21 -21
- package/Libraries/StyleSheet/StyleSheetTypes.js +24 -18
- package/Libraries/StyleSheet/flattenStyle.js +1 -0
- package/Libraries/StyleSheet/processFilter.js +132 -0
- package/Libraries/StyleSheet/processTransform.js +18 -3
- package/Libraries/Text/Text.js +151 -128
- package/Libraries/Text/Text.win32.js +163 -138
- package/Libraries/Text/TextNativeComponent.js +5 -4
- package/Libraries/Text/TextNativeComponent.win32.js +5 -4
- package/Libraries/Text/TextProps.js +6 -6
- package/Libraries/Text/TextProps.win32.js +6 -6
- package/Libraries/TurboModule/TurboModuleRegistry.js +2 -1
- package/Libraries/Types/CodegenTypes.js +3 -0
- package/Libraries/Utilities/{LoadingView.android.js → DevLoadingView.js} +33 -11
- package/Libraries/Utilities/Dimensions.js +1 -0
- package/Libraries/Utilities/Dimensions.win32.js +1 -0
- package/Libraries/Utilities/HMRClient.js +36 -8
- package/Libraries/Utilities/HMRClientProdShim.js +1 -0
- package/Libraries/Utilities/Platform.android.js +5 -5
- package/Libraries/Utilities/Platform.d.ts +1 -1
- package/Libraries/Utilities/Platform.flow.js +2 -2
- package/Libraries/Utilities/Platform.flow.win32.js +3 -3
- package/Libraries/Utilities/Platform.ios.js +1 -1
- package/Libraries/Utilities/Platform.win32.js +1 -1
- package/Libraries/Utilities/RCTLog.js +1 -0
- package/Libraries/Utilities/ReactNativeTestTools.js +12 -24
- package/Libraries/Utilities/verifyComponentAttributeEquivalence.js +11 -6
- package/Libraries/__tests__/ButtonWin32-test.js +7 -6
- package/Libraries/promiseRejectionTrackingOptions.js +1 -0
- package/jest/mockComponent.js +7 -0
- package/jest/renderer.js +25 -14
- package/jest/setup.js +19 -13
- package/jest.config.js +2 -1
- package/overrides.json +32 -31
- package/package.json +27 -25
- package/rn-get-polyfills.js +1 -0
- package/src/private/core/composeStyles.js +27 -0
- package/src/private/featureflags/ReactNativeFeatureFlags.js +93 -33
- package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +23 -4
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +56 -0
- package/src/private/fusebox/setUpFuseboxReactDevToolsDispatcher.js +108 -0
- package/src/private/specs/modules/NativeBlobModule.js +4 -2
- package/src/private/specs/modules/NativeDevSettings.js +1 -0
- package/src/private/specs/modules/NativePlatformConstantsAndroid.js +1 -1
- package/src/private/specs/modules/NativePlatformConstantsIOS.js +1 -1
- package/src/private/specs/modules/NativePlatformConstantsWin.js +1 -1
- package/src/private/specs/modules/NativePushNotificationManagerIOS.js +0 -4
- package/src/private/specs/modules/NativeUIManager.js +0 -7
- package/src/private/webapis/dom/geometry/DOMRectReadOnly.js +24 -24
- package/src/private/webapis/dom/nodes/ReactNativeElement.js +11 -14
- package/src/private/webapis/dom/nodes/ReadOnlyCharacterData.js +2 -3
- package/src/private/webapis/dom/nodes/ReadOnlyElement.js +24 -54
- package/src/private/webapis/dom/nodes/ReadOnlyNode.js +5 -13
- package/src/private/webapis/dom/nodes/specs/NativeDOM.js +468 -0
- package/src/private/webapis/dom/nodes/specs/__mocks__/NativeDOMMock.js +413 -0
- package/src/private/webapis/dom/oldstylecollections/DOMRectList.js +4 -4
- package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +4 -4
- package/src/private/webapis/dom/oldstylecollections/NodeList.js +5 -5
- package/src/private/webapis/idlecallbacks/specs/NativeIdleCallbacks.js +34 -0
- package/src/private/webapis/microtasks/specs/NativeMicrotasks.js +21 -0
- package/src/private/webapis/performance/EventCounts.js +1 -1
- package/src/private/webapis/performance/MemoryInfo.js +9 -9
- package/src/private/webapis/performance/Performance.js +10 -56
- package/src/private/webapis/performance/PerformanceObserver.js +30 -22
- package/src/private/webapis/performance/RawPerformanceEntry.js +2 -7
- package/src/private/webapis/performance/ReactNativeStartupTiming.js +18 -18
- package/src/private/webapis/performance/UserTiming.js +63 -0
- package/src/private/webapis/performance/{NativePerformance.js → specs/NativePerformance.js} +3 -2
- package/src/private/webapis/performance/{NativePerformanceObserver.js → specs/NativePerformanceObserver.js} +2 -2
- package/src/private/webapis/performance/{__mocks__ → specs/__mocks__}/NativePerformance.js +1 -1
- package/src/private/webapis/performance/{__mocks__ → specs/__mocks__}/NativePerformanceObserver.js +3 -4
- package/src-win/Libraries/Components/View/ViewPropTypes.d.ts +7 -49
- package/types/modules/globals.d.ts +4 -0
- package/Libraries/Components/ScrollView/ScrollView.win32.js +0 -1915
- package/Libraries/NativeModules/specs/NativeAnimationsDebugModule.js +0 -13
- package/Libraries/Utilities/LoadingView.ios.js +0 -50
- package/Libraries/Utilities/LoadingView.js +0 -16
- package/jest/ReactNativeInternalFeatureFlagsMock.js +0 -13
- package/src/private/featureflags/NativeReactNativeFeatureFlags.js +0 -44
- package/src/private/featureflags/__tests__/ReactNativeFeatureFlags-test.js +0 -92
- package/src/private/specs/modules/NativeAnimationsDebugModule.js +0 -20
- package/src/private/webapis/dom/oldstylecollections/__tests__/DOMRectList-test.js +0 -85
- package/src/private/webapis/dom/oldstylecollections/__tests__/HTMLCollection-test.js +0 -80
- package/src/private/webapis/dom/oldstylecollections/__tests__/NodeList-test.js +0 -161
- package/src/private/webapis/performance/__tests__/EventCounts-test.js +0 -116
- package/src/private/webapis/performance/__tests__/NativePerformanceMock-test.js +0 -82
- package/src/private/webapis/performance/__tests__/NativePerformanceObserverMock-test.js +0 -108
- package/src/private/webapis/performance/__tests__/Performance-test.js +0 -117
- package/src/private/webapis/performance/__tests__/PerformanceObserver-test.js +0 -208
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
* @noformat
|
|
8
|
-
* @flow
|
|
9
8
|
* @nolint
|
|
10
|
-
* @
|
|
9
|
+
* @flow
|
|
10
|
+
* @generated SignedSource<<bb39e39880fecbf572b5f8e7c2a95c5d>>
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
'use strict';
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
* @noformat
|
|
8
|
-
* @flow strict-local
|
|
9
8
|
* @nolint
|
|
10
|
-
* @
|
|
9
|
+
* @flow strict-local
|
|
10
|
+
* @generated SignedSource<<b1b5e34e426103a69612278fd5c9f77c>>
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
'use strict';
|
|
@@ -5,11 +5,10 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
* @noformat
|
|
8
|
-
* @flow
|
|
9
8
|
* @nolint
|
|
10
|
-
* @
|
|
9
|
+
* @flow
|
|
10
|
+
* @generated SignedSource<<475c7d864efc2948c6125ddb8a38a4fc>>
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
12
|
'use strict';
|
|
14
13
|
|
|
15
14
|
import type {ReactNativeType} from './ReactNativeTypes';
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
* @noformat
|
|
8
|
-
* @flow strict
|
|
9
8
|
* @nolint
|
|
10
|
-
* @
|
|
9
|
+
* @flow strict
|
|
10
|
+
* @generated SignedSource<<e7a1421518e1d99f18c5b14e85f44843>>
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import type {ElementRef, ElementType, Element, AbstractComponent} from 'react';
|
|
@@ -127,7 +127,7 @@ export type NativeMethods = $ReadOnly<{|
|
|
|
127
127
|
|}>;
|
|
128
128
|
|
|
129
129
|
// This validates that INativeMethods and NativeMethods stay in sync using Flow!
|
|
130
|
-
declare
|
|
130
|
+
declare const ensureNativeMethodsAreSynced: NativeMethods;
|
|
131
131
|
(ensureNativeMethodsAreSynced: INativeMethods);
|
|
132
132
|
|
|
133
133
|
export type HostComponent<T> = AbstractComponent<T, $ReadOnly<NativeMethods>>;
|
|
@@ -176,6 +176,25 @@ export type TouchedViewDataAtPoint = $ReadOnly<{
|
|
|
176
176
|
...InspectorData,
|
|
177
177
|
}>;
|
|
178
178
|
|
|
179
|
+
export type RenderRootOptions = {
|
|
180
|
+
onUncaughtError?: (
|
|
181
|
+
error: mixed,
|
|
182
|
+
errorInfo: {+componentStack?: ?string},
|
|
183
|
+
) => void,
|
|
184
|
+
onCaughtError?: (
|
|
185
|
+
error: mixed,
|
|
186
|
+
errorInfo: {
|
|
187
|
+
+componentStack?: ?string,
|
|
188
|
+
// $FlowFixMe[unclear-type] unknown props and state.
|
|
189
|
+
+errorBoundary?: ?React$Component<any, any>,
|
|
190
|
+
},
|
|
191
|
+
) => void,
|
|
192
|
+
onRecoverableError?: (
|
|
193
|
+
error: mixed,
|
|
194
|
+
errorInfo: {+componentStack?: ?string},
|
|
195
|
+
) => void,
|
|
196
|
+
};
|
|
197
|
+
|
|
179
198
|
/**
|
|
180
199
|
* Flat ReactNative renderer bundles are too big for Flow to parse efficiently.
|
|
181
200
|
* Provide minimal Flow typing for the high-level RN API and call it a day.
|
|
@@ -204,6 +223,7 @@ export type ReactNativeType = {
|
|
|
204
223
|
element: Element<ElementType>,
|
|
205
224
|
containerTag: number,
|
|
206
225
|
callback: ?() => void,
|
|
226
|
+
options: ?RenderRootOptions,
|
|
207
227
|
): ?ElementRef<ElementType>,
|
|
208
228
|
unmountComponentAtNode(containerTag: number): void,
|
|
209
229
|
unmountComponentAtNodeAndRemoveContainer(containerTag: number): void,
|
|
@@ -239,6 +259,7 @@ export type ReactFabricType = {
|
|
|
239
259
|
containerTag: number,
|
|
240
260
|
callback: ?() => void,
|
|
241
261
|
concurrentRoot: ?boolean,
|
|
262
|
+
options: ?RenderRootOptions,
|
|
242
263
|
): ?ElementRef<ElementType>,
|
|
243
264
|
unmountComponentAtNode(containerTag: number): void,
|
|
244
265
|
getNodeFromInternalInstanceHandle(
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
* @noformat
|
|
8
|
-
* @flow strict-local
|
|
9
8
|
* @nolint
|
|
10
|
-
* @
|
|
9
|
+
* @flow strict-local
|
|
10
|
+
* @generated SignedSource<<69d0cc554d77cddb1c779dfbdf569505>>
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
'use strict';
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
* @noformat
|
|
8
|
-
* @flow strict-local
|
|
9
8
|
* @nolint
|
|
10
|
-
* @
|
|
9
|
+
* @flow strict-local
|
|
10
|
+
* @generated SignedSource<<62e766b69d440dab0a2d249f0cea38e0>>
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
'use strict';
|
|
@@ -12,11 +12,13 @@ import {ColorValue} from '../StyleSheet/StyleSheet';
|
|
|
12
12
|
export type ShareContent =
|
|
13
13
|
| {
|
|
14
14
|
title?: string | undefined;
|
|
15
|
-
|
|
15
|
+
url: string;
|
|
16
|
+
message?: string | undefined;
|
|
16
17
|
}
|
|
17
18
|
| {
|
|
18
19
|
title?: string | undefined;
|
|
19
|
-
url
|
|
20
|
+
url?: string | undefined;
|
|
21
|
+
message: string;
|
|
20
22
|
};
|
|
21
23
|
|
|
22
24
|
export type ShareOptions = {
|
|
@@ -40,29 +42,33 @@ export interface ShareStatic {
|
|
|
40
42
|
* If the user dismissed the dialog, the Promise will still be resolved with action being `Share.dismissedAction`
|
|
41
43
|
* and all the other keys being undefined.
|
|
42
44
|
*
|
|
43
|
-
* In Android, Returns a Promise which always
|
|
45
|
+
* In Android, Returns a Promise which always resolves with action being `Share.sharedAction`.
|
|
44
46
|
*
|
|
45
47
|
* ### Content
|
|
46
48
|
*
|
|
49
|
+
* #### iOS
|
|
50
|
+
*
|
|
51
|
+
* - `url` - a URL to share
|
|
47
52
|
* - `message` - a message to share
|
|
48
|
-
* - `title` - title of the message
|
|
49
53
|
*
|
|
50
|
-
*
|
|
54
|
+
* At least one of `URL` or `message` is required.
|
|
51
55
|
*
|
|
52
|
-
*
|
|
56
|
+
* #### Android
|
|
53
57
|
*
|
|
54
|
-
*
|
|
58
|
+
* - `title` - title of the message (optional)
|
|
59
|
+
* - `message` - a message to share (often will include a URL).
|
|
55
60
|
*
|
|
56
61
|
* ### Options
|
|
57
62
|
*
|
|
58
63
|
* #### iOS
|
|
59
64
|
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
65
|
+
* - `subject` - a subject to share via email
|
|
66
|
+
* - `excludedActivityTypes`
|
|
67
|
+
* - `tintColor`
|
|
62
68
|
*
|
|
63
69
|
* #### Android
|
|
64
70
|
*
|
|
65
|
-
*
|
|
71
|
+
* - `dialogTitle`
|
|
66
72
|
*
|
|
67
73
|
*/
|
|
68
74
|
share(content: ShareContent, options?: ShareOptions): Promise<ShareAction>;
|
package/Libraries/Share/Share.js
CHANGED
|
@@ -15,24 +15,23 @@ const processColor = require('../StyleSheet/processColor').default;
|
|
|
15
15
|
const Platform = require('../Utilities/Platform');
|
|
16
16
|
const invariant = require('invariant');
|
|
17
17
|
|
|
18
|
-
type
|
|
18
|
+
export type ShareContent =
|
|
19
19
|
| {
|
|
20
20
|
title?: string,
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
url: string,
|
|
22
|
+
message?: string,
|
|
23
23
|
}
|
|
24
24
|
| {
|
|
25
25
|
title?: string,
|
|
26
|
-
url
|
|
27
|
-
|
|
26
|
+
url?: string,
|
|
27
|
+
message: string,
|
|
28
28
|
};
|
|
29
|
-
type
|
|
29
|
+
export type ShareOptions = {
|
|
30
30
|
dialogTitle?: string,
|
|
31
31
|
excludedActivityTypes?: Array<string>,
|
|
32
32
|
tintColor?: string,
|
|
33
33
|
subject?: string,
|
|
34
34
|
anchor?: number,
|
|
35
|
-
...
|
|
36
35
|
};
|
|
37
36
|
|
|
38
37
|
class Share {
|
|
@@ -43,21 +42,21 @@ class Share {
|
|
|
43
42
|
* If the user dismissed the dialog, the Promise will still be resolved with action being `Share.dismissedAction`
|
|
44
43
|
* and all the other keys being undefined.
|
|
45
44
|
*
|
|
46
|
-
* In Android, Returns a Promise which always
|
|
45
|
+
* In Android, Returns a Promise which always resolves with action being `Share.sharedAction`.
|
|
47
46
|
*
|
|
48
47
|
* ### Content
|
|
49
48
|
*
|
|
50
|
-
* - `message` - a message to share
|
|
51
|
-
*
|
|
52
49
|
* #### iOS
|
|
53
50
|
*
|
|
54
51
|
* - `url` - a URL to share
|
|
52
|
+
* - `message` - a message to share
|
|
55
53
|
*
|
|
56
|
-
* At least one of URL
|
|
54
|
+
* At least one of `URL` or `message` is required.
|
|
57
55
|
*
|
|
58
56
|
* #### Android
|
|
59
57
|
*
|
|
60
|
-
* - `title` - title of the message
|
|
58
|
+
* - `title` - title of the message (optional)
|
|
59
|
+
* - `message` - a message to share (often will include a URL).
|
|
61
60
|
*
|
|
62
61
|
* ### Options
|
|
63
62
|
*
|
|
@@ -73,8 +72,8 @@ class Share {
|
|
|
73
72
|
*
|
|
74
73
|
*/
|
|
75
74
|
static share(
|
|
76
|
-
content:
|
|
77
|
-
options:
|
|
75
|
+
content: ShareContent,
|
|
76
|
+
options: ShareOptions = {},
|
|
78
77
|
): Promise<{action: string, activityType: ?string}> {
|
|
79
78
|
invariant(
|
|
80
79
|
typeof content === 'object' && content !== null,
|
|
@@ -82,7 +81,7 @@ class Share {
|
|
|
82
81
|
);
|
|
83
82
|
invariant(
|
|
84
83
|
typeof content.url === 'string' || typeof content.message === 'string',
|
|
85
|
-
'At least one of URL
|
|
84
|
+
'At least one of URL or message is required',
|
|
86
85
|
);
|
|
87
86
|
invariant(
|
|
88
87
|
typeof options === 'object' && options !== null,
|
|
@@ -14,7 +14,7 @@ export interface StyleSheetProperties {
|
|
|
14
14
|
flatten<T extends string>(style: T): T;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
type Falsy = undefined | null | false;
|
|
17
|
+
type Falsy = undefined | null | false | '';
|
|
18
18
|
interface RecursiveArray<T>
|
|
19
19
|
extends Array<T | ReadonlyArray<T> | RecursiveArray<T>> {}
|
|
20
20
|
/** Keep a brand of 'T' so that calls to `StyleSheet.flatten` can take `RegisteredStyle<T>` and return `T`. */
|
|
@@ -23,6 +23,8 @@ import type {
|
|
|
23
23
|
____ViewStyleProp_Internal,
|
|
24
24
|
} from './StyleSheetTypes';
|
|
25
25
|
|
|
26
|
+
import composeStyles from '../../src/private/core/composeStyles';
|
|
27
|
+
|
|
26
28
|
const ReactNativeStyleAttributes = require('../Components/View/ReactNativeStyleAttributes');
|
|
27
29
|
const PixelRatio = require('../Utilities/PixelRatio').default;
|
|
28
30
|
const flatten = require('./flattenStyle');
|
|
@@ -268,16 +270,7 @@ module.exports = {
|
|
|
268
270
|
* array, saving allocations and maintaining reference equality for
|
|
269
271
|
* PureComponent checks.
|
|
270
272
|
*/
|
|
271
|
-
compose
|
|
272
|
-
style1: ?T,
|
|
273
|
-
style2: ?T,
|
|
274
|
-
): ?T | $ReadOnlyArray<T> {
|
|
275
|
-
if (style1 != null && style2 != null) {
|
|
276
|
-
return ([style1, style2]: $ReadOnlyArray<T>);
|
|
277
|
-
} else {
|
|
278
|
-
return style1 != null ? style1 : style2;
|
|
279
|
-
}
|
|
280
|
-
},
|
|
273
|
+
compose: composeStyles,
|
|
281
274
|
|
|
282
275
|
/**
|
|
283
276
|
* Flattens an array of style objects, into one aggregated style object.
|
|
@@ -23,6 +23,8 @@ import type {
|
|
|
23
23
|
____ViewStyleProp_Internal,
|
|
24
24
|
} from './StyleSheetTypes';
|
|
25
25
|
|
|
26
|
+
import composeStyles from '../../src/private/core/composeStyles';
|
|
27
|
+
|
|
26
28
|
const ReactNativeStyleAttributes = require('../Components/View/ReactNativeStyleAttributes');
|
|
27
29
|
const PixelRatio = require('../Utilities/PixelRatio').default;
|
|
28
30
|
const Platform = require('../Utilities/Platform'); // [Win32]
|
|
@@ -270,16 +272,7 @@ module.exports = {
|
|
|
270
272
|
* array, saving allocations and maintaining reference equality for
|
|
271
273
|
* PureComponent checks.
|
|
272
274
|
*/
|
|
273
|
-
compose
|
|
274
|
-
style1: ?T,
|
|
275
|
-
style2: ?T,
|
|
276
|
-
): ?T | $ReadOnlyArray<T> {
|
|
277
|
-
if (style1 != null && style2 != null) {
|
|
278
|
-
return ([style1, style2]: $ReadOnlyArray<T>);
|
|
279
|
-
} else {
|
|
280
|
-
return style1 != null ? style1 : style2;
|
|
281
|
-
}
|
|
282
|
-
},
|
|
275
|
+
compose: composeStyles,
|
|
283
276
|
|
|
284
277
|
/**
|
|
285
278
|
* Flattens an array of style objects, into one aggregated style object.
|
|
@@ -65,9 +65,9 @@ export interface FlexStyle {
|
|
|
65
65
|
| 'row-reverse'
|
|
66
66
|
| 'column-reverse'
|
|
67
67
|
| undefined;
|
|
68
|
-
rowGap?: number | undefined;
|
|
69
|
-
gap?: number | undefined;
|
|
70
|
-
columnGap?: number | undefined;
|
|
68
|
+
rowGap?: number | string | undefined;
|
|
69
|
+
gap?: number | string | undefined;
|
|
70
|
+
columnGap?: number | string | undefined;
|
|
71
71
|
flexGrow?: number | undefined;
|
|
72
72
|
flexShrink?: number | undefined;
|
|
73
73
|
flexWrap?: 'wrap' | 'nowrap' | 'wrap-reverse' | undefined;
|
|
@@ -237,10 +237,10 @@ export interface ViewStyle extends FlexStyle, ShadowStyleIOS, TransformsStyle {
|
|
|
237
237
|
borderBlockEndColor?: ColorValue | undefined;
|
|
238
238
|
borderBlockStartColor?: ColorValue | undefined;
|
|
239
239
|
borderBottomColor?: ColorValue | undefined;
|
|
240
|
-
borderBottomEndRadius?: AnimatableNumericValue | undefined;
|
|
241
|
-
borderBottomLeftRadius?: AnimatableNumericValue | undefined;
|
|
242
|
-
borderBottomRightRadius?: AnimatableNumericValue | undefined;
|
|
243
|
-
borderBottomStartRadius?: AnimatableNumericValue | undefined;
|
|
240
|
+
borderBottomEndRadius?: AnimatableNumericValue | string | undefined;
|
|
241
|
+
borderBottomLeftRadius?: AnimatableNumericValue | string | undefined;
|
|
242
|
+
borderBottomRightRadius?: AnimatableNumericValue | string | undefined;
|
|
243
|
+
borderBottomStartRadius?: AnimatableNumericValue | string | undefined;
|
|
244
244
|
borderColor?: ColorValue | undefined;
|
|
245
245
|
/**
|
|
246
246
|
* On iOS 13+, it is possible to change the corner curve of borders.
|
|
@@ -248,20 +248,20 @@ export interface ViewStyle extends FlexStyle, ShadowStyleIOS, TransformsStyle {
|
|
|
248
248
|
*/
|
|
249
249
|
borderCurve?: 'circular' | 'continuous' | undefined;
|
|
250
250
|
borderEndColor?: ColorValue | undefined;
|
|
251
|
-
borderEndEndRadius?: AnimatableNumericValue | undefined;
|
|
252
|
-
borderEndStartRadius?: AnimatableNumericValue | undefined;
|
|
251
|
+
borderEndEndRadius?: AnimatableNumericValue | string | undefined;
|
|
252
|
+
borderEndStartRadius?: AnimatableNumericValue | string | undefined;
|
|
253
253
|
borderLeftColor?: ColorValue | undefined;
|
|
254
|
-
borderRadius?: AnimatableNumericValue | undefined;
|
|
254
|
+
borderRadius?: AnimatableNumericValue | string | undefined;
|
|
255
255
|
borderRightColor?: ColorValue | undefined;
|
|
256
256
|
borderStartColor?: ColorValue | undefined;
|
|
257
|
-
borderStartEndRadius?: AnimatableNumericValue | undefined;
|
|
258
|
-
borderStartStartRadius?: AnimatableNumericValue | undefined;
|
|
257
|
+
borderStartEndRadius?: AnimatableNumericValue | string | undefined;
|
|
258
|
+
borderStartStartRadius?: AnimatableNumericValue | string | undefined;
|
|
259
259
|
borderStyle?: 'solid' | 'dotted' | 'dashed' | undefined;
|
|
260
260
|
borderTopColor?: ColorValue | undefined;
|
|
261
|
-
borderTopEndRadius?: AnimatableNumericValue | undefined;
|
|
262
|
-
borderTopLeftRadius?: AnimatableNumericValue | undefined;
|
|
263
|
-
borderTopRightRadius?: AnimatableNumericValue | undefined;
|
|
264
|
-
borderTopStartRadius?: AnimatableNumericValue | undefined;
|
|
261
|
+
borderTopEndRadius?: AnimatableNumericValue | string | undefined;
|
|
262
|
+
borderTopLeftRadius?: AnimatableNumericValue | string | undefined;
|
|
263
|
+
borderTopRightRadius?: AnimatableNumericValue | string | undefined;
|
|
264
|
+
borderTopStartRadius?: AnimatableNumericValue | string | undefined;
|
|
265
265
|
opacity?: AnimatableNumericValue | undefined;
|
|
266
266
|
/**
|
|
267
267
|
* Sets the elevation of a view, using Android's underlying
|
|
@@ -394,13 +394,13 @@ export interface TextStyle extends TextStyleIOS, TextStyleAndroid, ViewStyle {
|
|
|
394
394
|
export interface ImageStyle extends FlexStyle, ShadowStyleIOS, TransformsStyle {
|
|
395
395
|
resizeMode?: ImageResizeMode | undefined;
|
|
396
396
|
backfaceVisibility?: 'visible' | 'hidden' | undefined;
|
|
397
|
-
borderBottomLeftRadius?: AnimatableNumericValue | undefined;
|
|
398
|
-
borderBottomRightRadius?: AnimatableNumericValue | undefined;
|
|
397
|
+
borderBottomLeftRadius?: AnimatableNumericValue | string | undefined;
|
|
398
|
+
borderBottomRightRadius?: AnimatableNumericValue | string | undefined;
|
|
399
399
|
backgroundColor?: ColorValue | undefined;
|
|
400
400
|
borderColor?: ColorValue | undefined;
|
|
401
|
-
borderRadius?: AnimatableNumericValue | undefined;
|
|
402
|
-
borderTopLeftRadius?: AnimatableNumericValue | undefined;
|
|
403
|
-
borderTopRightRadius?: AnimatableNumericValue | undefined;
|
|
401
|
+
borderRadius?: AnimatableNumericValue | string | undefined;
|
|
402
|
+
borderTopLeftRadius?: AnimatableNumericValue | string | undefined;
|
|
403
|
+
borderTopRightRadius?: AnimatableNumericValue | string | undefined;
|
|
404
404
|
overflow?: 'visible' | 'hidden' | undefined;
|
|
405
405
|
overlayColor?: ColorValue | undefined;
|
|
406
406
|
tintColor?: ColorValue | undefined;
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
13
|
import type AnimatedNode from '../Animated/nodes/AnimatedNode';
|
|
14
|
+
import type {FilterPrimitive} from '../StyleSheet/processFilter';
|
|
14
15
|
import type {
|
|
15
16
|
____DangerouslyImpreciseStyle_InternalOverrides,
|
|
16
17
|
____ImageStyle_InternalOverrides,
|
|
@@ -644,9 +645,9 @@ type ____LayoutStyle_Internal = $ReadOnly<{
|
|
|
644
645
|
* between children may be larger than the gap value.
|
|
645
646
|
* See https://developer.mozilla.org/en-US/docs/Web/CSS/gap for more details.
|
|
646
647
|
*/
|
|
647
|
-
rowGap?: number,
|
|
648
|
-
columnGap?: number,
|
|
649
|
-
gap?: number,
|
|
648
|
+
rowGap?: number | string,
|
|
649
|
+
columnGap?: number | string,
|
|
650
|
+
gap?: number | string,
|
|
650
651
|
}>;
|
|
651
652
|
|
|
652
653
|
/**
|
|
@@ -690,10 +691,15 @@ export type ____ShadowStyle_Internal = $ReadOnly<{
|
|
|
690
691
|
...____ShadowStyle_InternalOverrides,
|
|
691
692
|
}>;
|
|
692
693
|
|
|
694
|
+
type ____FilterStyle_Internal = $ReadOnly<{
|
|
695
|
+
experimental_filter?: $ReadOnlyArray<FilterPrimitive>,
|
|
696
|
+
}>;
|
|
697
|
+
|
|
693
698
|
export type ____ViewStyle_InternalCore = $ReadOnly<{
|
|
694
699
|
...$Exact<____LayoutStyle_Internal>,
|
|
695
700
|
...$Exact<____ShadowStyle_Internal>,
|
|
696
701
|
...$Exact<____TransformStyle_Internal>,
|
|
702
|
+
...____FilterStyle_Internal,
|
|
697
703
|
backfaceVisibility?: 'visible' | 'hidden',
|
|
698
704
|
backgroundColor?: ____ColorValue_Internal,
|
|
699
705
|
borderColor?: ____ColorValue_Internal,
|
|
@@ -707,19 +713,19 @@ export type ____ViewStyle_InternalCore = $ReadOnly<{
|
|
|
707
713
|
borderBlockColor?: ____ColorValue_Internal,
|
|
708
714
|
borderBlockEndColor?: ____ColorValue_Internal,
|
|
709
715
|
borderBlockStartColor?: ____ColorValue_Internal,
|
|
710
|
-
borderRadius?: AnimatableNumericValue,
|
|
711
|
-
borderBottomEndRadius?: AnimatableNumericValue,
|
|
712
|
-
borderBottomLeftRadius?: AnimatableNumericValue,
|
|
713
|
-
borderBottomRightRadius?: AnimatableNumericValue,
|
|
714
|
-
borderBottomStartRadius?: AnimatableNumericValue,
|
|
715
|
-
borderEndEndRadius?: AnimatableNumericValue,
|
|
716
|
-
borderEndStartRadius?: AnimatableNumericValue,
|
|
717
|
-
borderStartEndRadius?: AnimatableNumericValue,
|
|
718
|
-
borderStartStartRadius?: AnimatableNumericValue,
|
|
719
|
-
borderTopEndRadius?: AnimatableNumericValue,
|
|
720
|
-
borderTopLeftRadius?: AnimatableNumericValue,
|
|
721
|
-
borderTopRightRadius?: AnimatableNumericValue,
|
|
722
|
-
borderTopStartRadius?: AnimatableNumericValue,
|
|
716
|
+
borderRadius?: AnimatableNumericValue | string,
|
|
717
|
+
borderBottomEndRadius?: AnimatableNumericValue | string,
|
|
718
|
+
borderBottomLeftRadius?: AnimatableNumericValue | string,
|
|
719
|
+
borderBottomRightRadius?: AnimatableNumericValue | string,
|
|
720
|
+
borderBottomStartRadius?: AnimatableNumericValue | string,
|
|
721
|
+
borderEndEndRadius?: AnimatableNumericValue | string,
|
|
722
|
+
borderEndStartRadius?: AnimatableNumericValue | string,
|
|
723
|
+
borderStartEndRadius?: AnimatableNumericValue | string,
|
|
724
|
+
borderStartStartRadius?: AnimatableNumericValue | string,
|
|
725
|
+
borderTopEndRadius?: AnimatableNumericValue | string,
|
|
726
|
+
borderTopLeftRadius?: AnimatableNumericValue | string,
|
|
727
|
+
borderTopRightRadius?: AnimatableNumericValue | string,
|
|
728
|
+
borderTopStartRadius?: AnimatableNumericValue | string,
|
|
723
729
|
borderStyle?: 'solid' | 'dotted' | 'dashed',
|
|
724
730
|
borderWidth?: AnimatableNumericValue,
|
|
725
731
|
borderBottomWidth?: AnimatableNumericValue,
|
|
@@ -921,5 +927,5 @@ export type ____FlattenStyleProp_Internal<
|
|
|
921
927
|
> = TStyleProp extends null | void | false | ''
|
|
922
928
|
? empty
|
|
923
929
|
: TStyleProp extends $ReadOnlyArray<infer V>
|
|
924
|
-
|
|
925
|
-
|
|
930
|
+
? ____FlattenStyleProp_Internal<V>
|
|
931
|
+
: TStyleProp;
|
|
@@ -0,0 +1,132 @@
|
|
|
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
|
+
* @format
|
|
8
|
+
* @flow
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
export type FilterPrimitive =
|
|
14
|
+
| {brightness: number | string}
|
|
15
|
+
| {blur: number | string}
|
|
16
|
+
| {contrast: number | string}
|
|
17
|
+
| {grayscale: number | string}
|
|
18
|
+
| {hueRotate: number | string}
|
|
19
|
+
| {invert: number | string}
|
|
20
|
+
| {opacity: number | string}
|
|
21
|
+
| {saturate: number | string}
|
|
22
|
+
| {sepia: number | string};
|
|
23
|
+
|
|
24
|
+
export default function processFilter(
|
|
25
|
+
filter: $ReadOnlyArray<FilterPrimitive> | string,
|
|
26
|
+
): $ReadOnlyArray<FilterPrimitive> {
|
|
27
|
+
let result: Array<FilterPrimitive> = [];
|
|
28
|
+
if (typeof filter === 'string') {
|
|
29
|
+
// matches on functions with args like "brightness(1.5)"
|
|
30
|
+
const regex = new RegExp(/(\w+)\(([^)]+)\)/g);
|
|
31
|
+
let matches;
|
|
32
|
+
|
|
33
|
+
while ((matches = regex.exec(filter))) {
|
|
34
|
+
const amount = _getFilterAmount(matches[1], matches[2]);
|
|
35
|
+
|
|
36
|
+
if (amount != null) {
|
|
37
|
+
const filterPrimitive = {};
|
|
38
|
+
// $FlowFixMe The key will be the correct one but flow can't see that.
|
|
39
|
+
filterPrimitive[matches[1]] = amount;
|
|
40
|
+
// $FlowFixMe The key will be the correct one but flow can't see that.
|
|
41
|
+
result.push(filterPrimitive);
|
|
42
|
+
} else {
|
|
43
|
+
// If any primitive is invalid then apply none of the filters. This is how
|
|
44
|
+
// web works and makes it clear that something is wrong becuase no
|
|
45
|
+
// graphical effects are happening.
|
|
46
|
+
return [];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
} else {
|
|
50
|
+
for (const filterPrimitive of filter) {
|
|
51
|
+
const [filterName, filterValue] = Object.entries(filterPrimitive)[0];
|
|
52
|
+
const amount = _getFilterAmount(filterName, filterValue);
|
|
53
|
+
|
|
54
|
+
if (amount != null) {
|
|
55
|
+
const resultObject = {};
|
|
56
|
+
// $FlowFixMe
|
|
57
|
+
resultObject[filterName] = amount;
|
|
58
|
+
// $FlowFixMe
|
|
59
|
+
result.push(resultObject);
|
|
60
|
+
} else {
|
|
61
|
+
// If any primitive is invalid then apply none of the filters. This is how
|
|
62
|
+
// web works and makes it clear that something is wrong becuase no
|
|
63
|
+
// graphical effects are happening.
|
|
64
|
+
return [];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return result;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function _getFilterAmount(filterName: string, filterArgs: mixed): ?number {
|
|
73
|
+
let filterArgAsNumber: number;
|
|
74
|
+
let unit: string;
|
|
75
|
+
if (typeof filterArgs === 'string') {
|
|
76
|
+
// matches on args with units like "1.5 5% -80deg"
|
|
77
|
+
const argsWithUnitsRegex = new RegExp(/([+-]?\d*(\.\d+)?)([a-zA-Z%]+)?/g);
|
|
78
|
+
const match = argsWithUnitsRegex.exec(filterArgs);
|
|
79
|
+
|
|
80
|
+
if (!match || isNaN(Number(match[1]))) {
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
filterArgAsNumber = Number(match[1]);
|
|
85
|
+
unit = match[3];
|
|
86
|
+
} else if (typeof filterArgs === 'number') {
|
|
87
|
+
filterArgAsNumber = filterArgs;
|
|
88
|
+
} else {
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
switch (filterName) {
|
|
93
|
+
// Hue rotate takes some angle that can have a unit and can be
|
|
94
|
+
// negative. Additionally, 0 with no unit is allowed.
|
|
95
|
+
case 'hueRotate':
|
|
96
|
+
if (filterArgAsNumber === 0) {
|
|
97
|
+
return 0;
|
|
98
|
+
}
|
|
99
|
+
if (unit !== 'deg' && unit !== 'rad') {
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
return unit === 'rad'
|
|
103
|
+
? (180 * filterArgAsNumber) / Math.PI
|
|
104
|
+
: filterArgAsNumber;
|
|
105
|
+
// blur takes any positive CSS length that is not a percent. In RN
|
|
106
|
+
// we currently only have DIPs, so we are not parsing units here.
|
|
107
|
+
case 'blur':
|
|
108
|
+
if ((unit && unit !== 'px') || filterArgAsNumber < 0) {
|
|
109
|
+
return undefined;
|
|
110
|
+
}
|
|
111
|
+
return filterArgAsNumber;
|
|
112
|
+
// All other filters except take a non negative number or percentage. There
|
|
113
|
+
// are no units associated with this value and percentage numbers map 1-to-1
|
|
114
|
+
// to a non-percentage number (e.g. 50% == 0.5).
|
|
115
|
+
case 'brightness':
|
|
116
|
+
case 'contrast':
|
|
117
|
+
case 'grayscale':
|
|
118
|
+
case 'invert':
|
|
119
|
+
case 'opacity':
|
|
120
|
+
case 'saturate':
|
|
121
|
+
case 'sepia':
|
|
122
|
+
if ((unit && unit !== '%' && unit !== 'px') || filterArgAsNumber < 0) {
|
|
123
|
+
return undefined;
|
|
124
|
+
}
|
|
125
|
+
if (unit === '%') {
|
|
126
|
+
filterArgAsNumber /= 100;
|
|
127
|
+
}
|
|
128
|
+
return filterArgAsNumber;
|
|
129
|
+
default:
|
|
130
|
+
return undefined;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
@@ -68,8 +68,11 @@ const _getKeyAndValueFromCSSTransform: (
|
|
|
68
68
|
| $TEMPORARY$string<'translateX'>
|
|
69
69
|
| $TEMPORARY$string<'translateY'>,
|
|
70
70
|
args: string,
|
|
71
|
-
) => {key: string, value?: number
|
|
72
|
-
|
|
71
|
+
) => {key: string, value?: Array<string | number> | number | string} = (
|
|
72
|
+
key,
|
|
73
|
+
args,
|
|
74
|
+
) => {
|
|
75
|
+
const argsWithUnitsRegex = new RegExp(/([+-]?\d+(\.\d+)?)([a-zA-Z]+|%)?/g);
|
|
73
76
|
|
|
74
77
|
switch (key) {
|
|
75
78
|
case 'matrix':
|
|
@@ -88,7 +91,11 @@ const _getKeyAndValueFromCSSTransform: (
|
|
|
88
91
|
missingUnitOfMeasurement = true;
|
|
89
92
|
}
|
|
90
93
|
|
|
91
|
-
|
|
94
|
+
if (unitOfMeasurement === '%') {
|
|
95
|
+
parsedArgs.push(`${value}%`);
|
|
96
|
+
} else {
|
|
97
|
+
parsedArgs.push(value);
|
|
98
|
+
}
|
|
92
99
|
}
|
|
93
100
|
|
|
94
101
|
if (__DEV__) {
|
|
@@ -256,6 +263,14 @@ function _validateTransform(
|
|
|
256
263
|
break;
|
|
257
264
|
case 'translateX':
|
|
258
265
|
case 'translateY':
|
|
266
|
+
invariant(
|
|
267
|
+
typeof value === 'number' ||
|
|
268
|
+
(typeof value === 'string' && value.endsWith('%')),
|
|
269
|
+
'Transform with key of "%s" must be number or a percentage. Passed value: %s.',
|
|
270
|
+
key,
|
|
271
|
+
stringifySafe(transformation),
|
|
272
|
+
);
|
|
273
|
+
break;
|
|
259
274
|
case 'scale':
|
|
260
275
|
case 'scaleX':
|
|
261
276
|
case 'scaleY':
|