Skip to content

docs: forwardRef for FlashList+renderScrollComponent #903

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions docs/docs/api/components/keyboard-aware-scroll-view.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ Unlike original [react-native-keyboard-aware-scroll-view](https://github.com/APS
If you want to integrate it with your custom virtualization list, you can pass `renderScrollComponent` prop like:

```tsx
import { FlatList } from "react-native";
import React from "react";
import { FlatList, ScrollView, ScrollViewProps } from "react-native";
import { KeyboardAwareScrollView } from "react-native-keyboard-controller";

<FlatList
Expand All @@ -135,9 +136,11 @@ import { KeyboardAwareScrollView } from "react-native-keyboard-controller";

import { FlashList } from "@shopify/flash-list";

<FlashList
renderScrollComponent={(props) => <KeyboardAwareScrollView {...props} />}
/>;
const RenderScrollComponent = React.forwardRef<ScrollView, ScrollViewProps>(
(props, ref) => <KeyboardAwareScrollView {...props} ref={ref} />,
);

<FlashList renderScrollComponent={RenderScrollComponent} />;
```

<details>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ Unlike original [react-native-keyboard-aware-scroll-view](https://github.com/APS
If you want to integrate it with your custom virtualization list, you can pass `renderScrollComponent` prop like:

```tsx
import { FlatList } from "react-native";
import React from "react";
import { FlatList, ScrollView, ScrollViewProps } from "react-native";
import { KeyboardAwareScrollView } from "react-native-keyboard-controller";

<FlatList
Expand All @@ -135,9 +136,11 @@ import { KeyboardAwareScrollView } from "react-native-keyboard-controller";

import { FlashList } from "@shopify/flash-list";

<FlashList
renderScrollComponent={(props) => <KeyboardAwareScrollView {...props} />}
/>;
const RenderScrollComponent = React.forwardRef<ScrollView, ScrollViewProps>(
(props, ref) => <KeyboardAwareScrollView {...props} ref={ref} />,
);

<FlashList renderScrollComponent={RenderScrollComponent} />;
```

<details>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ Unlike original [react-native-keyboard-aware-scroll-view](https://github.com/APS
If you want to integrate it with your custom virtualization list, you can pass `renderScrollComponent` prop like:

```tsx
import { FlatList } from "react-native";
import React from "react";
import { FlatList, ScrollView, ScrollViewProps } from "react-native";
import { KeyboardAwareScrollView } from "react-native-keyboard-controller";

<FlatList
Expand All @@ -135,9 +136,11 @@ import { KeyboardAwareScrollView } from "react-native-keyboard-controller";

import { FlashList } from "@shopify/flash-list";

<FlashList
renderScrollComponent={(props) => <KeyboardAwareScrollView {...props} />}
/>;
const RenderScrollComponent = React.forwardRef<ScrollView, ScrollViewProps>(
(props, ref) => <KeyboardAwareScrollView {...props} ref={ref} />,
);

<FlashList renderScrollComponent={RenderScrollComponent} />;
```

<details>
Expand Down