Skip to content
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

Doesn't work with KeyboardAvoidingView #568

Open
sgup opened this issue Dec 18, 2024 · 1 comment
Open

Doesn't work with KeyboardAvoidingView #568

sgup opened this issue Dec 18, 2024 · 1 comment

Comments

@sgup
Copy link

sgup commented Dec 18, 2024

When you have list components that have input, wrapping the component in KeyboardAvoidingView adds the necessary space to the parent view, but it doesn't auto scroll the flatlist to the correct spot.

To Reproduce

<KeyboardAvoidingView
  behavior={Platform.OS === "ios" ? "padding" : "height"}
  style={{
    flex: 1,
  }}
>
<DraggableFlatList
  style={{
    height: "100%",
  }}
  data={data}
  keyExtractor={keyExtractor}
  onDragEnd={onReordered}
  renderItem={renderItem}
/>
</KeyboardAvoidingView>

Platform & Dependencies
Please list any applicable dependencies in addition to those below (react-navigation etc).

  • react-native-draggable-flatlist version: "react-native-draggable-flatlist": "^4.0.1",
  • Platform:
  • React Native or Expo version: "expo": "^52.0.18",
  • Reanimated version: "react-native-reanimated": "~3.16.1",
  • React Native Gesture Handler version: "react-native-gesture-handler": "~2.20.2",
@Kilian
Copy link

Kilian commented Jan 29, 2025

you can use the getIndex() from the render item and a ref on the DraggableFlatlist to scroll the current item into view:

listRef.current.scrollToIndex({ index: getIndex() });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants