diff --git a/packages/react-native/Libraries/Animated/components/AnimatedSectionList.js b/packages/react-native/Libraries/Animated/components/AnimatedSectionList.js index 5b2f80c2c53..c7b47147931 100644 --- a/packages/react-native/Libraries/Animated/components/AnimatedSectionList.js +++ b/packages/react-native/Libraries/Animated/components/AnimatedSectionList.js @@ -8,6 +8,7 @@ * @format */ +import type {SectionBase} from '../../Lists/SectionList'; import type {AnimatedComponentType} from '../createAnimatedComponent'; import SectionList from '../../Lists/SectionList'; @@ -16,5 +17,6 @@ import * as React from 'react'; export default (createAnimatedComponent(SectionList): AnimatedComponentType< React.ElementConfig, - React.ElementRef, + // $FlowExpectedError[unclear-type] + SectionList>, >); diff --git a/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap b/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap index 9412916deb8..0dcbaf39eb3 100644 --- a/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap +++ b/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap @@ -707,7 +707,7 @@ declare export default typeof AnimatedScrollView; exports[`public API should not change unintentionally Libraries/Animated/components/AnimatedSectionList.js 1`] = ` "declare export default AnimatedComponentType< React.ElementConfig, - React.ElementRef, + SectionList>, >; " `; diff --git a/packages/rn-tester/js/examples/FlatList/FlatList-basic.js b/packages/rn-tester/js/examples/FlatList/FlatList-basic.js index 0d7860a8a4d..84d6e614917 100644 --- a/packages/rn-tester/js/examples/FlatList/FlatList-basic.js +++ b/packages/rn-tester/js/examples/FlatList/FlatList-basic.js @@ -12,8 +12,7 @@ import type {Item} from '../../components/ListExampleShared'; import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; -import type {AnimatedComponentType} from 'react-native/Libraries/Animated/createAnimatedComponent'; -import typeof FlatListType from 'react-native/Libraries/Lists/FlatList'; +import type FlatList from 'react-native/Libraries/Lists/FlatList'; import type {RenderItemProps} from 'react-native/Libraries/Lists/VirtualizedList'; import { @@ -300,14 +299,7 @@ class FlatListExample extends React.PureComponent { ); } - _captureRef = ( - ref: React.ElementRef< - AnimatedComponentType< - React.ElementConfig, - React.ElementRef, - >, - > | null, - ) => { + _captureRef = (ref: FlatList | null) => { this._listRef = ref; }; // $FlowFixMe[missing-local-annot] @@ -431,7 +423,7 @@ class FlatListExample extends React.PureComponent { })); }; - _listRef: React.ElementRef | null; + _listRef: FlatList | null; } const styles = StyleSheet.create({ diff --git a/packages/rn-tester/js/examples/Touchable/TouchableExample.js b/packages/rn-tester/js/examples/Touchable/TouchableExample.js index ca97f24a118..aa069309b09 100644 --- a/packages/rn-tester/js/examples/Touchable/TouchableExample.js +++ b/packages/rn-tester/js/examples/Touchable/TouchableExample.js @@ -314,7 +314,7 @@ function TouchableNativeMethodChecker< T: component(ref?: React.RefSetter, ...any), >(props: {|Component: T, name: string|}): React.Node { const [status, setStatus] = useState(null); - const ref = useRef>(null); + const ref = useRef(null); useEffect(() => { setStatus(ref.current != null && typeof ref.current.measure === 'function'); @@ -557,9 +557,8 @@ const TouchableTouchSoundDisabled = () => { ); }; -// $FlowFixMe[missing-local-annot] -function TouchableOnFocus, ...any)>() { - const ref = useRef | {focus: Function}>(null); +function TouchableOnFocus() { + const ref = useRef(null); const [isFocused, setIsFocused] = useState(false); const [focusStatus, setFocusStatus] = useState( 'This touchable is not focused.',