diff --git a/Libraries/Animated/AnimatedImplementation.js b/Libraries/Animated/AnimatedImplementation.js index 32707208a6ef71..f1c6896be5481d 100644 --- a/Libraries/Animated/AnimatedImplementation.js +++ b/Libraries/Animated/AnimatedImplementation.js @@ -369,7 +369,9 @@ const parallel = function ( ): CompositeAnimation { let doneCount = 0; // Make sure we only call stop() at most once for each animation - const hasEnded = {}; + const hasEnded = { + ...null, + }; const stopTogether = !(config && config.stopTogether === false); const result = { @@ -460,7 +462,10 @@ type LoopAnimationConfig = { const loop = function ( animation: CompositeAnimation, - {iterations = -1, resetBeforeIteration = true}: LoopAnimationConfig = {}, + // $FlowFixMe[prop-missing] + {iterations = -1, resetBeforeIteration = true}: LoopAnimationConfig = { + ...null, + }, ): CompositeAnimation { let isFinished = false; let iterationsSoFar = 0; diff --git a/Libraries/Animated/AnimatedMock.js b/Libraries/Animated/AnimatedMock.js index 6efb74fd003261..636a090d99d1cf 100644 --- a/Libraries/Animated/AnimatedMock.js +++ b/Libraries/Animated/AnimatedMock.js @@ -160,7 +160,10 @@ type LoopAnimationConfig = { const loop = function ( animation: CompositeAnimation, - {iterations = -1}: LoopAnimationConfig = {}, + // $FlowFixMe[prop-missing] + {iterations = -1}: LoopAnimationConfig = { + ...null, + }, ): CompositeAnimation { return emptyAnimation; }; diff --git a/Libraries/Animated/NativeAnimatedHelper.js b/Libraries/Animated/NativeAnimatedHelper.js index 629f13ab0bb68b..9184b12e7a8bc8 100644 --- a/Libraries/Animated/NativeAnimatedHelper.js +++ b/Libraries/Animated/NativeAnimatedHelper.js @@ -48,8 +48,12 @@ const useSingleOpBatching = ReactNativeFeatureFlags.animatedShouldUseSingleOp(); let flushQueueTimeout = null; -const eventListenerGetValueCallbacks = {}; -const eventListenerAnimationFinishedCallbacks = {}; +const eventListenerGetValueCallbacks = { + ...null, +}; +const eventListenerAnimationFinishedCallbacks = { + ...null, +}; let globalEventEmitterGetValueListener: ?EventSubscription = null; let globalEventEmitterAnimationFinishedListener: ?EventSubscription = null; @@ -78,11 +82,17 @@ const nativeOps: ?typeof NativeAnimatedModule = useSingleOpBatching 'addListener', // 20 'removeListener', // 21 ]; - return apis.reduce((acc, functionName, i) => { - // These indices need to be kept in sync with the indices in native (see NativeAnimatedModule in Java, or the equivalent for any other native platform). - acc[functionName] = i + 1; - return acc; - }, {}); + return apis.reduce( + (acc, functionName, i) => { + // These indices need to be kept in sync with the indices in native (see NativeAnimatedModule in Java, or the equivalent for any other native platform). + // $FlowFixMe[prop-missing] + acc[functionName] = i + 1; + return acc; + }, + { + ...null, + }, + ); })(): $FlowFixMe) : NativeAnimatedModule; diff --git a/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExBobble.js b/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExBobble.js index 3b68d395cba89a..264c57805764c3 100644 --- a/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExBobble.js +++ b/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExBobble.js @@ -30,7 +30,10 @@ const BOBBLE_SPOTS = [...Array(NUM_BOBBLES)].map((_, i) => { class AnExBobble extends React.Component { constructor(props: Object) { super(props); - this.state = {}; + this.state = { + ...null, + }; + // $FlowFixMe[prop-missing] this.state.bobbles = BOBBLE_SPOTS.map((_, i) => { return new Animated.ValueXY(); }); @@ -98,7 +101,12 @@ class AnExBobble extends React.Component { {this.state.bobbles.map((_, i) => { const j = this.state.bobbles.length - i - 1; // reverse so lead on top - const handlers = j > 0 ? {} : this.state.bobbleResponder.panHandlers; + const handlers = + j > 0 + ? { + ...null, + } + : this.state.bobbleResponder.panHandlers; return (