Fix assert Turbo Module example crash the app when tap Run all tests (#44607)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44607

Same as https://github.com/facebook/react-native/pull/41521?fbclid=IwAR1X3qRAyVCZIy2w2T7tmqd1FYVCqrT2TyO-gszIgJ0XKN6F60ODkq_K3nI for the Java / ObjC Turbo Module example.

Changelog: [INTERNAL] [FIXED] - [RN-Tester] Fix assert Turbo Module example crash the app when tap `Run all tests`

Reviewed By: cortinico

Differential Revision: D57531736

fbshipit-source-id: 7cad5dfd31c306dff4763b67466664f2dde6b239
This commit is contained in:
Christoph Purrer
2024-05-20 10:31:17 -07:00
committed by Facebook GitHub Bot
parent 30d7a0f1d7
commit 1be073e832
2 changed files with 62 additions and 27 deletions
@@ -38,6 +38,7 @@ type State = {|
type Examples =
| 'callback'
| 'callbackWithSubscription'
| 'getArray'
| 'getBool'
| 'getConstants'
@@ -221,7 +222,7 @@ class NativeCxxModuleExampleExample extends React.Component<{||}, State> {
};
_setResult(
name: string | Examples,
name: Examples | ErrorExamples,
result:
| $FlowFixMe
| void
@@ -271,6 +272,7 @@ class NativeCxxModuleExampleExample extends React.Component<{||}, State> {
style={[styles.column, styles.button]}
onPress={() =>
Object.keys(this._tests).forEach(item =>
// $FlowFixMe
this._setResult(item, this._tests[item]()),
)
}>