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

Allow nullables in useAnimatedRef scrollable node getters #4864

Merged
merged 12 commits into from
Aug 4, 2023

Conversation

tjzel
Copy link
Collaborator

@tjzel tjzel commented Aug 2, 2023

Summary

In types of react-native we can see that getNativeScrollRef and getScrollableNode could return null or undefined. This PR makes this acknowledged in useAnimatedRef.

Since #4873 cast new light on how these types should be I checked how are those methods typed in react-native and seeing it we decided simply to use any since it seems like the only safe option currently.

pic rel

Screenshot 2023-08-04 at 09 59 24

Test plan

CI

@tjzel tjzel added this pull request to the merge queue Aug 4, 2023
Merged via the queue into main with commit 9c077d4 Aug 4, 2023
1 check passed
@tjzel tjzel deleted the @tjzel/types/nullify-useAnimatedRef branch August 4, 2023 08:10
piaskowyk pushed a commit that referenced this pull request Aug 4, 2023
<!-- Thanks for submitting a pull request! We appreciate you spending
the time to work on these changes. Please follow the template so that
the reviewers can easily understand what the code changes affect. -->

## Summary

~~In types of `react-native` we can see that `getNativeScrollRef` and
`getScrollableNode` could return `null` or `undefined`. This PR makes
this acknowledged in `useAnimatedRef`.~~

Since #4873 cast new light on how these types should be I checked how
are those methods typed in `react-native` and seeing it we decided
simply to use `any` since it seems like the only safe option currently.

<details>
<summary>pic rel</summary>

![Screenshot 2023-08-04 at 09 59
24](https://github.com/software-mansion/react-native-reanimated/assets/40713406/4f87d69d-77f9-41c2-8a99-5614ca348f9a)

</details>


## Test plan

CI
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.

2 participants