Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@kmagiera
Copy link
Contributor

@kmagiera kmagiera commented Oct 2, 2025

This PR fixes an issue with the sticky day selector jumping intermittently when scrolling past the top position of the selector.

One change is to use Animated.FlatList component as opposed to creating one using Animated.createAnimatedComponent. The version that reanimated exports has the throttling defaults set properly such that it avoids event throttling.

In addition, we enable feature flags in react native and reanimated that results in the direct ui thread updates from being delayed. Read more here: https://docs.swmansion.com/react-native-reanimated/docs/guides/feature-flags/#disable_commit_pausing_mechanism

@betomoedano betomoedano self-requested a review October 2, 2025 22:21
Copy link
Contributor

@betomoedano betomoedano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tested this on a physical device and the issue is fixed!

LGTM

@kmagiera
Copy link
Contributor Author

kmagiera commented Oct 3, 2025

Apparently this will require native update and also effectively turns off the iOS prebuilds for the project. I hope the flag will be enabled in the next RN release though

} from "@/components/CurrentlyLive";

const AnimatedFlatList = Animated.createAnimatedComponent(FlatList) as FlatList;
const AnimatedFlatList = Animated.FlatList;
Copy link
Contributor

@sync sync Oct 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like just the change to this file fixes the sticky header jumping (using react-native FlatList), without having to change app.config.ts and package.json

Copy link
Member

@hirbod hirbod Oct 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That change will definitely not fix the issue, its more like this one optimized it (but its still happening randomly): c4509a4

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfortunately both of these updates are necessary. The changes from c4509a4 while offload the JS thread communication they still don't impact the UI updates from being applied on time. I updated the PR description with some links so you can learn more why these changes are necessary

Copy link
Member

@hirbod hirbod Oct 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kmagiera can you elaborate on "has the throttling defaults set properly"? The only thing I see is that it sets scrollEventThrottle to 1 instead of 50 (and only if not overwritten).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. That's exactly it. When you process events using reanimated on native thread you don't want any throttling (that's what 1 corresponds to). Throttling was a mechanism to avoid overloading JS thread with events

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So by just adding scrollEventThrottle={1} we can achieve the same with createAnimatedComponent

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It also swaps out the renderScrollComponent for reanimated one, but this isn't necessary unless you want to animated some of the flatlist style props

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah makes sense.

@kadikraman kadikraman marked this pull request as ready for review October 4, 2025 08:39
@kadikraman kadikraman merged commit 636a9c1 into expo:main Oct 4, 2025
1 check passed
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

Successfully merging this pull request may close these issues.

5 participants