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: fix animated components ref types #36472

Closed

Conversation

jeongshin
Copy link
Contributor

Summary

I found Animated components like View, Text, ScrollView, Image ref type inferred as any when ref callback used.

Screen Shot 2023-03-14 at 7 32 53 PM

this is happening because of unknown type is included as union type as below.

Screen Shot 2023-03-14 at 7 33 01 PM

So I excluded unknown type inferring via fixing TAugmentRef utility type.

Result below!

Screen Shot 2023-03-14 at 7 33 36 PM

Changelog

[GENERAL] [FIXED] - fix animated components ref type inferred any

Test Plan

Ran yarn test-typescript and yarn test-typescript-offline with no errors.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 14, 2023
@analysis-bot
Copy link

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 8,511,549 -7,623
android hermes armeabi-v7a 7,825,277 -9,423
android hermes x86 8,990,082 -9,424
android hermes x86_64 8,846,220 -8,538
android jsc arm64-v8a 9,135,684 -6,790
android jsc armeabi-v7a 8,325,234 -8,608
android jsc x86 9,188,637 -8,592
android jsc x86_64 9,447,629 -7,706

Base commit: 803bb16
Branch: main

@facebook-github-bot
Copy link
Contributor

@dmytrorykun has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Mar 16, 2023
@facebook-github-bot
Copy link
Contributor

@dmytrorykun merged this pull request in 419b41f.

OlimpiaZurek pushed a commit to OlimpiaZurek/react-native that referenced this pull request May 22, 2023
Summary:
I found Animated components like `View`, `Text`, `ScrollView`, `Image` ref type inferred as `any` when ref callback used.

![Screen Shot 2023-03-14 at 7 32 53 PM](https://user-images.githubusercontent.com/64301935/224975295-21047dab-7bd1-4023-93d4-a6ee5c47f1e5.png)

this is happening because of `unknown` type is included as union type as below.

![Screen Shot 2023-03-14 at 7 33 01 PM](https://user-images.githubusercontent.com/64301935/224975937-6ee49f7e-55f7-4391-a752-c52c5171ec02.png)

So I excluded `unknown` type inferring via fixing `TAugmentRef` utility type.

Result below!

![Screen Shot 2023-03-14 at 7 33 36 PM](https://user-images.githubusercontent.com/64301935/224976685-da66e5ec-3ef0-41dd-9e1f-2bb8bfcdf598.png)

## Changelog

[GENERAL] [FIXED] - fix animated components ref type inferred `any`

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

Pull Request resolved: facebook#36472

Test Plan: Ran `yarn test-typescript` and `yarn test-typescript-offline` with no errors.

Reviewed By: cipolleschi

Differential Revision: D44055510

Pulled By: dmytrorykun

fbshipit-source-id: 0d380a2c2198c84d586889e912dec5d2304c213a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants