diff --git a/Libraries/Animated/Animated.js b/Libraries/Animated/Animated.js index 88fd9dbb188dbe..8797bcffcde259 100644 --- a/Libraries/Animated/Animated.js +++ b/Libraries/Animated/Animated.js @@ -9,38 +9,26 @@ */ import Platform from '../Utilities/Platform'; -import typeof AnimatedFlatList from './components/AnimatedFlatList'; -import typeof AnimatedImage from './components/AnimatedImage'; -import typeof AnimatedScrollView from './components/AnimatedScrollView'; -import typeof AnimatedSectionList from './components/AnimatedSectionList'; -import typeof AnimatedText from './components/AnimatedText'; -import typeof AnimatedView from './components/AnimatedView'; +import AnimatedFlatList from './components/AnimatedFlatList'; +import AnimatedImage from './components/AnimatedImage'; +import AnimatedScrollView from './components/AnimatedScrollView'; +import AnimatedSectionList from './components/AnimatedSectionList'; +import AnimatedText from './components/AnimatedText'; +import AnimatedView from './components/AnimatedView'; -import * as AnimatedMock from './AnimatedMock'; -import * as AnimatedImplementation from './AnimatedImplementation'; +import AnimatedMock from './AnimatedMock'; +import AnimatedImplementation from './AnimatedImplementation'; const Animated = ((Platform.isTesting ? AnimatedMock : AnimatedImplementation): typeof AnimatedMock); module.exports = { - get FlatList(): AnimatedFlatList { - return require('./components/AnimatedFlatList'); - }, - get Image(): AnimatedImage { - return require('./components/AnimatedImage'); - }, - get ScrollView(): AnimatedScrollView { - return require('./components/AnimatedScrollView'); - }, - get SectionList(): AnimatedSectionList { - return require('./components/AnimatedSectionList'); - }, - get Text(): AnimatedText { - return require('./components/AnimatedText'); - }, - get View(): AnimatedView { - return require('./components/AnimatedView'); - }, + FlatList: AnimatedFlatList, + Image: AnimatedImage, + ScrollView: AnimatedScrollView, + SectionList: AnimatedSectionList, + Text: AnimatedText, + View: AnimatedView, ...Animated, }; diff --git a/Libraries/Animated/AnimatedEvent.js b/Libraries/Animated/AnimatedEvent.js index c1b221fbf703b4..a08b8efc09b42d 100644 --- a/Libraries/Animated/AnimatedEvent.js +++ b/Libraries/Animated/AnimatedEvent.js @@ -10,14 +10,14 @@ 'use strict'; -const AnimatedValue = require('./nodes/AnimatedValue'); -const AnimatedValueXY = require('./nodes/AnimatedValueXY'); -const NativeAnimatedHelper = require('./NativeAnimatedHelper'); -const ReactNative = require('../Renderer/shims/ReactNative'); +import AnimatedValue from './nodes/AnimatedValue'; +import AnimatedValueXY from './nodes/AnimatedValueXY'; +import * as NativeAnimatedHelper from './NativeAnimatedHelper'; +import ReactNative from '../Renderer/shims/ReactNative'; -const invariant = require('invariant'); +import invariant from 'invariant'; -const {shouldUseNativeDriver} = require('./NativeAnimatedHelper'); +import {shouldUseNativeDriver} from './NativeAnimatedHelper'; import type {PlatformConfig} from './AnimatedPlatformConfig'; @@ -31,7 +31,7 @@ export type EventConfig = { platformConfig?: PlatformConfig, }; -function attachNativeEvent( +export function attachNativeEvent( viewRef: any, eventName: string, argMapping: $ReadOnlyArray, @@ -146,7 +146,7 @@ function validateMapping(argMapping: $ReadOnlyArray, args: any) { }); } -class AnimatedEvent { +export class AnimatedEvent { _argMapping: $ReadOnlyArray; _listeners: Array = []; _attachedEvent: ?{detach: () => void, ...}; @@ -257,5 +257,3 @@ class AnimatedEvent { this._listeners.forEach(listener => listener(...args)); }; } - -module.exports = {AnimatedEvent, attachNativeEvent}; diff --git a/Libraries/Animated/AnimatedImplementation.js b/Libraries/Animated/AnimatedImplementation.js index 5aaa29f336537f..33883c9494ecd3 100644 --- a/Libraries/Animated/AnimatedImplementation.js +++ b/Libraries/Animated/AnimatedImplementation.js @@ -10,23 +10,23 @@ 'use strict'; -const {AnimatedEvent, attachNativeEvent} = require('./AnimatedEvent'); -const AnimatedAddition = require('./nodes/AnimatedAddition'); -const AnimatedDiffClamp = require('./nodes/AnimatedDiffClamp'); -const AnimatedDivision = require('./nodes/AnimatedDivision'); -const AnimatedInterpolation = require('./nodes/AnimatedInterpolation'); -const AnimatedModulo = require('./nodes/AnimatedModulo'); -const AnimatedMultiplication = require('./nodes/AnimatedMultiplication'); -const AnimatedNode = require('./nodes/AnimatedNode'); -const AnimatedSubtraction = require('./nodes/AnimatedSubtraction'); -const AnimatedTracking = require('./nodes/AnimatedTracking'); -const AnimatedValue = require('./nodes/AnimatedValue'); -const AnimatedValueXY = require('./nodes/AnimatedValueXY'); -const DecayAnimation = require('./animations/DecayAnimation'); -const SpringAnimation = require('./animations/SpringAnimation'); -const TimingAnimation = require('./animations/TimingAnimation'); - -const createAnimatedComponent = require('./createAnimatedComponent'); +import {AnimatedEvent, attachNativeEvent} from './AnimatedEvent'; +import AnimatedAddition from './nodes/AnimatedAddition'; +import AnimatedDiffClamp from './nodes/AnimatedDiffClamp'; +import AnimatedDivision from './nodes/AnimatedDivision'; +import AnimatedInterpolation from './nodes/AnimatedInterpolation'; +import AnimatedModulo from './nodes/AnimatedModulo'; +import AnimatedMultiplication from './nodes/AnimatedMultiplication'; +import AnimatedNode from './nodes/AnimatedNode'; +import AnimatedSubtraction from './nodes/AnimatedSubtraction'; +import AnimatedTracking from './nodes/AnimatedTracking'; +import AnimatedValue from './nodes/AnimatedValue'; +import AnimatedValueXY from './nodes/AnimatedValueXY'; +import DecayAnimation from './animations/DecayAnimation'; +import SpringAnimation from './animations/SpringAnimation'; +import TimingAnimation from './animations/TimingAnimation'; + +import createAnimatedComponent from './createAnimatedComponent'; import type { AnimationConfig, @@ -575,7 +575,7 @@ export type {AnimatedNumeric as Numeric}; * * See https://reactnative.dev/docs/animated */ -module.exports = { +export default { /** * Standard value class for driving animations. Typically initialized with * `new Animated.Value(0);` diff --git a/Libraries/Animated/AnimatedMock.js b/Libraries/Animated/AnimatedMock.js index b7af8042fb90e5..28cc94bb4869a4 100644 --- a/Libraries/Animated/AnimatedMock.js +++ b/Libraries/Animated/AnimatedMock.js @@ -12,14 +12,14 @@ import type {EndResult} from './animations/Animation'; -const {AnimatedEvent, attachNativeEvent} = require('./AnimatedEvent'); -const AnimatedImplementation = require('./AnimatedImplementation'); -const AnimatedInterpolation = require('./nodes/AnimatedInterpolation'); -const AnimatedNode = require('./nodes/AnimatedNode'); -const AnimatedValue = require('./nodes/AnimatedValue'); -const AnimatedValueXY = require('./nodes/AnimatedValueXY'); +import {AnimatedEvent, attachNativeEvent} from './AnimatedEvent'; +import AnimatedImplementation from './AnimatedImplementation'; +import AnimatedInterpolation from './nodes/AnimatedInterpolation'; +import AnimatedNode from './nodes/AnimatedNode'; +import AnimatedValue from './nodes/AnimatedValue'; +import AnimatedValueXY from './nodes/AnimatedValueXY'; -const createAnimatedComponent = require('./createAnimatedComponent'); +import createAnimatedComponent from './createAnimatedComponent'; import type {EndCallback} from './animations/Animation'; import type {TimingAnimationConfig} from './animations/TimingAnimation'; @@ -168,7 +168,7 @@ const loop = function ( export type {AnimatedNumeric as Numeric}; -module.exports = { +export default { Value: AnimatedValue, ValueXY: AnimatedValueXY, Color: AnimatedColor, diff --git a/Libraries/Animated/AnimatedWeb.js b/Libraries/Animated/AnimatedWeb.js index e1c016b753241b..e23a04587a7061 100644 --- a/Libraries/Animated/AnimatedWeb.js +++ b/Libraries/Animated/AnimatedWeb.js @@ -10,9 +10,9 @@ 'use strict'; -const AnimatedImplementation = require('./AnimatedImplementation'); +import AnimatedImplementation from './AnimatedImplementation'; -module.exports = { +export default { ...AnimatedImplementation, /* $FlowFixMe[incompatible-call] createAnimatedComponent expects to receive * types. Plain intrinsic components can't be typed like this */ diff --git a/Libraries/Animated/Easing.js b/Libraries/Animated/Easing.js index f8b5bac2f30404..237f485159b6bf 100644 --- a/Libraries/Animated/Easing.js +++ b/Libraries/Animated/Easing.js @@ -10,6 +10,8 @@ 'use strict'; +import _bezier from './bezier'; + let ease; /** @@ -214,7 +216,6 @@ const Easing = { x2: number, y2: number, ): (t: number) => number { - const _bezier = require('./bezier'); return _bezier(x1, y1, x2, y2); }, diff --git a/Libraries/Animated/NativeAnimatedHelper.js b/Libraries/Animated/NativeAnimatedHelper.js index 255f6a3ee9ff55..d4a88f8f242a5f 100644 --- a/Libraries/Animated/NativeAnimatedHelper.js +++ b/Libraries/Animated/NativeAnimatedHelper.js @@ -34,7 +34,7 @@ const NativeAnimatedModule = let __nativeAnimatedNodeTagCount = 1; /* used for animated nodes */ let __nativeAnimationIdCount = 1; /* used for started animations */ -let nativeEventEmitter; +let internalNativeEventEmitter; let waitingForQueuedOperations = new Set(); let queueOperations = false; @@ -91,7 +91,7 @@ const nativeOps: ?typeof NativeAnimatedModule = useSingleOpBatching * Wrappers around NativeAnimatedModule to provide flow and autocomplete support for * the native module methods, and automatic queue management on Android */ -const API = { +export const API = { getValue: function ( tag: number, saveValueCallback: (value: number) => void, @@ -419,35 +419,35 @@ const SUPPORTED_INTERPOLATION_PARAMS = { extrapolateLeft: true, }; -function addWhitelistedStyleProp(prop: string): void { +export function addWhitelistedStyleProp(prop: string): void { SUPPORTED_STYLES[prop] = true; } -function addWhitelistedTransformProp(prop: string): void { +export function addWhitelistedTransformProp(prop: string): void { SUPPORTED_TRANSFORMS[prop] = true; } -function addWhitelistedInterpolationParam(param: string): void { +export function addWhitelistedInterpolationParam(param: string): void { SUPPORTED_INTERPOLATION_PARAMS[param] = true; } -function isSupportedColorStyleProp(prop: string): boolean { +export function isSupportedColorStyleProp(prop: string): boolean { return SUPPORTED_COLOR_STYLES.hasOwnProperty(prop); } -function isSupportedStyleProp(prop: string): boolean { +export function isSupportedStyleProp(prop: string): boolean { return SUPPORTED_STYLES.hasOwnProperty(prop); } -function isSupportedTransformProp(prop: string): boolean { +export function isSupportedTransformProp(prop: string): boolean { return SUPPORTED_TRANSFORMS.hasOwnProperty(prop); } -function isSupportedInterpolationParam(param: string): boolean { +export function isSupportedInterpolationParam(param: string): boolean { return SUPPORTED_INTERPOLATION_PARAMS.hasOwnProperty(param); } -function validateTransform( +export function validateTransform( configs: Array< | { type: 'animated', @@ -472,7 +472,7 @@ function validateTransform( }); } -function validateStyles(styles: {[key: string]: ?number, ...}): void { +export function validateStyles(styles: {[key: string]: ?number, ...}): void { for (const key in styles) { if (!isSupportedStyleProp(key)) { throw new Error( @@ -482,7 +482,7 @@ function validateStyles(styles: {[key: string]: ?number, ...}): void { } } -function validateInterpolation( +export function validateInterpolation( config: InterpolationConfigType, ): void { for (const key in config) { @@ -494,21 +494,21 @@ function validateInterpolation( } } -function generateNewNodeTag(): number { +export function generateNewNodeTag(): number { return __nativeAnimatedNodeTagCount++; } -function generateNewAnimationId(): number { +export function generateNewAnimationId(): number { return __nativeAnimationIdCount++; } -function assertNativeAnimatedModule(): void { +export function assertNativeAnimatedModule(): void { invariant(NativeAnimatedModule, 'Native animated module is not available'); } let _warnedMissingNativeAnimated = false; -function shouldUseNativeDriver( +export function shouldUseNativeDriver( config: $ReadOnly<{...AnimationConfig, ...}> | EventConfig, ): boolean { if (config.useNativeDriver == null) { @@ -535,7 +535,7 @@ function shouldUseNativeDriver( return config.useNativeDriver || false; } -function transformDataType(value: number | string): number | string { +export function transformDataType(value: number | string): number | string { // Change the string type to number type so we can reuse the same logic in // iOS and Android platform if (typeof value !== 'string') { @@ -550,33 +550,14 @@ function transformDataType(value: number | string): number | string { } } -module.exports = { - API, - isSupportedColorStyleProp, - isSupportedStyleProp, - isSupportedTransformProp, - isSupportedInterpolationParam, - addWhitelistedStyleProp, - addWhitelistedTransformProp, - addWhitelistedInterpolationParam, - validateStyles, - validateTransform, - validateInterpolation, - generateNewNodeTag, - generateNewAnimationId, - assertNativeAnimatedModule, - shouldUseNativeDriver, - transformDataType, - // $FlowExpectedError[unsafe-getters-setters] - unsafe getter lint suppresion - // $FlowExpectedError[missing-type-arg] - unsafe getter lint suppresion - get nativeEventEmitter(): NativeEventEmitter { - if (!nativeEventEmitter) { - nativeEventEmitter = new NativeEventEmitter( - // T88715063: NativeEventEmitter only used this parameter on iOS. Now it uses it on all platforms, so this code was modified automatically to preserve its behavior - // If you want to use the native module on other platforms, please remove this condition and test its behavior - Platform.OS !== 'ios' ? null : NativeAnimatedModule, - ); - } - return nativeEventEmitter; - }, -}; +// $FlowExpectedError[missing-type-arg] - unsafe getter lint suppresion +export function nativeEventEmitter(): NativeEventEmitter { + if (!internalNativeEventEmitter) { + internalNativeEventEmitter = new NativeEventEmitter( + // T88715063: NativeEventEmitter only used this parameter on iOS. Now it uses it on all platforms, so this code was modified automatically to preserve its behavior + // If you want to use the native module on other platforms, please remove this condition and test its behavior + Platform.OS !== 'ios' ? null : NativeAnimatedModule, + ); + } + return internalNativeEventEmitter; +} diff --git a/Libraries/Animated/SpringConfig.js b/Libraries/Animated/SpringConfig.js index c687f6b97126eb..2ed616eb87e671 100644 --- a/Libraries/Animated/SpringConfig.js +++ b/Libraries/Animated/SpringConfig.js @@ -24,7 +24,7 @@ function dampingFromOrigamiValue(oValue: number) { return (oValue - 8) * 3 + 25; } -function fromOrigamiTensionAndFriction( +export function fromOrigamiTensionAndFriction( tension: number, friction: number, ): SpringConfigType { @@ -34,7 +34,7 @@ function fromOrigamiTensionAndFriction( }; } -function fromBouncinessAndSpeed( +export function fromBouncinessAndSpeed( bounciness: number, speed: number, ): SpringConfigType { @@ -96,8 +96,3 @@ function fromBouncinessAndSpeed( damping: dampingFromOrigamiValue(bouncyFriction), }; } - -module.exports = { - fromOrigamiTensionAndFriction, - fromBouncinessAndSpeed, -}; diff --git a/Libraries/Animated/__tests__/Animated-test.js b/Libraries/Animated/__tests__/Animated-test.js index 8f62804c73b781..c3be6a34c279ea 100644 --- a/Libraries/Animated/__tests__/Animated-test.js +++ b/Libraries/Animated/__tests__/Animated-test.js @@ -8,6 +8,7 @@ * @emails oncall+react_native */ +import Animated from '../Animated'; import AnimatedProps from '../nodes/AnimatedProps'; import TestRenderer from 'react-test-renderer'; import * as React from 'react'; @@ -21,8 +22,6 @@ jest.mock('../../BatchedBridge/NativeModules', () => ({ }, })); -let Animated = require('../Animated'); - describe('Animated tests', () => { beforeEach(() => { jest.resetModules(); @@ -685,14 +684,11 @@ describe('Animated tests', () => { }); describe('Animated Interactions', () => { - /*eslint-disable no-shadow*/ - let Animated; /*eslint-enable*/ let InteractionManager; beforeEach(() => { jest.mock('../../Interaction/InteractionManager'); - Animated = require('../Animated'); InteractionManager = require('../../Interaction/InteractionManager'); }); diff --git a/Libraries/Animated/__tests__/AnimatedMock-test.js b/Libraries/Animated/__tests__/AnimatedMock-test.js index cc510feefefb33..49be89198df9ca 100644 --- a/Libraries/Animated/__tests__/AnimatedMock-test.js +++ b/Libraries/Animated/__tests__/AnimatedMock-test.js @@ -10,8 +10,8 @@ 'use strict'; -const AnimatedMock = require('../AnimatedMock'); -const AnimatedImplementation = require('../AnimatedImplementation'); +import AnimatedMock from '../AnimatedMock'; +import AnimatedImplementation from '../AnimatedImplementation'; describe('Animated Mock', () => { it('matches implementation keys', () => { diff --git a/Libraries/Animated/__tests__/AnimatedNative-test.js b/Libraries/Animated/__tests__/AnimatedNative-test.js index 677527e22c9d15..ab9ae3a75aed3c 100644 --- a/Libraries/Animated/__tests__/AnimatedNative-test.js +++ b/Libraries/Animated/__tests__/AnimatedNative-test.js @@ -26,8 +26,8 @@ jest import TestRenderer from 'react-test-renderer'; import * as React from 'react'; -const Animated = require('../Animated'); -const NativeAnimatedHelper = require('../NativeAnimatedHelper'); +import Animated from '../Animated'; +import NativeAnimatedHelper from '../NativeAnimatedHelper'; describe('Native Animated', () => { const NativeAnimatedModule = require('../NativeAnimatedModule').default; diff --git a/Libraries/Animated/__tests__/Interpolation-test.js b/Libraries/Animated/__tests__/Interpolation-test.js index 64585ac683bd9a..591f80ffb4979b 100644 --- a/Libraries/Animated/__tests__/Interpolation-test.js +++ b/Libraries/Animated/__tests__/Interpolation-test.js @@ -10,8 +10,8 @@ 'use strict'; -const AnimatedInterpolation = require('../nodes/AnimatedInterpolation'); -const Easing = require('../Easing'); +import AnimatedInterpolation from '../nodes/AnimatedInterpolation'; +import Easing from '../Easing'; describe('Interpolation', () => { it('should work with defaults', () => { diff --git a/Libraries/Animated/__tests__/TimingAnimation-test.js b/Libraries/Animated/__tests__/TimingAnimation-test.js index e82407876a2d9c..6ef78dca47db76 100644 --- a/Libraries/Animated/__tests__/TimingAnimation-test.js +++ b/Libraries/Animated/__tests__/TimingAnimation-test.js @@ -10,7 +10,7 @@ 'use strict'; -const TimingAnimation = require('../animations/TimingAnimation'); +import TimingAnimation from '../animations/TimingAnimation'; describe('Timing Animation', () => { it('should return array of 61 items', () => { diff --git a/Libraries/Animated/__tests__/bezier-test.js b/Libraries/Animated/__tests__/bezier-test.js index 48bfdef0f2d605..987d214ae0ceb2 100644 --- a/Libraries/Animated/__tests__/bezier-test.js +++ b/Libraries/Animated/__tests__/bezier-test.js @@ -17,7 +17,7 @@ 'use strict'; -const bezier = require('../bezier'); +import bezier from '../bezier'; const identity = function (x: number) { return x; diff --git a/Libraries/Animated/__tests__/createAnimatedComponentInjection-test.js b/Libraries/Animated/__tests__/createAnimatedComponentInjection-test.js index 9d8fa9b1869d99..e95a2c3b8d964b 100644 --- a/Libraries/Animated/__tests__/createAnimatedComponentInjection-test.js +++ b/Libraries/Animated/__tests__/createAnimatedComponentInjection-test.js @@ -11,9 +11,9 @@ 'use strict'; -const createAnimatedComponent = require('../createAnimatedComponent'); -const createAnimatedComponentInjection = require('../createAnimatedComponentInjection'); -const React = require('react'); +import createAnimatedComponent from '../createAnimatedComponent'; +import * as createAnimatedComponentInjection from '../createAnimatedComponentInjection'; +import * as React from 'react'; function injected( Component: React.AbstractComponent, diff --git a/Libraries/Animated/animations/Animation.js b/Libraries/Animated/animations/Animation.js index f22c5e9e4adaa5..5653a6b72cc5ec 100644 --- a/Libraries/Animated/animations/Animation.js +++ b/Libraries/Animated/animations/Animation.js @@ -10,7 +10,7 @@ 'use strict'; -const NativeAnimatedHelper = require('../NativeAnimatedHelper'); +import * as NativeAnimatedHelper from '../NativeAnimatedHelper'; import type {PlatformConfig} from '../AnimatedPlatformConfig'; import type AnimatedValue from '../nodes/AnimatedValue'; @@ -30,7 +30,7 @@ let startNativeAnimationNextId = 1; // Important note: start() and stop() will only be called at most once. // Once an animation has been stopped or finished its course, it will // not be reused. -class Animation { +export default class Animation { __active: boolean; __isInteraction: boolean; __nativeId: number; @@ -85,5 +85,3 @@ class Animation { } } } - -module.exports = Animation; diff --git a/Libraries/Animated/animations/DecayAnimation.js b/Libraries/Animated/animations/DecayAnimation.js index c53ff08ac0fea4..2dd3c11cc6b3fe 100644 --- a/Libraries/Animated/animations/DecayAnimation.js +++ b/Libraries/Animated/animations/DecayAnimation.js @@ -10,9 +10,9 @@ 'use strict'; -const Animation = require('./Animation'); +import Animation from './Animation'; -const {shouldUseNativeDriver} = require('../NativeAnimatedHelper'); +import {shouldUseNativeDriver} from '../NativeAnimatedHelper'; import type {PlatformConfig} from '../AnimatedPlatformConfig'; import type AnimatedValue from '../nodes/AnimatedValue'; @@ -36,7 +36,7 @@ export type DecayAnimationConfigSingle = { deceleration?: number, }; -class DecayAnimation extends Animation { +export default class DecayAnimation extends Animation { _startTime: number; _lastValue: number; _fromValue: number; @@ -123,5 +123,3 @@ class DecayAnimation extends Animation { this.__debouncedOnEnd({finished: false}); } } - -module.exports = DecayAnimation; diff --git a/Libraries/Animated/animations/SpringAnimation.js b/Libraries/Animated/animations/SpringAnimation.js index 0d0d6ada083025..173c068c6a7bac 100644 --- a/Libraries/Animated/animations/SpringAnimation.js +++ b/Libraries/Animated/animations/SpringAnimation.js @@ -14,12 +14,12 @@ import type AnimatedValue from '../nodes/AnimatedValue'; import type AnimatedValueXY from '../nodes/AnimatedValueXY'; import type AnimatedInterpolation from '../nodes/AnimatedInterpolation'; -const Animation = require('./Animation'); -const SpringConfig = require('../SpringConfig'); +import Animation from './Animation'; +import * as SpringConfig from '../SpringConfig'; -const invariant = require('invariant'); +import invariant from 'invariant'; -const {shouldUseNativeDriver} = require('../NativeAnimatedHelper'); +import {shouldUseNativeDriver} from '../NativeAnimatedHelper'; import type {PlatformConfig} from '../AnimatedPlatformConfig'; import type {AnimationConfig, EndCallback} from './Animation'; @@ -83,7 +83,7 @@ export type SpringAnimationConfigSingle = { delay?: number, }; -class SpringAnimation extends Animation { +export default class SpringAnimation extends Animation { _overshootClamping: boolean; _restDisplacementThreshold: number; _restSpeedThreshold: number; @@ -372,5 +372,3 @@ class SpringAnimation extends Animation { this.__debouncedOnEnd({finished: false}); } } - -module.exports = SpringAnimation; diff --git a/Libraries/Animated/animations/TimingAnimation.js b/Libraries/Animated/animations/TimingAnimation.js index 12606f85c5d41c..275a9e6ac31e6b 100644 --- a/Libraries/Animated/animations/TimingAnimation.js +++ b/Libraries/Animated/animations/TimingAnimation.js @@ -14,9 +14,10 @@ import type AnimatedValue from '../nodes/AnimatedValue'; import type AnimatedValueXY from '../nodes/AnimatedValueXY'; import type AnimatedInterpolation from '../nodes/AnimatedInterpolation'; -const Animation = require('./Animation'); +import Animation from './Animation'; +import Easing from '../Easing'; -const {shouldUseNativeDriver} = require('../NativeAnimatedHelper'); +import {shouldUseNativeDriver} from '../NativeAnimatedHelper'; import type {PlatformConfig} from '../AnimatedPlatformConfig'; import type {AnimationConfig, EndCallback} from './Animation'; @@ -54,13 +55,12 @@ export type TimingAnimationConfigSingle = $ReadOnly<{ let _easeInOut; function easeInOut() { if (!_easeInOut) { - const Easing = require('../Easing'); _easeInOut = Easing.inOut(Easing.ease); } return _easeInOut; } -class TimingAnimation extends Animation { +export default class TimingAnimation extends Animation { _startTime: number; _fromValue: number; _toValue: number; @@ -173,5 +173,3 @@ class TimingAnimation extends Animation { this.__debouncedOnEnd({finished: false}); } } - -module.exports = TimingAnimation; diff --git a/Libraries/Animated/bezier.js b/Libraries/Animated/bezier.js index da60afa0ec32e5..f18cef48e2daea 100644 --- a/Libraries/Animated/bezier.js +++ b/Libraries/Animated/bezier.js @@ -92,7 +92,7 @@ function newtonRaphsonIterate( return aGuessT; } -module.exports = function bezier( +export default function bezier( mX1: number, mY1: number, mX2: number, @@ -161,4 +161,4 @@ module.exports = function bezier( } return calcBezier(getTForX(x), mY1, mY2); }; -}; +} diff --git a/Libraries/Animated/components/AnimatedFlatList.js b/Libraries/Animated/components/AnimatedFlatList.js index ebe160f12e7545..966f6b272c023f 100644 --- a/Libraries/Animated/components/AnimatedFlatList.js +++ b/Libraries/Animated/components/AnimatedFlatList.js @@ -10,8 +10,8 @@ import * as React from 'react'; -const FlatList = require('../../Lists/FlatList'); -const createAnimatedComponent = require('../createAnimatedComponent'); +import FlatList from '../../Lists/FlatList'; +import createAnimatedComponent from '../createAnimatedComponent'; import type {AnimatedComponentType} from '../createAnimatedComponent'; @@ -22,7 +22,7 @@ const FlatListWithEventThrottle = React.forwardRef((props, ref) => ( )); -module.exports = (createAnimatedComponent( +export default (createAnimatedComponent( FlatListWithEventThrottle, ): AnimatedComponentType< React.ElementConfig, diff --git a/Libraries/Animated/components/AnimatedImage.js b/Libraries/Animated/components/AnimatedImage.js index b0e7b9042020c2..823f6bcdbc804a 100644 --- a/Libraries/Animated/components/AnimatedImage.js +++ b/Libraries/Animated/components/AnimatedImage.js @@ -10,12 +10,12 @@ import * as React from 'react'; -const Image = require('../../Image/Image'); -const createAnimatedComponent = require('../createAnimatedComponent'); +import Image from '../../Image/Image'; +import createAnimatedComponent from '../createAnimatedComponent'; import type {AnimatedComponentType} from '../createAnimatedComponent'; -module.exports = (createAnimatedComponent( +export default (createAnimatedComponent( (Image: $FlowFixMe), ): AnimatedComponentType< React.ElementConfig, diff --git a/Libraries/Animated/components/AnimatedScrollView.js b/Libraries/Animated/components/AnimatedScrollView.js index 887948366ac849..7589a04cd7fba4 100644 --- a/Libraries/Animated/components/AnimatedScrollView.js +++ b/Libraries/Animated/components/AnimatedScrollView.js @@ -10,8 +10,8 @@ import * as React from 'react'; -const ScrollView = require('../../Components/ScrollView/ScrollView'); -const createAnimatedComponent = require('../createAnimatedComponent'); +import ScrollView from '../../Components/ScrollView/ScrollView'; +import createAnimatedComponent from '../createAnimatedComponent'; import type {AnimatedComponentType} from '../createAnimatedComponent'; @@ -22,7 +22,7 @@ const ScrollViewWithEventThrottle = React.forwardRef((props, ref) => ( )); -module.exports = (createAnimatedComponent( +export default (createAnimatedComponent( ScrollViewWithEventThrottle, ): AnimatedComponentType< React.ElementConfig, diff --git a/Libraries/Animated/components/AnimatedSectionList.js b/Libraries/Animated/components/AnimatedSectionList.js index 2c467a66998282..e5dd4c6613a2c0 100644 --- a/Libraries/Animated/components/AnimatedSectionList.js +++ b/Libraries/Animated/components/AnimatedSectionList.js @@ -11,7 +11,7 @@ import * as React from 'react'; import SectionList from '../../Lists/SectionList'; -const createAnimatedComponent = require('../createAnimatedComponent'); +import createAnimatedComponent from '../createAnimatedComponent'; import type {AnimatedComponentType} from '../createAnimatedComponent'; @@ -22,7 +22,7 @@ const SectionListWithEventThrottle = React.forwardRef((props, ref) => ( )); -module.exports = (createAnimatedComponent( +export default (createAnimatedComponent( SectionListWithEventThrottle, ): AnimatedComponentType< React.ElementConfig, diff --git a/Libraries/Animated/components/AnimatedText.js b/Libraries/Animated/components/AnimatedText.js index 0cd6cd5245d301..6329932413d1a5 100644 --- a/Libraries/Animated/components/AnimatedText.js +++ b/Libraries/Animated/components/AnimatedText.js @@ -10,12 +10,12 @@ import * as React from 'react'; -const Text = require('../../Text/Text'); -const createAnimatedComponent = require('../createAnimatedComponent'); +import Text from '../../Text/Text'; +import createAnimatedComponent from '../createAnimatedComponent'; import type {AnimatedComponentType} from '../createAnimatedComponent'; -module.exports = (createAnimatedComponent( +export default (createAnimatedComponent( (Text: $FlowFixMe), ): AnimatedComponentType< React.ElementConfig, diff --git a/Libraries/Animated/components/AnimatedView.js b/Libraries/Animated/components/AnimatedView.js index 75358b003d5dfc..da01bc17e0790e 100644 --- a/Libraries/Animated/components/AnimatedView.js +++ b/Libraries/Animated/components/AnimatedView.js @@ -10,12 +10,12 @@ import * as React from 'react'; -const View = require('../../Components/View/View'); -const createAnimatedComponent = require('../createAnimatedComponent'); +import View from '../../Components/View/View'; +import createAnimatedComponent from '../createAnimatedComponent'; import type {AnimatedComponentType} from '../createAnimatedComponent'; -module.exports = (createAnimatedComponent(View): AnimatedComponentType< +export default (createAnimatedComponent(View): AnimatedComponentType< React.ElementConfig, React.ElementRef, >); diff --git a/Libraries/Animated/createAnimatedComponent.js b/Libraries/Animated/createAnimatedComponent.js index be43a6ba65672b..8ba5bc1c2ea522 100644 --- a/Libraries/Animated/createAnimatedComponent.js +++ b/Libraries/Animated/createAnimatedComponent.js @@ -12,14 +12,14 @@ import * as createAnimatedComponentInjection from './createAnimatedComponentInjection'; -const View = require('../Components/View/View'); -const {AnimatedEvent} = require('./AnimatedEvent'); -const AnimatedProps = require('./nodes/AnimatedProps'); -const React = require('react'); -const NativeAnimatedHelper = require('./NativeAnimatedHelper'); +import View from '../Components/View/View'; +import {AnimatedEvent} from './AnimatedEvent'; +import AnimatedProps from './nodes/AnimatedProps'; +import * as React from 'react'; +import * as NativeAnimatedHelper from './NativeAnimatedHelper'; -const invariant = require('invariant'); -const setAndForwardRef = require('../Utilities/setAndForwardRef'); +import invariant from 'invariant'; +import setAndForwardRef from '../Utilities/setAndForwardRef'; let animatedComponentNextId = 1; @@ -277,5 +277,5 @@ function createAnimatedComponent( } // $FlowIgnore[incompatible-cast] - Will be compatible after refactors. -module.exports = (createAnimatedComponentInjection.recordAndRetrieve() ?? +export default (createAnimatedComponentInjection.recordAndRetrieve() ?? createAnimatedComponent: typeof createAnimatedComponent); diff --git a/Libraries/Animated/nodes/AnimatedAddition.js b/Libraries/Animated/nodes/AnimatedAddition.js index ea430c6cd72220..c5e35fce04e357 100644 --- a/Libraries/Animated/nodes/AnimatedAddition.js +++ b/Libraries/Animated/nodes/AnimatedAddition.js @@ -12,14 +12,14 @@ import type AnimatedNode from './AnimatedNode'; -const AnimatedInterpolation = require('./AnimatedInterpolation'); -const AnimatedValue = require('./AnimatedValue'); -const AnimatedWithChildren = require('./AnimatedWithChildren'); +import AnimatedInterpolation from './AnimatedInterpolation'; +import AnimatedValue from './AnimatedValue'; +import AnimatedWithChildren from './AnimatedWithChildren'; import type {PlatformConfig} from '../AnimatedPlatformConfig'; import type {InterpolationConfigType} from './AnimatedInterpolation'; -class AnimatedAddition extends AnimatedWithChildren { +export default class AnimatedAddition extends AnimatedWithChildren { _a: AnimatedNode; _b: AnimatedNode; @@ -63,5 +63,3 @@ class AnimatedAddition extends AnimatedWithChildren { }; } } - -module.exports = AnimatedAddition; diff --git a/Libraries/Animated/nodes/AnimatedColor.js b/Libraries/Animated/nodes/AnimatedColor.js index 16a87f52800350..8d2635a93093e2 100644 --- a/Libraries/Animated/nodes/AnimatedColor.js +++ b/Libraries/Animated/nodes/AnimatedColor.js @@ -14,7 +14,7 @@ import AnimatedValue from './AnimatedValue'; import AnimatedWithChildren from './AnimatedWithChildren'; import normalizeColor from '../../StyleSheet/normalizeColor'; import {processColorObject} from '../../StyleSheet/PlatformColorValueTypes'; -import NativeAnimatedHelper from '../NativeAnimatedHelper'; +import * as NativeAnimatedHelper from '../NativeAnimatedHelper'; import type {PlatformConfig} from '../AnimatedPlatformConfig'; import type {ColorValue} from '../../StyleSheet/StyleSheet'; diff --git a/Libraries/Animated/nodes/AnimatedDiffClamp.js b/Libraries/Animated/nodes/AnimatedDiffClamp.js index 98f070cb7fb40b..c543e8069f9576 100644 --- a/Libraries/Animated/nodes/AnimatedDiffClamp.js +++ b/Libraries/Animated/nodes/AnimatedDiffClamp.js @@ -12,13 +12,13 @@ import type AnimatedNode from './AnimatedNode'; -const AnimatedInterpolation = require('./AnimatedInterpolation'); -const AnimatedWithChildren = require('./AnimatedWithChildren'); +import AnimatedInterpolation from './AnimatedInterpolation'; +import AnimatedWithChildren from './AnimatedWithChildren'; import type {InterpolationConfigType} from './AnimatedInterpolation'; import type {PlatformConfig} from '../AnimatedPlatformConfig'; -class AnimatedDiffClamp extends AnimatedWithChildren { +export default class AnimatedDiffClamp extends AnimatedWithChildren { _a: AnimatedNode; _min: number; _max: number; @@ -71,5 +71,3 @@ class AnimatedDiffClamp extends AnimatedWithChildren { }; } } - -module.exports = AnimatedDiffClamp; diff --git a/Libraries/Animated/nodes/AnimatedDivision.js b/Libraries/Animated/nodes/AnimatedDivision.js index 3d77e2de6453e7..ee5e768d344590 100644 --- a/Libraries/Animated/nodes/AnimatedDivision.js +++ b/Libraries/Animated/nodes/AnimatedDivision.js @@ -10,15 +10,15 @@ 'use strict'; -const AnimatedInterpolation = require('./AnimatedInterpolation'); -const AnimatedNode = require('./AnimatedNode'); -const AnimatedValue = require('./AnimatedValue'); -const AnimatedWithChildren = require('./AnimatedWithChildren'); +import AnimatedInterpolation from './AnimatedInterpolation'; +import AnimatedNode from './AnimatedNode'; +import AnimatedValue from './AnimatedValue'; +import AnimatedWithChildren from './AnimatedWithChildren'; import type {InterpolationConfigType} from './AnimatedInterpolation'; import type {PlatformConfig} from '../AnimatedPlatformConfig'; -class AnimatedDivision extends AnimatedWithChildren { +export default class AnimatedDivision extends AnimatedWithChildren { _a: AnimatedNode; _b: AnimatedNode; _warnedAboutDivideByZero: boolean = false; @@ -78,5 +78,3 @@ class AnimatedDivision extends AnimatedWithChildren { }; } } - -module.exports = AnimatedDivision; diff --git a/Libraries/Animated/nodes/AnimatedInterpolation.js b/Libraries/Animated/nodes/AnimatedInterpolation.js index 911122c113a21d..d0a9ba0c960a36 100644 --- a/Libraries/Animated/nodes/AnimatedInterpolation.js +++ b/Libraries/Animated/nodes/AnimatedInterpolation.js @@ -14,11 +14,11 @@ import type AnimatedNode from './AnimatedNode'; -const AnimatedWithChildren = require('./AnimatedWithChildren'); -const NativeAnimatedHelper = require('../NativeAnimatedHelper'); +import AnimatedWithChildren from './AnimatedWithChildren'; +import * as NativeAnimatedHelper from '../NativeAnimatedHelper'; -const invariant = require('invariant'); -const normalizeColor = require('../../StyleSheet/normalizeColor'); +import invariant from 'invariant'; +import normalizeColor from '../../StyleSheet/normalizeColor'; import type {PlatformConfig} from '../AnimatedPlatformConfig'; @@ -300,7 +300,7 @@ function checkInfiniteRange(name: string, arr: $ReadOnlyArray) { ); } -class AnimatedInterpolation< +export default class AnimatedInterpolation< OutputT: number | string, > extends AnimatedWithChildren { // Export for testing. @@ -369,5 +369,3 @@ class AnimatedInterpolation< }; } } - -module.exports = AnimatedInterpolation; diff --git a/Libraries/Animated/nodes/AnimatedModulo.js b/Libraries/Animated/nodes/AnimatedModulo.js index a05d4d694d5210..a465cf075f8620 100644 --- a/Libraries/Animated/nodes/AnimatedModulo.js +++ b/Libraries/Animated/nodes/AnimatedModulo.js @@ -12,13 +12,13 @@ import type AnimatedNode from './AnimatedNode'; -const AnimatedInterpolation = require('./AnimatedInterpolation'); -const AnimatedWithChildren = require('./AnimatedWithChildren'); +import AnimatedInterpolation from './AnimatedInterpolation'; +import AnimatedWithChildren from './AnimatedWithChildren'; import type {InterpolationConfigType} from './AnimatedInterpolation'; import type {PlatformConfig} from '../AnimatedPlatformConfig'; -class AnimatedModulo extends AnimatedWithChildren { +export default class AnimatedModulo extends AnimatedWithChildren { _a: AnimatedNode; _modulus: number; @@ -62,5 +62,3 @@ class AnimatedModulo extends AnimatedWithChildren { }; } } - -module.exports = AnimatedModulo; diff --git a/Libraries/Animated/nodes/AnimatedMultiplication.js b/Libraries/Animated/nodes/AnimatedMultiplication.js index 7053a5726a03aa..d16ddf38fb4e57 100644 --- a/Libraries/Animated/nodes/AnimatedMultiplication.js +++ b/Libraries/Animated/nodes/AnimatedMultiplication.js @@ -12,14 +12,14 @@ import type AnimatedNode from './AnimatedNode'; -const AnimatedInterpolation = require('./AnimatedInterpolation'); -const AnimatedValue = require('./AnimatedValue'); -const AnimatedWithChildren = require('./AnimatedWithChildren'); +import AnimatedInterpolation from './AnimatedInterpolation'; +import AnimatedValue from './AnimatedValue'; +import AnimatedWithChildren from './AnimatedWithChildren'; import type {InterpolationConfigType} from './AnimatedInterpolation'; import type {PlatformConfig} from '../AnimatedPlatformConfig'; -class AnimatedMultiplication extends AnimatedWithChildren { +export default class AnimatedMultiplication extends AnimatedWithChildren { _a: AnimatedNode; _b: AnimatedNode; @@ -62,5 +62,3 @@ class AnimatedMultiplication extends AnimatedWithChildren { }; } } - -module.exports = AnimatedMultiplication; diff --git a/Libraries/Animated/nodes/AnimatedNode.js b/Libraries/Animated/nodes/AnimatedNode.js index 159bf819a4a633..387efdb71b13f3 100644 --- a/Libraries/Animated/nodes/AnimatedNode.js +++ b/Libraries/Animated/nodes/AnimatedNode.js @@ -10,10 +10,10 @@ 'use strict'; -const NativeAnimatedHelper = require('../NativeAnimatedHelper'); +import * as NativeAnimatedHelper from '../NativeAnimatedHelper'; const NativeAnimatedAPI = NativeAnimatedHelper.API; -const invariant = require('invariant'); +import invariant from 'invariant'; import type {PlatformConfig} from '../AnimatedPlatformConfig'; @@ -23,7 +23,7 @@ let _uniqueId = 1; // Note(vjeux): this would be better as an interface but flow doesn't // support them yet -class AnimatedNode { +export default class AnimatedNode { _listeners: {[key: string]: ValueListenerCallback, ...}; _platformConfig: ?PlatformConfig; __nativeAnimatedValueListener: ?any; @@ -124,6 +124,7 @@ class AnimatedNode { NativeAnimatedAPI.startListeningToAnimatedNodeValue(this.__getNativeTag()); this.__nativeAnimatedValueListener = + // $FlowFixMe[prop-missing] NativeAnimatedHelper.nativeEventEmitter.addListener( 'onAnimatedValueUpdate', data => { @@ -193,5 +194,3 @@ class AnimatedNode { this._platformConfig = platformConfig; } } - -module.exports = AnimatedNode; diff --git a/Libraries/Animated/nodes/AnimatedProps.js b/Libraries/Animated/nodes/AnimatedProps.js index d4ed70da8d6e9c..cb3c92ebdcf9b4 100644 --- a/Libraries/Animated/nodes/AnimatedProps.js +++ b/Libraries/Animated/nodes/AnimatedProps.js @@ -12,14 +12,14 @@ import type {PlatformConfig} from '../AnimatedPlatformConfig'; -const ReactNative = require('../../Renderer/shims/ReactNative'); -const {AnimatedEvent} = require('../AnimatedEvent'); -const NativeAnimatedHelper = require('../NativeAnimatedHelper'); -const AnimatedNode = require('./AnimatedNode'); -const AnimatedStyle = require('./AnimatedStyle'); -const invariant = require('invariant'); - -class AnimatedProps extends AnimatedNode { +import ReactNative from '../../Renderer/shims/ReactNative'; +import {AnimatedEvent} from '../AnimatedEvent'; +import * as NativeAnimatedHelper from '../NativeAnimatedHelper'; +import AnimatedNode from './AnimatedNode'; +import AnimatedStyle from './AnimatedStyle'; +import invariant from 'invariant'; + +export default class AnimatedProps extends AnimatedNode { _props: Object; _animatedView: any; _callback: () => void; @@ -187,5 +187,3 @@ class AnimatedProps extends AnimatedNode { }; } } - -module.exports = AnimatedProps; diff --git a/Libraries/Animated/nodes/AnimatedStyle.js b/Libraries/Animated/nodes/AnimatedStyle.js index 7ec61c77ce48a8..8ad305ccdf5a09 100644 --- a/Libraries/Animated/nodes/AnimatedStyle.js +++ b/Libraries/Animated/nodes/AnimatedStyle.js @@ -12,13 +12,13 @@ import type {PlatformConfig} from '../AnimatedPlatformConfig'; -const flattenStyle = require('../../StyleSheet/flattenStyle'); -const NativeAnimatedHelper = require('../NativeAnimatedHelper'); -const AnimatedNode = require('./AnimatedNode'); -const AnimatedTransform = require('./AnimatedTransform'); -const AnimatedWithChildren = require('./AnimatedWithChildren'); +import flattenStyle from '../../StyleSheet/flattenStyle'; +import * as NativeAnimatedHelper from '../NativeAnimatedHelper'; +import AnimatedNode from './AnimatedNode'; +import AnimatedTransform from './AnimatedTransform'; +import AnimatedWithChildren from './AnimatedWithChildren'; -class AnimatedStyle extends AnimatedWithChildren { +export default class AnimatedStyle extends AnimatedWithChildren { _style: Object; constructor(style: any) { @@ -131,5 +131,3 @@ class AnimatedStyle extends AnimatedWithChildren { }; } } - -module.exports = AnimatedStyle; diff --git a/Libraries/Animated/nodes/AnimatedSubtraction.js b/Libraries/Animated/nodes/AnimatedSubtraction.js index 9cd15cec044125..111d720ae92fb5 100644 --- a/Libraries/Animated/nodes/AnimatedSubtraction.js +++ b/Libraries/Animated/nodes/AnimatedSubtraction.js @@ -12,14 +12,14 @@ import type AnimatedNode from './AnimatedNode'; -const AnimatedInterpolation = require('./AnimatedInterpolation'); -const AnimatedValue = require('./AnimatedValue'); -const AnimatedWithChildren = require('./AnimatedWithChildren'); +import AnimatedInterpolation from './AnimatedInterpolation'; +import AnimatedValue from './AnimatedValue'; +import AnimatedWithChildren from './AnimatedWithChildren'; import type {InterpolationConfigType} from './AnimatedInterpolation'; import type {PlatformConfig} from '../AnimatedPlatformConfig'; -class AnimatedSubtraction extends AnimatedWithChildren { +export default class AnimatedSubtraction extends AnimatedWithChildren { _a: AnimatedNode; _b: AnimatedNode; @@ -63,5 +63,3 @@ class AnimatedSubtraction extends AnimatedWithChildren { }; } } - -module.exports = AnimatedSubtraction; diff --git a/Libraries/Animated/nodes/AnimatedTracking.js b/Libraries/Animated/nodes/AnimatedTracking.js index 2275d3c6d14d7a..cb931959d09bfb 100644 --- a/Libraries/Animated/nodes/AnimatedTracking.js +++ b/Libraries/Animated/nodes/AnimatedTracking.js @@ -12,16 +12,16 @@ import type AnimatedValue from './AnimatedValue'; -const AnimatedNode = require('./AnimatedNode'); -const { +import AnimatedNode from './AnimatedNode'; +import { generateNewAnimationId, shouldUseNativeDriver, -} = require('../NativeAnimatedHelper'); +} from '../NativeAnimatedHelper'; import type {PlatformConfig} from '../AnimatedPlatformConfig'; import type {EndCallback} from '../animations/Animation'; -class AnimatedTracking extends AnimatedNode { +export default class AnimatedTracking extends AnimatedNode { _value: AnimatedValue; _parent: AnimatedNode; _callback: ?EndCallback; @@ -101,5 +101,3 @@ class AnimatedTracking extends AnimatedNode { }; } } - -module.exports = AnimatedTracking; diff --git a/Libraries/Animated/nodes/AnimatedTransform.js b/Libraries/Animated/nodes/AnimatedTransform.js index c3d4175fc6f4cd..3badf67d437f1c 100644 --- a/Libraries/Animated/nodes/AnimatedTransform.js +++ b/Libraries/Animated/nodes/AnimatedTransform.js @@ -12,11 +12,11 @@ import type {PlatformConfig} from '../AnimatedPlatformConfig'; -const NativeAnimatedHelper = require('../NativeAnimatedHelper'); -const AnimatedNode = require('./AnimatedNode'); -const AnimatedWithChildren = require('./AnimatedWithChildren'); +import * as NativeAnimatedHelper from '../NativeAnimatedHelper'; +import AnimatedNode from './AnimatedNode'; +import AnimatedWithChildren from './AnimatedWithChildren'; -class AnimatedTransform extends AnimatedWithChildren { +export default class AnimatedTransform extends AnimatedWithChildren { _transforms: $ReadOnlyArray; constructor(transforms: $ReadOnlyArray) { @@ -119,5 +119,3 @@ class AnimatedTransform extends AnimatedWithChildren { }; } } - -module.exports = AnimatedTransform; diff --git a/Libraries/Animated/nodes/AnimatedValue.js b/Libraries/Animated/nodes/AnimatedValue.js index 9530e090f923d7..2acea6d5fbd7df 100644 --- a/Libraries/Animated/nodes/AnimatedValue.js +++ b/Libraries/Animated/nodes/AnimatedValue.js @@ -10,10 +10,10 @@ 'use strict'; -const AnimatedInterpolation = require('./AnimatedInterpolation'); -const AnimatedWithChildren = require('./AnimatedWithChildren'); -const InteractionManager = require('../../Interaction/InteractionManager'); -const NativeAnimatedHelper = require('../NativeAnimatedHelper'); +import AnimatedInterpolation from './AnimatedInterpolation'; +import AnimatedWithChildren from './AnimatedWithChildren'; +import InteractionManager from '../../Interaction/InteractionManager'; +import * as NativeAnimatedHelper from '../NativeAnimatedHelper'; import type AnimatedNode from './AnimatedNode'; import type Animation, {EndCallback} from '../animations/Animation'; @@ -84,7 +84,7 @@ function _executeAsAnimatedBatch(id: string, operation: () => void) { * * See https://reactnative.dev/docs/animatedvalue */ -class AnimatedValue extends AnimatedWithChildren { +export default class AnimatedValue extends AnimatedWithChildren { _value: number; _startingValue: number; _offset: number; @@ -303,5 +303,3 @@ class AnimatedValue extends AnimatedWithChildren { }; } } - -module.exports = AnimatedValue; diff --git a/Libraries/Animated/nodes/AnimatedValueXY.js b/Libraries/Animated/nodes/AnimatedValueXY.js index c54a9d9d6f55e5..4d554f15c04d27 100644 --- a/Libraries/Animated/nodes/AnimatedValueXY.js +++ b/Libraries/Animated/nodes/AnimatedValueXY.js @@ -12,10 +12,10 @@ import type {PlatformConfig} from '../AnimatedPlatformConfig'; -const AnimatedValue = require('./AnimatedValue'); -const AnimatedWithChildren = require('./AnimatedWithChildren'); +import AnimatedValue from './AnimatedValue'; +import AnimatedWithChildren from './AnimatedWithChildren'; -const invariant = require('invariant'); +import invariant from 'invariant'; export type AnimatedValueXYConfig = $ReadOnly<{ useNativeDriver: boolean, @@ -34,7 +34,7 @@ let _uniqueId = 1; * * See https://reactnative.dev/docs/animatedvaluexy */ -class AnimatedValueXY extends AnimatedWithChildren { +export default class AnimatedValueXY extends AnimatedWithChildren { x: AnimatedValue; y: AnimatedValue; _listeners: { @@ -249,5 +249,3 @@ class AnimatedValueXY extends AnimatedWithChildren { super.__makeNative(platformConfig); } } - -module.exports = AnimatedValueXY; diff --git a/Libraries/Animated/nodes/AnimatedWithChildren.js b/Libraries/Animated/nodes/AnimatedWithChildren.js index 435365d1f6ee6d..ab81b862a755b8 100644 --- a/Libraries/Animated/nodes/AnimatedWithChildren.js +++ b/Libraries/Animated/nodes/AnimatedWithChildren.js @@ -11,10 +11,10 @@ 'use strict'; import type {PlatformConfig} from '../AnimatedPlatformConfig'; -const AnimatedNode = require('./AnimatedNode'); -const NativeAnimatedHelper = require('../NativeAnimatedHelper'); +import AnimatedNode from './AnimatedNode'; +import * as NativeAnimatedHelper from '../NativeAnimatedHelper'; -class AnimatedWithChildren extends AnimatedNode { +export default class AnimatedWithChildren extends AnimatedNode { _children: Array; constructor() { @@ -85,5 +85,3 @@ class AnimatedWithChildren extends AnimatedNode { } } } - -module.exports = AnimatedWithChildren; diff --git a/Libraries/Animated/useAnimatedProps.js b/Libraries/Animated/useAnimatedProps.js index f6d9ae5b8b9b4f..6553d598d8f285 100644 --- a/Libraries/Animated/useAnimatedProps.js +++ b/Libraries/Animated/useAnimatedProps.js @@ -13,7 +13,7 @@ import AnimatedProps from './nodes/AnimatedProps'; import {AnimatedEvent} from './AnimatedEvent'; import useRefEffect from '../Utilities/useRefEffect'; -import NativeAnimatedHelper from './NativeAnimatedHelper'; +import * as NativeAnimatedHelper from './NativeAnimatedHelper'; import { useCallback, useEffect,