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

Android: scrollTo with FlatList breaks as soon as refresh control is added #1703

Closed
andreialecu opened this issue Feb 9, 2021 · 3 comments · Fixed by #1742
Closed

Android: scrollTo with FlatList breaks as soon as refresh control is added #1703

andreialecu opened this issue Feb 9, 2021 · 3 comments · Fixed by #1742
Assignees
Labels
Bug Platform: Android This issue is specific to Android 🏠 Reanimated 2

Comments

@andreialecu
Copy link
Contributor

andreialecu commented Feb 9, 2021

Description

Using scrollTo with a normal FlatList seems to work great, just until it gets a RefreshControl.

This only seems to occur on Android. On iOS everything works fine.

Screenshots

Steps To Reproduce

const AnimatedFlatList = Animated.createAnimatedComponent(FlatList)

<AnimatedFlatList
      ref={ref}
      ...
      onRefresh={() => {}} // comment out and it scrolls
      refreshing={true}    //
    />

scrollTo(ref, ...) // on android it only scrolls when refresh control is missing

Expected behavior

Programmatic scrolling should work.

Actual behavior

Nothing happens.

Snack or minimal code example

See above.

Package versions

  • React Native: via Expo 40.0.1
  • React Native Reanimated: 2.0.0-rc.0

Only occurs on Android

@andreialecu andreialecu added the Bug label Feb 9, 2021
@github-actions
Copy link

github-actions bot commented Feb 9, 2021

Issue validator

The issue is valid!

@PedroBern
Copy link

PedroBern commented Feb 9, 2021

I have the same issue here on rc.0

@andreialecu
Copy link
Contributor Author

Note that ScrollView works fine. Only FlatList is affected.

@piaskowyk piaskowyk added 🏠 Reanimated 2 Platform: Android This issue is specific to Android labels Feb 10, 2021
@piaskowyk piaskowyk self-assigned this Feb 22, 2021
piaskowyk added a commit that referenced this issue Feb 24, 2021
## Description

Fixes: #1703

If FlatList contains `onRefresh` property then `ReactScrollView` is wrapped by `ReactSwipeRefreshLayout` who doesn't have `smoothScrollTo()` method.

ReactSwipeRefreshLayout support only vertical scroll - "[The SwipeRefreshLayout should be used whenever the user can refresh the contents of a view via a vertical swipe gesture.](https://developer.android.com/reference/androidx/swiperefreshlayout/widget/SwipeRefreshLayout)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Platform: Android This issue is specific to Android 🏠 Reanimated 2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants