diff --git a/src/components/SectionList/index.android.js b/src/components/SectionList/index.android.tsx similarity index 61% rename from src/components/SectionList/index.android.js rename to src/components/SectionList/index.android.tsx index d214e1748bf4..82477fffc3ee 100644 --- a/src/components/SectionList/index.android.js +++ b/src/components/SectionList/index.android.tsx @@ -1,8 +1,10 @@ import React, {forwardRef} from 'react'; -import {SectionList} from 'react-native'; +import {SectionList as RNSectionList} from 'react-native'; +import ForwardedSectionList from './types'; -const SectionListWithRef = forwardRef((props, ref) => ( - ( + ( // eslint-disable-next-line react/jsx-props-no-multi-spaces removeClippedSubviews /> -)); +); SectionListWithRef.displayName = 'SectionListWithRef'; -export default SectionListWithRef; +export default forwardRef(SectionListWithRef); diff --git a/src/components/SectionList/index.js b/src/components/SectionList/index.js deleted file mode 100644 index 55410d664736..000000000000 --- a/src/components/SectionList/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import {SectionList} from 'react-native'; - -export default SectionList; diff --git a/src/components/SectionList/index.tsx b/src/components/SectionList/index.tsx new file mode 100644 index 000000000000..1c89b50468dd --- /dev/null +++ b/src/components/SectionList/index.tsx @@ -0,0 +1,16 @@ +import React, {forwardRef} from 'react'; +import {SectionList as RNSectionList} from 'react-native'; +import ForwardedSectionList from './types'; + +// eslint-disable-next-line react/function-component-definition +const SectionList: ForwardedSectionList = (props, ref) => ( + +); + +SectionList.displayName = 'SectionList'; + +export default forwardRef(SectionList); diff --git a/src/components/SectionList/types.ts b/src/components/SectionList/types.ts new file mode 100644 index 000000000000..093cb8f4e77c --- /dev/null +++ b/src/components/SectionList/types.ts @@ -0,0 +1,9 @@ +import {ForwardedRef} from 'react'; +import {SectionList, SectionListProps} from 'react-native'; + +type ForwardedSectionList = { + (props: SectionListProps, ref: ForwardedRef): React.ReactNode; + displayName: string; +}; + +export default ForwardedSectionList;