-
Notifications
You must be signed in to change notification settings - Fork 257
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
Allow providing an external scrollview. #502
Conversation
Thoughts on renaming the prop to |
@gorhom |
@naqvitalha sounds better! i have updated the pr 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few more comment. Looks good otherwise.
* Rendered as the main scrollview. Its contract for the scroll event should match the native scroll event contract, i.e. | ||
* `scrollEvent = { nativeEvent: { contentOffset: { x: offset, y: offset } } }` | ||
*/ | ||
renderScrollComponent?: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use default scroll view props from RN. That should be fine. All this complexity in RLV is due to its web only implementation. FlashList doesn't depend on it so using ScrollView props should be fine.
src/FlashList.tsx
Outdated
@@ -350,6 +351,7 @@ class FlashList<T> extends React.PureComponent< | |||
windowCorrectionConfig={this.getUpdatedWindowCorrectionConfig()} | |||
itemAnimator={this.itemAnimator} | |||
suppressBoundedSizeException | |||
externalScrollView={renderScrollComponent as any} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typecast to BaseScrollView instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i had to cast it to RecyclerListViewProps["externalScrollView"]
instead
externalScrollView?: {
new (props: ScrollViewDefaultProps): BaseScrollView;
};
@@ -96,6 +96,14 @@ estimatedItemSize?: number; | |||
|
|||
--- | |||
|
|||
### `renderScrollComponent` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Props are sorted alphabetically. Moving this would be helpful.
@@ -10,6 +10,7 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). | |||
## [1.0.4] - 2022-07-02 | |||
|
|||
- Build fix for Android projects having `kotlinVersion` defined in `build.gradle`. | |||
- Allow providing an external scrollview. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add link to this PR here
@gorhom we plan to rollout a new version tomorrow. It would be great if you can address the comments and we pull this in :) |
@naqvitalha i have addressed you comments in the latest commit 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. Looks great!
Using this prop this way: |
I'm seeing the same issue |
const ScrollViewWithRef = React.forwardRef((props, ref) => (
<ScrollView {...props} ref={ref} />
)) as typeof ScrollView; |
Thank you for the suggestion. I'm not quite grasping how that would be implemented in the context of this simple example: I've tried a couple different ways but getting quite a few errors so I'm guessing I'm not implementing that suggestion as intended. |
Enjoy |
Thanks again for following up. I do have that same strategy implemented but still getting a warning:
|
Please create a repo on Snack so I can have a look |
Description
Fixes (issue #)
This PR will allow passing an external scrollview to the
recyclerlistview
, which is needed to allow gesture interactions withreact-native-gesture-handler
especially on Android.Reviewers’ hat-rack 🎩
Screenshots or videos (if needed)
Before
Screen.Recording.2022-07-03.at.15.48.05.mov
After
Screen.Recording.2022-07-03.at.15.47.18.mov
Checklist