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

Ability to pass scroll component implementation #69

Open
terrysahaidak opened this issue Jan 16, 2025 · 5 comments
Open

Ability to pass scroll component implementation #69

terrysahaidak opened this issue Jan 16, 2025 · 5 comments

Comments

@terrysahaidak
Copy link

In order to support bottom sheet libraries, we need to pass its scroll component. I saw this library implements animated and reanimated versions, but still would be cool to use it with @gorhom/bottom-sheet and other custom things that absolutely need access to the ScrollView.

@jmeistrich
Copy link
Contributor

I actually added a renderScrollComponent prop in the latest version but forgot to add it to the documentation. I did some quick tests and it seemed to work, but I'm not sure if it's correct to support bottom sheet. What do you think? Do you want to try it and see if it works?

cc @assimelha #28 (comment)

@terrysahaidak
Copy link
Author

terrysahaidak commented Jan 20, 2025

Just tried to use that prop with 1.0.0-beta.0 and looks like doing this works:

renderScrollComponent={(props) => <BottomSheetScrollView {...props} />}

Thank you!

Another question regarding that.

I'm now getting a warning [legend-list] List height is 0. You may need to set a style or flex: for the list, because children are absolutely positioned.. I do have the height set, but looks like it gets measured when outside the screen (still animating) which doesn't always work on android afaik.

Any ideas how could i force to remeasure it?

@jmeistrich
Copy link
Contributor

It might be related to #44

Is it possible to share a repro that we can test with? Otherwise we'll try to fix #44 at some point which hopefully will fix that.

@terrysahaidak
Copy link
Author

terrysahaidak commented Jan 21, 2025

Made a repro repository with the versions i use:
https://github.com/terrysahaidak/legend-list-bottom-sheet-repro

The issue exists on both iOS and Android.

2025-01-21.16.17.02.mov

@thiagobrez
Copy link

Just a heads up @terrysahaidak and possibly others in the future:

Passing renderScrollComponent as inline function might cause you to lose scroll position if the list is rerendered

renderScrollComponent={(props) => <BottomSheetScrollView {...props} />}

Instead, prefer extracting to a custom component:

const CustomScrollView = (props: ScrollViewProps) => {
  return <ScrollView {...props} />;
};

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

3 participants