diff --git a/Libraries/Animated/src/components/AnimatedFlatList.js b/Libraries/Animated/src/components/AnimatedFlatList.js index 2cc3704df4f..a17a13e9e9f 100644 --- a/Libraries/Animated/src/components/AnimatedFlatList.js +++ b/Libraries/Animated/src/components/AnimatedFlatList.js @@ -10,10 +10,19 @@ 'use strict'; +import * as React from 'react'; + const FlatList = require('../../../Lists/FlatList'); const createAnimatedComponent = require('../createAnimatedComponent'); -module.exports = (createAnimatedComponent(FlatList, { - scrollEventThrottle: 0.0001, -}): $FlowFixMe); +/** + * @see https://github.com/facebook/react-native/commit/b8c8562 + */ +const FlatListWithEventThrottle = React.forwardRef((props, ref) => ( + +)); + +module.exports = (createAnimatedComponent( + FlatListWithEventThrottle, +): $FlowFixMe); diff --git a/Libraries/Animated/src/components/AnimatedScrollView.js b/Libraries/Animated/src/components/AnimatedScrollView.js index 5913fb939a1..9938b594868 100644 --- a/Libraries/Animated/src/components/AnimatedScrollView.js +++ b/Libraries/Animated/src/components/AnimatedScrollView.js @@ -10,10 +10,19 @@ 'use strict'; +import * as React from 'react'; + const ScrollView = require('../../../Components/ScrollView/ScrollView'); const createAnimatedComponent = require('../createAnimatedComponent'); -module.exports = (createAnimatedComponent(ScrollView, { - scrollEventThrottle: 0.0001, -}): $FlowFixMe); +/** + * @see https://github.com/facebook/react-native/commit/b8c8562 + */ +const ScrollViewWithEventThrottle = React.forwardRef((props, ref) => ( + +)); + +module.exports = (createAnimatedComponent( + ScrollViewWithEventThrottle, +): $FlowFixMe); diff --git a/Libraries/Animated/src/components/AnimatedSectionList.js b/Libraries/Animated/src/components/AnimatedSectionList.js index 6a4a6389fbf..49e95e4adc7 100644 --- a/Libraries/Animated/src/components/AnimatedSectionList.js +++ b/Libraries/Animated/src/components/AnimatedSectionList.js @@ -10,10 +10,19 @@ 'use strict'; +import * as React from 'react'; + const SectionList = require('../../../Lists/SectionList'); const createAnimatedComponent = require('../createAnimatedComponent'); -module.exports = (createAnimatedComponent(SectionList, { - scrollEventThrottle: 0.0001, -}): $FlowFixMe); +/** + * @see https://github.com/facebook/react-native/commit/b8c8562 + */ +const SectionListWithEventThrottle = React.forwardRef((props, ref) => ( + +)); + +module.exports = (createAnimatedComponent( + SectionListWithEventThrottle, +): $FlowFixMe); diff --git a/Libraries/Animated/src/createAnimatedComponent.js b/Libraries/Animated/src/createAnimatedComponent.js index 6b4c3e056e2..d4facbb19c3 100644 --- a/Libraries/Animated/src/createAnimatedComponent.js +++ b/Libraries/Animated/src/createAnimatedComponent.js @@ -27,7 +27,6 @@ export type AnimatedComponentType = React.AbstractComponent< function createAnimatedComponent( Component: React.AbstractComponent, - defaultProps: any, ): AnimatedComponentType { invariant( typeof Component !== 'function' || @@ -165,7 +164,6 @@ function createAnimatedComponent( const props = this._propsAnimated.__getValue(); return ( { - const Wrapped = createAnimatedComponent(Component, defaultProps); + return Component => { + const Wrapped = createAnimatedComponent(Component); Wrapped.__skipSetNativeProps_FOR_TESTS_ONLY = true;