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 "Illegal type provided" crash #2853

Merged
merged 1 commit into from
Feb 2, 2022

Conversation

janicduplessis
Copy link
Contributor

Description

Sometimes RN passes ReadableMap/Array instead of WritableMap/Array when updateProps is called. Currently adding a ReadableMap/Array to a WritableMap/Array is not supported (I opened a PR to allow it since there's no reason it can't be allowed facebook/react-native#32910). In the meantime we have to check if it's not Writable and copy before adding it.

Fixes #2722

Changes

Screenshots / GIFs

N/A

Test code and steps to reproduce

I'm not sure exactly what the minimum repro is, I could 100% repro the crash in an app, but wasn't able to isolate. The app makes heavy usage of a bottom sheet lib that uses reanimated. I was able to repro a few times in the example app with the repro in the linked issue, but not consistently.

In the app where I could repro consistently I verified that it no longer crashes after this change.

Checklist

  • Included code example that can be used to test this change
  • Updated TS types
  • Added TS types tests
  • Added unit / integration tests
  • Updated documentation
  • Ensured that CI passes

@justblender
Copy link
Contributor

This PR seems to be working for me as well on RN 0.67.0 and does indeed fix #2722 🚀

@piaskowyk, could you take a look at this?

@Omelyan
Copy link

Omelyan commented Jan 30, 2022

@janicduplessis Here's a minimum (literally, a few lines) repro: #2905

@piaskowyk
Copy link
Member

To resolve it I prepared PR to react-native - facebook/react-native#32796 but it will be available until [email protected]

Copy link
Member

@piaskowyk piaskowyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@piaskowyk piaskowyk merged commit ca620a3 into software-mansion:main Feb 2, 2022
@janicduplessis janicduplessis deleted the fix-android-crash branch February 2, 2022 15:04
@joy-betterhalf
Copy link

joy-betterhalf commented Feb 3, 2022

@piaskowyk We are facing many ANR which could be fixed by this change so any idea on the next release cycle?

aeddi pushed a commit to aeddi/react-native-reanimated that referenced this pull request Mar 22, 2022
## Description

Sometimes RN passes ReadableMap/Array instead of WritableMap/Array when updateProps is called. Currently adding a ReadableMap/Array to a WritableMap/Array is not supported (I opened a PR to allow it since there's no reason it can't be allowed facebook/react-native#32910). In the meantime we have to check if it's not Writable and copy before adding it.

Fixes software-mansion#2722

## Changes


## Screenshots / GIFs

N/A

## Test code and steps to reproduce

I'm not sure exactly what the minimum repro is, I could 100% repro the crash in an app, but wasn't able to isolate. The app makes heavy usage of a bottom sheet lib that uses reanimated. I was able to repro a few times in the example app with the repro in the linked issue, but not consistently.

In the app where I could repro consistently I verified that it no longer crashes after this change.

## Checklist

- [ ] Included code example that can be used to test this change
- [ ] Updated TS types
- [ ] Added TS types tests
- [ ] Added unit / integration tests
- [ ] Updated documentation
- [ ] Ensured that CI passes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants