diff --git a/Libraries/Animated/AnimatedImplementation.js b/Libraries/Animated/AnimatedImplementation.js index f1c6896be5481d..5aaa29f336537f 100644 --- a/Libraries/Animated/AnimatedImplementation.js +++ b/Libraries/Animated/AnimatedImplementation.js @@ -369,9 +369,7 @@ const parallel = function ( ): CompositeAnimation { let doneCount = 0; // Make sure we only call stop() at most once for each animation - const hasEnded = { - ...null, - }; + const hasEnded = {}; const stopTogether = !(config && config.stopTogether === false); const result = { @@ -463,9 +461,7 @@ type LoopAnimationConfig = { const loop = function ( animation: CompositeAnimation, // $FlowFixMe[prop-missing] - {iterations = -1, resetBeforeIteration = true}: LoopAnimationConfig = { - ...null, - }, + {iterations = -1, resetBeforeIteration = true}: LoopAnimationConfig = {}, ): CompositeAnimation { let isFinished = false; let iterationsSoFar = 0; diff --git a/Libraries/Animated/AnimatedMock.js b/Libraries/Animated/AnimatedMock.js index 636a090d99d1cf..b7af8042fb90e5 100644 --- a/Libraries/Animated/AnimatedMock.js +++ b/Libraries/Animated/AnimatedMock.js @@ -161,9 +161,7 @@ type LoopAnimationConfig = { const loop = function ( animation: CompositeAnimation, // $FlowFixMe[prop-missing] - {iterations = -1}: LoopAnimationConfig = { - ...null, - }, + {iterations = -1}: LoopAnimationConfig = {}, ): CompositeAnimation { return emptyAnimation; }; diff --git a/Libraries/Animated/NativeAnimatedHelper.js b/Libraries/Animated/NativeAnimatedHelper.js index 9184b12e7a8bc8..255f6a3ee9ff55 100644 --- a/Libraries/Animated/NativeAnimatedHelper.js +++ b/Libraries/Animated/NativeAnimatedHelper.js @@ -48,12 +48,8 @@ const useSingleOpBatching = ReactNativeFeatureFlags.animatedShouldUseSingleOp(); let flushQueueTimeout = null; -const eventListenerGetValueCallbacks = { - ...null, -}; -const eventListenerAnimationFinishedCallbacks = { - ...null, -}; +const eventListenerGetValueCallbacks = {}; +const eventListenerAnimationFinishedCallbacks = {}; let globalEventEmitterGetValueListener: ?EventSubscription = null; let globalEventEmitterAnimationFinishedListener: ?EventSubscription = null; @@ -82,17 +78,12 @@ 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). - // $FlowFixMe[prop-missing] - acc[functionName] = i + 1; - return acc; - }, - { - ...null, - }, - ); + 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; + }, {}); })(): $FlowFixMe) : NativeAnimatedModule; diff --git a/Libraries/Components/TextInput/TextInput.js b/Libraries/Components/TextInput/TextInput.js index 4dc547d01c5698..cb71d97bd1d49f 100644 --- a/Libraries/Components/TextInput/TextInput.js +++ b/Libraries/Components/TextInput/TextInput.js @@ -986,7 +986,7 @@ function InternalTextInput(props: Props): React.Node { // that the update should be ignored and we should stick with the value // that we have in JS. useLayoutEffect(() => { - const nativeUpdate: {text?: string, selection?: Selection} = {...null}; + const nativeUpdate: {text?: string, selection?: Selection} = {}; if (lastNativeText !== props.value && typeof props.value === 'string') { nativeUpdate.text = props.value; diff --git a/Libraries/Core/setUpPerformance.js b/Libraries/Core/setUpPerformance.js index d336ca81a7509b..6d59a8657d6ee8 100644 --- a/Libraries/Core/setUpPerformance.js +++ b/Libraries/Core/setUpPerformance.js @@ -11,7 +11,7 @@ 'use strict'; if (!global.performance) { - global.performance = ({...null}: {now?: () => number}); + global.performance = ({}: {now?: () => number}); } /** diff --git a/Libraries/Utilities/__tests__/stringifySafe-test.js b/Libraries/Utilities/__tests__/stringifySafe-test.js index 5453f7d45c08b3..9412614ac29291 100644 --- a/Libraries/Utilities/__tests__/stringifySafe-test.js +++ b/Libraries/Utilities/__tests__/stringifySafe-test.js @@ -33,7 +33,7 @@ describe('stringifySafe', () => { }); it('stringifySafe stringifies circular objects with toString', () => { - const arg: {arg?: {...}} = {...null}; + const arg: {arg?: {...}} = {}; arg.arg = arg; const result = stringifySafe(arg); expect(result).toEqual('[object Object]'); diff --git a/Libraries/WebSocket/WebSocket.js b/Libraries/WebSocket/WebSocket.js index 8904af2251e2f4..82b3fd6a0bf530 100644 --- a/Libraries/WebSocket/WebSocket.js +++ b/Libraries/WebSocket/WebSocket.js @@ -101,7 +101,7 @@ class WebSocket extends (EventTarget(...WEBSOCKET_EVENTS): any) { protocols = [protocols]; } - const {headers = {}, ...unrecognized} = options || {...null}; + const {headers = {}, ...unrecognized} = options || {}; // Preserve deprecated backwards compatibility for the 'origin' option // $FlowFixMe[prop-missing] diff --git a/packages/rn-tester/js/components/RNTesterPage.js b/packages/rn-tester/js/components/RNTesterPage.js index f8206b4ea6c171..3cda7355147746 100644 --- a/packages/rn-tester/js/components/RNTesterPage.js +++ b/packages/rn-tester/js/components/RNTesterPage.js @@ -27,7 +27,7 @@ class RNTesterPage extends React.Component { automaticallyAdjustContentInsets?: boolean, keyboardShouldPersistTaps?: string, keyboardDismissMode?: string, - } = {...null}; + } = {}; if (this.props.noScroll) { ContentWrapper = ((View: any): React.ComponentType); } else { diff --git a/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExBobble.js b/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExBobble.js index 264c57805764c3..0a53c6d03b444b 100644 --- a/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExBobble.js +++ b/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExBobble.js @@ -30,9 +30,7 @@ const BOBBLE_SPOTS = [...Array(NUM_BOBBLES)].map((_, i) => { class AnExBobble extends React.Component { constructor(props: Object) { super(props); - this.state = { - ...null, - }; + this.state = {}; // $FlowFixMe[prop-missing] this.state.bobbles = BOBBLE_SPOTS.map((_, i) => { return new Animated.ValueXY(); @@ -101,12 +99,7 @@ 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 - ? { - ...null, - } - : this.state.bobbleResponder.panHandlers; + const handlers = j > 0 ? {} : this.state.bobbleResponder.panHandlers; return ( { - const a = {...null}; + const a = {}; // $FlowIgnore[prop-missing] // $FlowIgnore[incompatible-use] const b = a.w.q; // js crash here