@office-iss/react-native-win32 0.81.2 → 0.82.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 +3 -11
- package/CHANGELOG.json +118 -43
- package/CHANGELOG.md +45 -27
- package/IntegrationTests/IntegrationTestsApp.js +2 -2
- package/IntegrationTests/LayoutEventsTest.js +3 -3
- package/Libraries/ActionSheetIOS/ActionSheetIOS.js +7 -3
- package/Libraries/Alert/RCTAlertManager.android.js +4 -2
- package/Libraries/Animated/Animated.d.ts +2 -0
- package/Libraries/Animated/AnimatedEvent.js +1 -1
- package/Libraries/Animated/AnimatedExports.js.flow +1 -0
- package/Libraries/Animated/AnimatedImplementation.js +4 -2
- package/Libraries/Animated/AnimatedMock.js +1 -1
- package/Libraries/Animated/Easing.js +2 -0
- package/Libraries/Animated/NativeAnimatedAllowlist.js +1 -0
- package/Libraries/Animated/animations/Animation.js +19 -20
- package/Libraries/Animated/animations/TimingAnimation.js +2 -0
- package/Libraries/Animated/components/AnimatedScrollView.js +3 -2
- package/Libraries/Animated/components/AnimatedSectionList.js +1 -1
- package/Libraries/Animated/nodes/AnimatedColor.js +9 -9
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +4 -4
- package/Libraries/Animated/nodes/AnimatedNode.js +14 -7
- package/Libraries/Animated/nodes/AnimatedObject.js +7 -7
- package/Libraries/Animated/nodes/AnimatedProps.js +32 -32
- package/Libraries/Animated/nodes/AnimatedStyle.js +23 -21
- package/Libraries/Animated/nodes/AnimatedTransform.js +6 -6
- package/Libraries/Animated/nodes/AnimatedValue.js +18 -26
- package/Libraries/AppState/AppState.js +8 -4
- package/Libraries/BatchedBridge/BatchedBridge.js +1 -0
- package/Libraries/BatchedBridge/MessageQueue.js +5 -0
- package/Libraries/BatchedBridge/NativeModules.js +1 -1
- package/Libraries/Blob/BlobManager.js +1 -1
- package/Libraries/Blob/URLSearchParams.js +2 -0
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +2 -2
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +2 -2
- package/Libraries/Components/Button.js +1 -1
- package/Libraries/Components/Button.win32.js +1 -1
- package/Libraries/Components/Pressable/Pressable.js +10 -1
- package/Libraries/Components/Pressable/Pressable.win32.js +9 -0
- package/Libraries/Components/Pressable/useAndroidRippleForView.js +2 -2
- package/Libraries/Components/ScrollView/ScrollView.js +13 -4
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +1 -1
- package/Libraries/Components/StatusBar/StatusBar.js +2 -2
- package/Libraries/Components/Switch/Switch.js +1 -1
- package/Libraries/Components/TextInput/TextInput.flow.js +12 -5
- package/Libraries/Components/TextInput/TextInput.flow.win32.js +12 -5
- package/Libraries/Components/TextInput/TextInput.js +14 -5
- package/Libraries/Components/TextInput/TextInput.win32.js +15 -7
- package/Libraries/Components/TextInput/TextInputState.js +1 -1
- package/Libraries/Components/TextInput/TextInputState.win32.js +1 -1
- package/Libraries/Components/TextInput/Win32TextInputNativeComponent.js +2 -3
- package/Libraries/Components/Touchable/TouchableBounce.js +1 -1
- package/Libraries/Components/Touchable/TouchableHighlight.js +1 -1
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +1 -1
- package/Libraries/Components/Touchable/TouchableOpacity.js +1 -1
- package/Libraries/Components/Touchable/TouchableWin32.js +1 -1
- package/Libraries/Components/Touchable/TouchableWin32.js.map +1 -1
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +3 -3
- package/Libraries/Components/View/View.js +81 -167
- package/Libraries/Components/View/View.win32.js +3 -1
- package/Libraries/Core/Devtools/loadBundleFromServer.js +1 -1
- package/Libraries/Core/Devtools/loadBundleFromServer.win32.js +1 -1
- package/Libraries/Core/ExceptionsManager.js +4 -2
- package/Libraries/Core/ReactFiberErrorDialog.js +3 -3
- package/Libraries/Core/ReactNativeVersion.js +37 -10
- package/Libraries/Core/Timers/JSTimers.js +4 -1
- package/Libraries/Core/Timers/NativeTiming.js +1 -0
- package/Libraries/Core/Timers/immediateShim.js +2 -1
- package/Libraries/Core/Timers/queueMicrotask.js +1 -0
- package/Libraries/Core/setUpPerformance.js +3 -4
- package/Libraries/Debugging/DebuggingOverlayRegistry.js +5 -3
- package/Libraries/Image/Image.android.js +327 -111
- package/Libraries/Image/Image.ios.js +6 -1
- package/Libraries/Image/Image.win32.js +6 -1
- package/Libraries/Image/ImageSourceUtils.js +8 -2
- package/Libraries/Image/assetPaths.js +1 -1
- package/Libraries/Image/resolveAssetSource.js +1 -1
- package/Libraries/Image/resolveAssetSource.win32.js +6 -7
- package/Libraries/Interaction/InteractionManager.js +118 -167
- package/Libraries/Interaction/PanResponder.js +7 -52
- package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -0
- package/Libraries/Lists/FlatList.js +5 -6
- package/Libraries/LogBox/Data/LogBoxData.js +5 -2
- package/Libraries/LogBox/Data/parseLogBoxLog.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +2 -2
- package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.win32.js +1 -1
- package/Libraries/Modal/Modal.js +3 -3
- package/Libraries/NativeComponent/NativeComponentRegistry.js +1 -1
- package/Libraries/NativeComponent/ViewConfig.js +2 -2
- package/Libraries/Network/RCTNetworking.android.js +1 -1
- package/Libraries/Network/RCTNetworking.ios.js +1 -1
- package/Libraries/Network/RCTNetworking.win32.js +1 -1
- package/Libraries/Network/XMLHttpRequest.js +20 -5
- package/Libraries/Network/convertRequestBody.js +1 -1
- package/Libraries/PermissionsAndroid/PermissionsAndroid.js +10 -9
- package/Libraries/Pressability/HoverState.js +2 -0
- package/Libraries/Pressability/HoverState.win32.js +2 -0
- package/Libraries/Pressability/Pressability.js +1 -1
- package/Libraries/Pressability/Pressability.win32.js +1 -1
- package/Libraries/PushNotificationIOS/PushNotificationIOS.js +2 -2
- package/Libraries/ReactNative/AppRegistryImpl.js +4 -2
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +2 -0
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +3 -3
- package/Libraries/ReactNative/RendererImplementation.js +116 -116
- package/Libraries/ReactNative/UIManager.js +3 -3
- package/Libraries/ReactNative/renderApplication.js +1 -0
- package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +1 -1
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +38 -35
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +51 -22
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +54 -24
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +36 -33
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +5 -5
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +5 -5
- package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +3 -1
- package/Libraries/Share/Share.js +4 -0
- package/Libraries/StyleSheet/PlatformColorValueTypes.android.js +2 -2
- package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +2 -2
- package/Libraries/StyleSheet/PlatformColorValueTypes.win32.js +4 -0
- package/Libraries/StyleSheet/StyleSheet.d.ts +7 -22
- package/Libraries/StyleSheet/StyleSheetExports.js +2 -8
- package/Libraries/StyleSheet/StyleSheetExports.js.flow +11 -18
- package/Libraries/StyleSheet/flattenStyle.js +2 -2
- package/Libraries/StyleSheet/processAspectRatio.js +2 -0
- package/Libraries/StyleSheet/processFilter.js +5 -5
- package/Libraries/StyleSheet/splitLayoutProps.js +2 -2
- package/Libraries/Text/Text.js +534 -234
- package/Libraries/Text/Text.win32.js +647 -274
- package/Libraries/Text/TextNativeComponent.js +2 -2
- package/Libraries/Text/TextNativeComponent.win32.js +2 -2
- package/Libraries/Utilities/Appearance.d.ts +3 -5
- package/Libraries/Utilities/Appearance.js +5 -17
- package/Libraries/Utilities/HMRClient.js +2 -1
- package/Libraries/Utilities/Platform.android.js +3 -3
- package/Libraries/Utilities/Platform.d.ts +1 -0
- package/Libraries/Utilities/Platform.ios.js +1 -1
- package/Libraries/Utilities/Platform.win32.js +3 -3
- package/Libraries/Utilities/PlatformTypes.js +1 -1
- package/Libraries/Utilities/ReactNativeTestTools.js +12 -0
- package/Libraries/Utilities/SceneTracker.js +1 -1
- package/Libraries/Utilities/codegenNativeCommands.js +1 -1
- package/Libraries/Utilities/codegenNativeComponent.js +1 -1
- package/Libraries/Utilities/createPerformanceLogger.js +32 -0
- package/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js +2 -0
- package/Libraries/Utilities/differ/pointsDiffer.js +1 -1
- package/Libraries/Utilities/useMergeRefs.js +1 -1
- package/Libraries/WebSocket/WebSocketInterceptor.js +2 -0
- package/Libraries/promiseRejectionTrackingOptions.js +17 -31
- package/Libraries/vendor/emitter/EventEmitter.js +1 -1
- package/flow/bom.js.flow +223 -1
- package/flow/prettier.js.flow +14 -0
- package/index.js +14 -2
- package/index.win32.js +16 -2
- package/jest/local-setup.js +2 -2
- package/jest/mock.js +1 -1
- package/jest/mockComponent.js +9 -9
- package/jest/mockNativeComponent.js +3 -2
- package/jest/mocks/Modal.js +1 -1
- package/jest/mocks/ScrollView.js +1 -1
- package/jest/mocks/ViewNativeComponent.js +1 -1
- package/jest/setup.js +23 -12
- package/overrides.json +23 -23
- package/package.json +28 -27
- package/saveAssetPlugin.js +2 -2
- package/src/private/animated/NativeAnimatedHelper.js +16 -5
- package/src/private/animated/NativeAnimatedHelper.win32.js +16 -5
- package/src/private/animated/createAnimatedPropsHook.js +11 -60
- package/src/private/animated/createAnimatedPropsMemoHook.js +8 -54
- package/src/private/components/virtualview/VirtualView.js +43 -12
- package/src/private/components/virtualview/VirtualViewExperimentalNativeComponent.js +93 -0
- package/src/private/components/virtualview/VirtualViewNativeComponent.js +6 -0
- package/src/private/devsupport/devmenu/elementinspector/Inspector.js +2 -2
- package/src/private/devsupport/devmenu/elementinspector/ReactDevToolsOverlay.js +2 -2
- package/src/private/featureflags/ReactNativeFeatureFlags.js +85 -52
- package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +23 -4
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +15 -6
- package/src/private/renderer/errorhandling/ErrorHandlers.js +3 -3
- package/src/private/setup/{setUpPerformanceObserver.js → setUpPerformanceModern.js} +43 -18
- package/src/private/specs_DEPRECATED/modules/NativeTiming.js +1 -0
- package/src/private/types/HostInstance.js +4 -1
- package/src/private/webapis/dom/nodes/ReactNativeDocument.js +22 -2
- package/src/private/webapis/dom/nodes/ReactNativeElement.js +1 -1
- package/src/private/webapis/dom/nodes/ReadOnlyElement.js +5 -3
- package/src/private/webapis/dom/nodes/ReadOnlyNode.js +16 -13
- package/src/private/webapis/dom/nodes/internals/NodeInternals.js +45 -22
- package/src/private/webapis/dom/nodes/internals/ReactNativeDocumentInstanceHandle.js +1 -1
- package/src/private/webapis/dom/nodes/specs/NativeDOM.js +26 -192
- package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +15 -12
- package/src/private/webapis/dom/oldstylecollections/NodeList.js +14 -11
- package/src/private/webapis/geometry/DOMRectList.js +2 -2
- package/src/private/webapis/intersectionobserver/internals/IntersectionObserverManager.js +19 -74
- package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +0 -4
- package/src/private/webapis/mutationobserver/internals/MutationObserverManager.js +1 -1
- package/src/private/webapis/performance/EventTiming.js +40 -25
- package/src/private/webapis/performance/LongTasks.js +35 -2
- package/src/private/webapis/performance/Performance.js +347 -166
- package/src/private/webapis/performance/PerformanceEntry.js +40 -23
- package/src/private/webapis/performance/PerformanceObserver.js +37 -29
- package/src/private/webapis/performance/ReactNativeStartupTiming.js +3 -24
- package/src/private/webapis/performance/ResourceTiming.js +29 -18
- package/src/private/webapis/performance/UserTiming.js +92 -34
- package/src/private/webapis/performance/UserTimingExtensibility.js.flow +38 -0
- package/src/private/webapis/performance/internals/RawPerformanceEntry.js +3 -4
- package/src/private/webapis/performance/internals/Utilities.js +9 -0
- package/src/private/webapis/performance/specs/NativePerformance.js +23 -23
- package/src/private/webapis/structuredClone/structuredClone.js +10 -10
- package/src-win/Libraries/Components/Touchable/TouchableWin32.tsx +1 -1
- package/Libraries/Interaction/InteractionManagerStub.js +0 -184
- package/Libraries/Interaction/TaskQueue.js +0 -183
- package/Libraries/ReactNative/ReactNativeFeatureFlags.js +0 -31
|
@@ -41,9 +41,9 @@ let startNativeAnimationNextId = 1;
|
|
|
41
41
|
// Once an animation has been stopped or finished its course, it will
|
|
42
42
|
// not be reused.
|
|
43
43
|
export default class Animation {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
_nativeID: ?number;
|
|
45
|
+
_onEnd: ?EndCallback;
|
|
46
|
+
_useNativeDriver: boolean;
|
|
47
47
|
|
|
48
48
|
__active: boolean;
|
|
49
49
|
__isInteraction: boolean;
|
|
@@ -52,10 +52,10 @@ export default class Animation {
|
|
|
52
52
|
__debugID: ?string;
|
|
53
53
|
|
|
54
54
|
constructor(config: AnimationConfig) {
|
|
55
|
-
this
|
|
55
|
+
this._useNativeDriver = NativeAnimatedHelper.shouldUseNativeDriver(config);
|
|
56
56
|
|
|
57
57
|
this.__active = false;
|
|
58
|
-
this.__isInteraction = config.isInteraction ?? !this
|
|
58
|
+
this.__isInteraction = config.isInteraction ?? !this._useNativeDriver;
|
|
59
59
|
this.__isLooping = config.isLooping;
|
|
60
60
|
this.__iterations = config.iterations ?? 1;
|
|
61
61
|
if (__DEV__) {
|
|
@@ -70,7 +70,7 @@ export default class Animation {
|
|
|
70
70
|
previousAnimation: ?Animation,
|
|
71
71
|
animatedValue: AnimatedValue,
|
|
72
72
|
): void {
|
|
73
|
-
if (!this
|
|
73
|
+
if (!this._useNativeDriver && animatedValue.__isNative === true) {
|
|
74
74
|
throw new Error(
|
|
75
75
|
'Attempting to run JS driven animation on animated node ' +
|
|
76
76
|
'that has been moved to "native" earlier by starting an ' +
|
|
@@ -78,13 +78,13 @@ export default class Animation {
|
|
|
78
78
|
);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
this
|
|
81
|
+
this._onEnd = onEnd;
|
|
82
82
|
this.__active = true;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
stop(): void {
|
|
86
|
-
if (this
|
|
87
|
-
const nativeID = this
|
|
86
|
+
if (this._nativeID != null) {
|
|
87
|
+
const nativeID = this._nativeID;
|
|
88
88
|
const identifier = `${nativeID}:stopAnimation`;
|
|
89
89
|
try {
|
|
90
90
|
// This is only required when singleOpBatching is used, as otherwise
|
|
@@ -123,7 +123,7 @@ export default class Animation {
|
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
__startAnimationIfNative(animatedValue: AnimatedValue): boolean {
|
|
126
|
-
if (!this
|
|
126
|
+
if (!this._useNativeDriver) {
|
|
127
127
|
return false;
|
|
128
128
|
}
|
|
129
129
|
|
|
@@ -135,9 +135,9 @@ export default class Animation {
|
|
|
135
135
|
try {
|
|
136
136
|
const config = this.__getNativeAnimationConfig();
|
|
137
137
|
animatedValue.__makeNative(config.platformConfig);
|
|
138
|
-
this
|
|
138
|
+
this._nativeID = NativeAnimatedHelper.generateNewAnimationId();
|
|
139
139
|
NativeAnimatedHelper.API.startAnimatingNode(
|
|
140
|
-
this
|
|
140
|
+
this._nativeID,
|
|
141
141
|
animatedValue.__getNativeTag(),
|
|
142
142
|
config,
|
|
143
143
|
result => {
|
|
@@ -150,12 +150,11 @@ export default class Animation {
|
|
|
150
150
|
if (value != null) {
|
|
151
151
|
animatedValue.__onAnimatedValueUpdateReceived(value, offset);
|
|
152
152
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
) {
|
|
153
|
+
const isJsSyncRemoved =
|
|
154
|
+
ReactNativeFeatureFlags.cxxNativeAnimatedEnabled() &&
|
|
155
|
+
!ReactNativeFeatureFlags.disableFabricCommitInCXXAnimated() &&
|
|
156
|
+
ReactNativeFeatureFlags.cxxNativeAnimatedRemoveJsSync();
|
|
157
|
+
if (!isJsSyncRemoved) {
|
|
159
158
|
if (this.__isLooping === true) {
|
|
160
159
|
return;
|
|
161
160
|
}
|
|
@@ -185,9 +184,9 @@ export default class Animation {
|
|
|
185
184
|
* callback will never be called more than once.
|
|
186
185
|
*/
|
|
187
186
|
__notifyAnimationEnd(result: EndResult): void {
|
|
188
|
-
const callback = this
|
|
187
|
+
const callback = this._onEnd;
|
|
189
188
|
if (callback != null) {
|
|
190
|
-
this
|
|
189
|
+
this._onEnd = null;
|
|
191
190
|
callback(result);
|
|
192
191
|
}
|
|
193
192
|
}
|
|
@@ -49,6 +49,8 @@ export type TimingAnimationConfigSingle = $ReadOnly<{
|
|
|
49
49
|
|
|
50
50
|
let _easeInOut;
|
|
51
51
|
function easeInOut() {
|
|
52
|
+
/* $FlowFixMe[constant-condition] Error discovered during Constant Condition
|
|
53
|
+
* roll out. See https://fburl.com/workplace/1v97vimq. */
|
|
52
54
|
if (!_easeInOut) {
|
|
53
55
|
const Easing = require('../Easing').default;
|
|
54
56
|
_easeInOut = Easing.inOut(Easing.ease);
|
|
@@ -54,7 +54,8 @@ const AnimatedScrollView: AnimatedComponentType<
|
|
|
54
54
|
props.style != null
|
|
55
55
|
) {
|
|
56
56
|
return (
|
|
57
|
-
// $FlowFixMe - It should return an Animated ScrollView but it returns a ScrollView with Animated props applied.
|
|
57
|
+
// $FlowFixMe[incompatible-type] - It should return an Animated ScrollView but it returns a ScrollView with Animated props applied.
|
|
58
|
+
// $FlowFixMe[incompatible-variance]
|
|
58
59
|
<AnimatedScrollViewWithInvertedRefreshControl
|
|
59
60
|
scrollEventThrottle={0.0001}
|
|
60
61
|
{...props}
|
|
@@ -89,7 +90,7 @@ const AnimatedScrollViewWithInvertedRefreshControl =
|
|
|
89
90
|
const {intermediatePropsForRefreshControl, intermediatePropsForScrollView} =
|
|
90
91
|
useMemo(() => {
|
|
91
92
|
// $FlowFixMe[underconstrained-implicit-instantiation]
|
|
92
|
-
// $FlowFixMe[incompatible-
|
|
93
|
+
// $FlowFixMe[incompatible-type]
|
|
93
94
|
const {outer, inner} = splitLayoutProps(flattenStyle(props.style));
|
|
94
95
|
return {
|
|
95
96
|
intermediatePropsForRefreshControl: {style: outer},
|
|
@@ -14,7 +14,7 @@ import SectionList, {type SectionListProps} from '../../Lists/SectionList';
|
|
|
14
14
|
import createAnimatedComponent from '../createAnimatedComponent';
|
|
15
15
|
import * as React from 'react';
|
|
16
16
|
|
|
17
|
-
// $FlowFixMe
|
|
17
|
+
// $FlowFixMe[incompatible-type]
|
|
18
18
|
export default (createAnimatedComponent(SectionList): component<
|
|
19
19
|
// $FlowExpectedError[unclear-type]
|
|
20
20
|
ItemT = any,
|
|
@@ -60,12 +60,12 @@ function processColor(
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
if (isRgbaValue(color)) {
|
|
63
|
-
// $
|
|
63
|
+
// $FlowFixMe[incompatible-type] - Type is verified above
|
|
64
64
|
return (color: RgbaValue);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
let normalizedColor: ?ProcessedColorValue = normalizeColor(
|
|
68
|
-
// $
|
|
68
|
+
// $FlowFixMe[incompatible-type] - Type is verified above
|
|
69
69
|
(color: ColorValue),
|
|
70
70
|
);
|
|
71
71
|
if (normalizedColor === undefined || normalizedColor === null) {
|
|
@@ -125,7 +125,7 @@ export default class AnimatedColor extends AnimatedWithChildren {
|
|
|
125
125
|
let value: RgbaValue | RgbaAnimatedValue | ColorValue =
|
|
126
126
|
valueIn ?? defaultColor;
|
|
127
127
|
if (isRgbaAnimatedValue(value)) {
|
|
128
|
-
// $
|
|
128
|
+
// $FlowFixMe[incompatible-type] - Type is verified above
|
|
129
129
|
const rgbaAnimatedValue: RgbaAnimatedValue = (value: RgbaAnimatedValue);
|
|
130
130
|
this.r = rgbaAnimatedValue.r;
|
|
131
131
|
this.g = rgbaAnimatedValue.g;
|
|
@@ -133,14 +133,14 @@ export default class AnimatedColor extends AnimatedWithChildren {
|
|
|
133
133
|
this.a = rgbaAnimatedValue.a;
|
|
134
134
|
} else {
|
|
135
135
|
const processedColor: RgbaValue | NativeColorValue =
|
|
136
|
-
// $
|
|
136
|
+
// $FlowFixMe[incompatible-type] - Type is verified above
|
|
137
137
|
processColor((value: ColorValue | RgbaValue)) ?? defaultColor;
|
|
138
138
|
let initColor: RgbaValue = defaultColor;
|
|
139
139
|
if (isRgbaValue(processedColor)) {
|
|
140
|
-
// $
|
|
140
|
+
// $FlowFixMe[incompatible-type] - Type is verified above
|
|
141
141
|
initColor = (processedColor: RgbaValue);
|
|
142
142
|
} else {
|
|
143
|
-
// $
|
|
143
|
+
// $FlowFixMe[incompatible-type] - Type is verified above
|
|
144
144
|
this.nativeColor = (processedColor: NativeColorValue);
|
|
145
145
|
}
|
|
146
146
|
|
|
@@ -170,7 +170,7 @@ export default class AnimatedColor extends AnimatedWithChildren {
|
|
|
170
170
|
processColor(value) ?? defaultColor;
|
|
171
171
|
this._withSuspendedCallbacks(() => {
|
|
172
172
|
if (isRgbaValue(processedColor)) {
|
|
173
|
-
// $
|
|
173
|
+
// $FlowFixMe[incompatible-type] - Type is verified above
|
|
174
174
|
const rgbaValue: RgbaValue = processedColor;
|
|
175
175
|
this.r.setValue(rgbaValue.r);
|
|
176
176
|
this.g.setValue(rgbaValue.g);
|
|
@@ -181,7 +181,7 @@ export default class AnimatedColor extends AnimatedWithChildren {
|
|
|
181
181
|
shouldUpdateNodeConfig = true;
|
|
182
182
|
}
|
|
183
183
|
} else {
|
|
184
|
-
// $
|
|
184
|
+
// $FlowFixMe[incompatible-type] - Type is verified above
|
|
185
185
|
const nativeColor: NativeColorValue = processedColor;
|
|
186
186
|
if (this.nativeColor !== nativeColor) {
|
|
187
187
|
this.nativeColor = nativeColor;
|
|
@@ -203,7 +203,7 @@ export default class AnimatedColor extends AnimatedWithChildren {
|
|
|
203
203
|
flushValue(this);
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
// $FlowFixMe[incompatible-
|
|
206
|
+
// $FlowFixMe[incompatible-type]
|
|
207
207
|
this.__callListeners(this.__getValue());
|
|
208
208
|
}
|
|
209
209
|
|
|
@@ -224,7 +224,7 @@ function createStringInterpolation(
|
|
|
224
224
|
outputRange.every(output =>
|
|
225
225
|
output.components.every(
|
|
226
226
|
(component, i) =>
|
|
227
|
-
// $
|
|
227
|
+
// $FlowFixMe[invalid-compare]
|
|
228
228
|
typeof component === 'number' || component === firstOutput[i],
|
|
229
229
|
),
|
|
230
230
|
),
|
|
@@ -235,9 +235,9 @@ function createStringInterpolation(
|
|
|
235
235
|
const numericComponents: $ReadOnlyArray<$ReadOnlyArray<number>> =
|
|
236
236
|
outputRange.map(output =>
|
|
237
237
|
isColor
|
|
238
|
-
? // $
|
|
238
|
+
? // $FlowFixMe[incompatible-type]
|
|
239
239
|
output.components
|
|
240
|
-
: // $
|
|
240
|
+
: // $FlowFixMe[incompatible-call]
|
|
241
241
|
output.components.filter(c => typeof c === 'number'),
|
|
242
242
|
);
|
|
243
243
|
const interpolations = numericComponents[0].map((_, i) =>
|
|
@@ -393,7 +393,7 @@ export default class AnimatedInterpolation<
|
|
|
393
393
|
let outputRange = this._config.outputRange;
|
|
394
394
|
let outputType = null;
|
|
395
395
|
if (typeof outputRange[0] === 'string') {
|
|
396
|
-
// $
|
|
396
|
+
// $FlowFixMe[incompatible-type]
|
|
397
397
|
outputRange = ((outputRange: $ReadOnlyArray<string>).map(value => {
|
|
398
398
|
const processedColor = processColor(value);
|
|
399
399
|
if (typeof processedColor === 'number') {
|
|
@@ -17,6 +17,7 @@ type ValueListenerCallback = (state: {value: number, ...}) => mixed;
|
|
|
17
17
|
|
|
18
18
|
export type AnimatedNodeConfig = $ReadOnly<{
|
|
19
19
|
debugID?: string,
|
|
20
|
+
unstable_disableBatchingForNativeCreate?: boolean,
|
|
20
21
|
}>;
|
|
21
22
|
|
|
22
23
|
let _uniqueId = 1;
|
|
@@ -28,7 +29,7 @@ let _assertNativeAnimatedModule: ?() => void = () => {
|
|
|
28
29
|
};
|
|
29
30
|
|
|
30
31
|
export default class AnimatedNode {
|
|
31
|
-
|
|
32
|
+
_listeners: Map<string, ValueListenerCallback>;
|
|
32
33
|
|
|
33
34
|
_platformConfig: ?PlatformConfig = undefined;
|
|
34
35
|
|
|
@@ -38,10 +39,12 @@ export default class AnimatedNode {
|
|
|
38
39
|
...
|
|
39
40
|
}>,
|
|
40
41
|
) {
|
|
41
|
-
this
|
|
42
|
+
this._listeners = new Map();
|
|
42
43
|
if (__DEV__) {
|
|
43
44
|
this.__debugID = config?.debugID;
|
|
44
45
|
}
|
|
46
|
+
this.__disableBatchingForNativeCreate =
|
|
47
|
+
config?.unstable_disableBatchingForNativeCreate;
|
|
45
48
|
}
|
|
46
49
|
|
|
47
50
|
__attach(): void {}
|
|
@@ -65,6 +68,7 @@ export default class AnimatedNode {
|
|
|
65
68
|
/* Methods and props used by native Animated impl */
|
|
66
69
|
__isNative: boolean = false;
|
|
67
70
|
__nativeTag: ?number = undefined;
|
|
71
|
+
__disableBatchingForNativeCreate: ?boolean = undefined;
|
|
68
72
|
|
|
69
73
|
__makeNative(platformConfig: ?PlatformConfig): void {
|
|
70
74
|
// Subclasses are expected to set `__isNative` to true before this.
|
|
@@ -85,7 +89,7 @@ export default class AnimatedNode {
|
|
|
85
89
|
*/
|
|
86
90
|
addListener(callback: (value: any) => mixed): string {
|
|
87
91
|
const id = String(_uniqueId++);
|
|
88
|
-
this
|
|
92
|
+
this._listeners.set(id, callback);
|
|
89
93
|
return id;
|
|
90
94
|
}
|
|
91
95
|
|
|
@@ -96,7 +100,7 @@ export default class AnimatedNode {
|
|
|
96
100
|
* See https://reactnative.dev/docs/animatedvalue#removelistener
|
|
97
101
|
*/
|
|
98
102
|
removeListener(id: string): void {
|
|
99
|
-
this
|
|
103
|
+
this._listeners.delete(id);
|
|
100
104
|
}
|
|
101
105
|
|
|
102
106
|
/**
|
|
@@ -105,11 +109,11 @@ export default class AnimatedNode {
|
|
|
105
109
|
* See https://reactnative.dev/docs/animatedvalue#removealllisteners
|
|
106
110
|
*/
|
|
107
111
|
removeAllListeners(): void {
|
|
108
|
-
this
|
|
112
|
+
this._listeners.clear();
|
|
109
113
|
}
|
|
110
114
|
|
|
111
115
|
hasListeners(): boolean {
|
|
112
|
-
return this
|
|
116
|
+
return this._listeners.size > 0;
|
|
113
117
|
}
|
|
114
118
|
|
|
115
119
|
__onAnimatedValueUpdateReceived(value: number, offset: number): void {
|
|
@@ -118,7 +122,7 @@ export default class AnimatedNode {
|
|
|
118
122
|
|
|
119
123
|
__callListeners(value: number): void {
|
|
120
124
|
const event = {value};
|
|
121
|
-
this
|
|
125
|
+
this._listeners.forEach(listener => {
|
|
122
126
|
listener(event);
|
|
123
127
|
});
|
|
124
128
|
}
|
|
@@ -142,6 +146,9 @@ export default class AnimatedNode {
|
|
|
142
146
|
if (this._platformConfig) {
|
|
143
147
|
config.platformConfig = this._platformConfig;
|
|
144
148
|
}
|
|
149
|
+
if (this.__disableBatchingForNativeCreate) {
|
|
150
|
+
config.disableBatchingForNativeCreate = true;
|
|
151
|
+
}
|
|
145
152
|
NativeAnimatedHelper.API.createAnimatedNode(nativeTag, config);
|
|
146
153
|
}
|
|
147
154
|
return nativeTag;
|
|
@@ -21,7 +21,7 @@ const MAX_DEPTH = 5;
|
|
|
21
21
|
|
|
22
22
|
export function isPlainObject(
|
|
23
23
|
value: mixed,
|
|
24
|
-
/* $
|
|
24
|
+
/* $FlowFixMe[incompatible-type-guard] - Flow does not know that the prototype
|
|
25
25
|
and ReactElement checks preserve the type refinement of `value`. */
|
|
26
26
|
): value is $ReadOnly<{[string]: mixed}> {
|
|
27
27
|
return (
|
|
@@ -82,7 +82,7 @@ function mapAnimatedNodes(value: any, fn: any => any, depth: number = 0): any {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
export default class AnimatedObject extends AnimatedWithChildren {
|
|
85
|
-
|
|
85
|
+
_nodes: $ReadOnlyArray<AnimatedNode>;
|
|
86
86
|
_value: mixed;
|
|
87
87
|
|
|
88
88
|
/**
|
|
@@ -106,7 +106,7 @@ export default class AnimatedObject extends AnimatedWithChildren {
|
|
|
106
106
|
config?: ?AnimatedNodeConfig,
|
|
107
107
|
) {
|
|
108
108
|
super(config);
|
|
109
|
-
this
|
|
109
|
+
this._nodes = nodes;
|
|
110
110
|
this._value = value;
|
|
111
111
|
}
|
|
112
112
|
|
|
@@ -117,7 +117,7 @@ export default class AnimatedObject extends AnimatedWithChildren {
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
__getValueWithStaticObject(staticObject: mixed): any {
|
|
120
|
-
const nodes = this
|
|
120
|
+
const nodes = this._nodes;
|
|
121
121
|
let index = 0;
|
|
122
122
|
// NOTE: We can depend on `this._value` and `staticObject` sharing a
|
|
123
123
|
// structure because of `useAnimatedPropsMemo`.
|
|
@@ -131,7 +131,7 @@ export default class AnimatedObject extends AnimatedWithChildren {
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
__attach(): void {
|
|
134
|
-
const nodes = this
|
|
134
|
+
const nodes = this._nodes;
|
|
135
135
|
for (let ii = 0, length = nodes.length; ii < length; ii++) {
|
|
136
136
|
const node = nodes[ii];
|
|
137
137
|
node.__addChild(this);
|
|
@@ -140,7 +140,7 @@ export default class AnimatedObject extends AnimatedWithChildren {
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
__detach(): void {
|
|
143
|
-
const nodes = this
|
|
143
|
+
const nodes = this._nodes;
|
|
144
144
|
for (let ii = 0, length = nodes.length; ii < length; ii++) {
|
|
145
145
|
const node = nodes[ii];
|
|
146
146
|
node.__removeChild(this);
|
|
@@ -149,7 +149,7 @@ export default class AnimatedObject extends AnimatedWithChildren {
|
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
__makeNative(platformConfig: ?PlatformConfig): void {
|
|
152
|
-
const nodes = this
|
|
152
|
+
const nodes = this._nodes;
|
|
153
153
|
for (let ii = 0, length = nodes.length; ii < length; ii++) {
|
|
154
154
|
const node = nodes[ii];
|
|
155
155
|
node.__makeNative(platformConfig);
|
|
@@ -92,11 +92,11 @@ function createAnimatedProps(
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
export default class AnimatedProps extends AnimatedNode {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
95
|
+
_callback: () => void;
|
|
96
|
+
_nodeKeys: $ReadOnlyArray<string>;
|
|
97
|
+
_nodes: $ReadOnlyArray<AnimatedNode>;
|
|
98
|
+
_props: {[string]: mixed};
|
|
99
|
+
_target: ?TargetView = null;
|
|
100
100
|
|
|
101
101
|
constructor(
|
|
102
102
|
inputProps: {[string]: mixed},
|
|
@@ -106,19 +106,19 @@ export default class AnimatedProps extends AnimatedNode {
|
|
|
106
106
|
) {
|
|
107
107
|
super(config);
|
|
108
108
|
const [nodeKeys, nodes, props] = createAnimatedProps(inputProps, allowlist);
|
|
109
|
-
this
|
|
110
|
-
this
|
|
111
|
-
this
|
|
112
|
-
this
|
|
109
|
+
this._nodeKeys = nodeKeys;
|
|
110
|
+
this._nodes = nodes;
|
|
111
|
+
this._props = props;
|
|
112
|
+
this._callback = callback;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
__getValue(): Object {
|
|
116
116
|
const props: {[string]: mixed} = {};
|
|
117
117
|
|
|
118
|
-
const keys = Object.keys(this
|
|
118
|
+
const keys = Object.keys(this._props);
|
|
119
119
|
for (let ii = 0, length = keys.length; ii < length; ii++) {
|
|
120
120
|
const key = keys[ii];
|
|
121
|
-
const value = this
|
|
121
|
+
const value = this._props[key];
|
|
122
122
|
|
|
123
123
|
if (value instanceof AnimatedNode) {
|
|
124
124
|
props[key] = value.__getValue();
|
|
@@ -143,7 +143,7 @@ export default class AnimatedProps extends AnimatedNode {
|
|
|
143
143
|
const keys = Object.keys(staticProps);
|
|
144
144
|
for (let ii = 0, length = keys.length; ii < length; ii++) {
|
|
145
145
|
const key = keys[ii];
|
|
146
|
-
const maybeNode = this
|
|
146
|
+
const maybeNode = this._props[key];
|
|
147
147
|
|
|
148
148
|
if (key === 'style') {
|
|
149
149
|
const staticStyle = staticProps.style;
|
|
@@ -176,10 +176,10 @@ export default class AnimatedProps extends AnimatedNode {
|
|
|
176
176
|
__getNativeAnimatedEventTuples(): $ReadOnlyArray<[string, AnimatedEvent]> {
|
|
177
177
|
const tuples = [];
|
|
178
178
|
|
|
179
|
-
const keys = Object.keys(this
|
|
179
|
+
const keys = Object.keys(this._props);
|
|
180
180
|
for (let ii = 0, length = keys.length; ii < length; ii++) {
|
|
181
181
|
const key = keys[ii];
|
|
182
|
-
const value = this
|
|
182
|
+
const value = this._props[key];
|
|
183
183
|
|
|
184
184
|
if (value instanceof AnimatedEvent && value.__isNative) {
|
|
185
185
|
tuples.push([key, value]);
|
|
@@ -192,8 +192,8 @@ export default class AnimatedProps extends AnimatedNode {
|
|
|
192
192
|
__getAnimatedValue(): Object {
|
|
193
193
|
const props: {[string]: mixed} = {};
|
|
194
194
|
|
|
195
|
-
const nodeKeys = this
|
|
196
|
-
const nodes = this
|
|
195
|
+
const nodeKeys = this._nodeKeys;
|
|
196
|
+
const nodes = this._nodes;
|
|
197
197
|
for (let ii = 0, length = nodes.length; ii < length; ii++) {
|
|
198
198
|
const key = nodeKeys[ii];
|
|
199
199
|
const node = nodes[ii];
|
|
@@ -204,7 +204,7 @@ export default class AnimatedProps extends AnimatedNode {
|
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
__attach(): void {
|
|
207
|
-
const nodes = this
|
|
207
|
+
const nodes = this._nodes;
|
|
208
208
|
for (let ii = 0, length = nodes.length; ii < length; ii++) {
|
|
209
209
|
const node = nodes[ii];
|
|
210
210
|
node.__addChild(this);
|
|
@@ -213,12 +213,12 @@ export default class AnimatedProps extends AnimatedNode {
|
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
__detach(): void {
|
|
216
|
-
if (this.__isNative && this
|
|
217
|
-
this.#disconnectAnimatedView(this
|
|
216
|
+
if (this.__isNative && this._target != null) {
|
|
217
|
+
this.#disconnectAnimatedView(this._target);
|
|
218
218
|
}
|
|
219
|
-
this
|
|
219
|
+
this._target = null;
|
|
220
220
|
|
|
221
|
-
const nodes = this
|
|
221
|
+
const nodes = this._nodes;
|
|
222
222
|
for (let ii = 0, length = nodes.length; ii < length; ii++) {
|
|
223
223
|
const node = nodes[ii];
|
|
224
224
|
node.__removeChild(this);
|
|
@@ -228,11 +228,11 @@ export default class AnimatedProps extends AnimatedNode {
|
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
update(): void {
|
|
231
|
-
this
|
|
231
|
+
this._callback();
|
|
232
232
|
}
|
|
233
233
|
|
|
234
234
|
__makeNative(platformConfig: ?PlatformConfig): void {
|
|
235
|
-
const nodes = this
|
|
235
|
+
const nodes = this._nodes;
|
|
236
236
|
for (let ii = 0, length = nodes.length; ii < length; ii++) {
|
|
237
237
|
const node = nodes[ii];
|
|
238
238
|
node.__makeNative(platformConfig);
|
|
@@ -246,19 +246,19 @@ export default class AnimatedProps extends AnimatedNode {
|
|
|
246
246
|
// where it will be needed to traverse the graph of attached values.
|
|
247
247
|
super.__setPlatformConfig(platformConfig);
|
|
248
248
|
|
|
249
|
-
if (this
|
|
250
|
-
this.#connectAnimatedView(this
|
|
249
|
+
if (this._target != null) {
|
|
250
|
+
this.#connectAnimatedView(this._target);
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
setNativeView(instance: TargetViewInstance): void {
|
|
256
|
-
if (this
|
|
256
|
+
if (this._target?.instance === instance) {
|
|
257
257
|
return;
|
|
258
258
|
}
|
|
259
|
-
this
|
|
259
|
+
this._target = {instance, connectedViewTag: null};
|
|
260
260
|
if (this.__isNative) {
|
|
261
|
-
this.#connectAnimatedView(this
|
|
261
|
+
this.#connectAnimatedView(this._target);
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
|
|
@@ -306,8 +306,8 @@ export default class AnimatedProps extends AnimatedNode {
|
|
|
306
306
|
const platformConfig = this.__getPlatformConfig();
|
|
307
307
|
const propsConfig: {[string]: number} = {};
|
|
308
308
|
|
|
309
|
-
const nodeKeys = this
|
|
310
|
-
const nodes = this
|
|
309
|
+
const nodeKeys = this._nodeKeys;
|
|
310
|
+
const nodes = this._nodes;
|
|
311
311
|
for (let ii = 0, length = nodes.length; ii < length; ii++) {
|
|
312
312
|
const key = nodeKeys[ii];
|
|
313
313
|
const node = nodes[ii];
|
|
@@ -325,8 +325,8 @@ export default class AnimatedProps extends AnimatedNode {
|
|
|
325
325
|
|
|
326
326
|
// Supported versions of JSC do not implement the newer Object.hasOwn. Remove
|
|
327
327
|
// this shim when they do.
|
|
328
|
-
// $
|
|
328
|
+
// $FlowFixMe[method-unbinding]
|
|
329
329
|
const _hasOwnProp = Object.prototype.hasOwnProperty;
|
|
330
330
|
const hasOwn: (obj: $ReadOnly<{...}>, prop: string) => boolean =
|
|
331
|
-
// $
|
|
331
|
+
// $FlowFixMe[method-unbinding]
|
|
332
332
|
Object.hasOwn ?? ((obj, prop) => _hasOwnProp.call(obj, prop));
|
|
@@ -43,7 +43,7 @@ function createAnimatedStyle(
|
|
|
43
43
|
if (value != null && key === 'transform') {
|
|
44
44
|
node = ReactNativeFeatureFlags.shouldUseAnimatedObjectForTransform()
|
|
45
45
|
? AnimatedObject.from(value)
|
|
46
|
-
: // $FlowFixMe[incompatible-
|
|
46
|
+
: // $FlowFixMe[incompatible-type] - `value` is mixed.
|
|
47
47
|
AnimatedTransform.from(value);
|
|
48
48
|
} else if (value instanceof AnimatedNode) {
|
|
49
49
|
node = value;
|
|
@@ -82,10 +82,10 @@ function createAnimatedStyle(
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
export default class AnimatedStyle extends AnimatedWithChildren {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
_originalStyleForWeb: ?mixed;
|
|
86
|
+
_nodeKeys: $ReadOnlyArray<string>;
|
|
87
|
+
_nodes: $ReadOnlyArray<AnimatedNode>;
|
|
88
|
+
_style: {[string]: mixed};
|
|
89
89
|
|
|
90
90
|
/**
|
|
91
91
|
* Creates an `AnimatedStyle` if `value` contains `AnimatedNode` instances.
|
|
@@ -102,6 +102,8 @@ export default class AnimatedStyle extends AnimatedWithChildren {
|
|
|
102
102
|
const [nodeKeys, nodes, style] = createAnimatedStyle(
|
|
103
103
|
flatStyle,
|
|
104
104
|
allowlist,
|
|
105
|
+
/* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
|
|
106
|
+
* roll out. See https://fburl.com/workplace/4oq3zi07. */
|
|
105
107
|
Platform.OS !== 'web',
|
|
106
108
|
);
|
|
107
109
|
if (nodes.length === 0) {
|
|
@@ -118,12 +120,12 @@ export default class AnimatedStyle extends AnimatedWithChildren {
|
|
|
118
120
|
config?: ?AnimatedNodeConfig,
|
|
119
121
|
) {
|
|
120
122
|
super(config);
|
|
121
|
-
this
|
|
122
|
-
this
|
|
123
|
-
this
|
|
123
|
+
this._nodeKeys = nodeKeys;
|
|
124
|
+
this._nodes = nodes;
|
|
125
|
+
this._style = style;
|
|
124
126
|
|
|
125
127
|
if ((Platform.OS as string) === 'web') {
|
|
126
|
-
// $
|
|
128
|
+
// $FlowFixMe[cannot-write] - Intentional shadowing.
|
|
127
129
|
this.__getValueForStyle = resultStyle => [
|
|
128
130
|
originalStyleForWeb,
|
|
129
131
|
resultStyle,
|
|
@@ -134,10 +136,10 @@ export default class AnimatedStyle extends AnimatedWithChildren {
|
|
|
134
136
|
__getValue(): FlatStyleForWeb<FlatStyle> | FlatStyle {
|
|
135
137
|
const style: {[string]: mixed} = {};
|
|
136
138
|
|
|
137
|
-
const keys = Object.keys(this
|
|
139
|
+
const keys = Object.keys(this._style);
|
|
138
140
|
for (let ii = 0, length = keys.length; ii < length; ii++) {
|
|
139
141
|
const key = keys[ii];
|
|
140
|
-
const value = this
|
|
142
|
+
const value = this._style[key];
|
|
141
143
|
|
|
142
144
|
if (value instanceof AnimatedNode) {
|
|
143
145
|
style[key] = value.__getValue();
|
|
@@ -166,7 +168,7 @@ export default class AnimatedStyle extends AnimatedWithChildren {
|
|
|
166
168
|
const keys = Object.keys(style);
|
|
167
169
|
for (let ii = 0, length = keys.length; ii < length; ii++) {
|
|
168
170
|
const key = keys[ii];
|
|
169
|
-
const maybeNode = this
|
|
171
|
+
const maybeNode = this._style[key];
|
|
170
172
|
|
|
171
173
|
if (key === 'transform' && maybeNode instanceof AnimatedTransform) {
|
|
172
174
|
style[key] = maybeNode.__getValueWithStaticTransforms(
|
|
@@ -185,8 +187,8 @@ export default class AnimatedStyle extends AnimatedWithChildren {
|
|
|
185
187
|
__getAnimatedValue(): Object {
|
|
186
188
|
const style: {[string]: mixed} = {};
|
|
187
189
|
|
|
188
|
-
const nodeKeys = this
|
|
189
|
-
const nodes = this
|
|
190
|
+
const nodeKeys = this._nodeKeys;
|
|
191
|
+
const nodes = this._nodes;
|
|
190
192
|
for (let ii = 0, length = nodes.length; ii < length; ii++) {
|
|
191
193
|
const key = nodeKeys[ii];
|
|
192
194
|
const node = nodes[ii];
|
|
@@ -197,7 +199,7 @@ export default class AnimatedStyle extends AnimatedWithChildren {
|
|
|
197
199
|
}
|
|
198
200
|
|
|
199
201
|
__attach(): void {
|
|
200
|
-
const nodes = this
|
|
202
|
+
const nodes = this._nodes;
|
|
201
203
|
for (let ii = 0, length = nodes.length; ii < length; ii++) {
|
|
202
204
|
const node = nodes[ii];
|
|
203
205
|
node.__addChild(this);
|
|
@@ -206,7 +208,7 @@ export default class AnimatedStyle extends AnimatedWithChildren {
|
|
|
206
208
|
}
|
|
207
209
|
|
|
208
210
|
__detach(): void {
|
|
209
|
-
const nodes = this
|
|
211
|
+
const nodes = this._nodes;
|
|
210
212
|
for (let ii = 0, length = nodes.length; ii < length; ii++) {
|
|
211
213
|
const node = nodes[ii];
|
|
212
214
|
node.__removeChild(this);
|
|
@@ -215,7 +217,7 @@ export default class AnimatedStyle extends AnimatedWithChildren {
|
|
|
215
217
|
}
|
|
216
218
|
|
|
217
219
|
__makeNative(platformConfig: ?PlatformConfig) {
|
|
218
|
-
const nodes = this
|
|
220
|
+
const nodes = this._nodes;
|
|
219
221
|
for (let ii = 0, length = nodes.length; ii < length; ii++) {
|
|
220
222
|
const node = nodes[ii];
|
|
221
223
|
node.__makeNative(platformConfig);
|
|
@@ -227,8 +229,8 @@ export default class AnimatedStyle extends AnimatedWithChildren {
|
|
|
227
229
|
const platformConfig = this.__getPlatformConfig();
|
|
228
230
|
const styleConfig: {[string]: ?number} = {};
|
|
229
231
|
|
|
230
|
-
const nodeKeys = this
|
|
231
|
-
const nodes = this
|
|
232
|
+
const nodeKeys = this._nodeKeys;
|
|
233
|
+
const nodes = this._nodes;
|
|
232
234
|
for (let ii = 0, length = nodes.length; ii < length; ii++) {
|
|
233
235
|
const key = nodeKeys[ii];
|
|
234
236
|
const node = nodes[ii];
|
|
@@ -249,8 +251,8 @@ export default class AnimatedStyle extends AnimatedWithChildren {
|
|
|
249
251
|
|
|
250
252
|
// Supported versions of JSC do not implement the newer Object.hasOwn. Remove
|
|
251
253
|
// this shim when they do.
|
|
252
|
-
// $
|
|
254
|
+
// $FlowFixMe[method-unbinding]
|
|
253
255
|
const _hasOwnProp = Object.prototype.hasOwnProperty;
|
|
254
256
|
const hasOwn: (obj: $ReadOnly<{...}>, prop: string) => boolean =
|
|
255
|
-
// $
|
|
257
|
+
// $FlowFixMe[method-unbinding]
|
|
256
258
|
Object.hasOwn ?? ((obj, prop) => _hasOwnProp.call(obj, prop));
|