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

fix(bottomSheet): snapPoint type #1479

Merged
merged 2 commits into from
Sep 10, 2023
Merged

Conversation

nicolascavallin
Copy link
Contributor

Motivation

The motivation for making this change is to fix THIS fix when you update to the latest version of react-native-reanimated

@github-actions
Copy link

github-actions bot commented Sep 7, 2023

This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@exzos28
Copy link

exzos28 commented Sep 7, 2023

still need

@nicolascavallin
Copy link
Contributor Author

@gorhom is there any chance to check it or consider it for an update?

@gorhom gorhom added v4 Written in Reanimated v2 v5 labels Sep 10, 2023
@gorhom gorhom self-assigned this Sep 10, 2023
@gorhom
Copy link
Owner

gorhom commented Sep 10, 2023

thanks @nicolascavallin for submitting this PR <3

@andrei-lt
Copy link

andrei-lt commented Nov 3, 2023

Thanks for the PR @nicolascavallin.

I still found some typecheck issues when directly using animatedSnapPoints from the result of useBottomSheetDynamicSnapPoints as a value for snapPoints.

I think it's because when react-native-bottom-sheet is built, it still uses reanimated v2 as a dependency.
When it generates the typescript declaration files, it generates something like this:

export declare const useBottomSheetDynamicSnapPoints: (initialSnapPoints: Array<string | number>) => {
    animatedSnapPoints: Readonly<{
        value: (string | number)[];
    }>;
...

A SharedValue object gets replaced with just { value: ... } as a definition and it doesn't match what the new SharedValue in reanimated v3 is defined as. The change happened in reanimated #3722.

TLDR is snapPoints prop expects a full shared value object, but useBottomSheetDynamicSnapPoints declared that it returns a partial object only.

Have I missed something somewhere and this is actually just fine for others?

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

Successfully merging this pull request may close these issues.

[v4] | [v2] TS Type error with useBottomSheetDynamicSnapPoints
4 participants