Skip to content

Fix "Illegal type provided" crash#2853

Merged
piaskowyk merged 1 commit intosoftware-mansion:mainfrom
th3rdwave:fix-android-crash
Feb 2, 2022
Merged

Fix "Illegal type provided" crash#2853
piaskowyk merged 1 commit intosoftware-mansion:mainfrom
th3rdwave:fix-android-crash

Conversation

@janicduplessis
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown

Omelyan commented Jan 30, 2022

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

@piaskowyk
Copy link
Copy Markdown
Member

To resolve it I prepared PR to react-native - facebook/react-native#32796 but it will be available until react-native@0.68.0

Copy link
Copy Markdown
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
Copy Markdown

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