forked from software-mansion/react-native-reanimated
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Better error message when trying to call non-worklet from UI thread (s…
…oftware-mansion#3821) ## Summary After software-mansion#3722 the error message presented after attempting to synchronously call React runtime function from the UI runtime has changed and became less descriptive than before. This PR adds a way for us to throw a more descriptive error in such scenario. ## Test plan Use the following code: ``` function rnMethod() { console.log('from RN'); } function uiMethod() { 'worklet'; rnMethod(); // this should throw } runOnUI(uiMethod)(); ``` Before this change you'd get a generic "Object is not a function" thrown at the line where we call `rnMethod`, now the error message says "Tried to synchronously call a non-worklet function" and presents possible solution (see the diff for the whole error message) Co-authored-by: Tomek Zawadzki <tomasz.zawadzki@swmansion.com>
- Loading branch information
Showing
4 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters