From cb2b265c20f0622dec37c8b95c0380f78cb0877b Mon Sep 17 00:00:00 2001 From: Kacper Rozniata <56474758+krozniata@users.noreply.github.com> Date: Mon, 26 Feb 2024 13:17:53 -0800 Subject: [PATCH] fix(rn-tester): prevent alert example from crashing (#43084) Summary: This small PR fixes issue causing `AlertExample` to crash on `login-password` prompt example, as it was trying to render object in `` ## Changelog: [INTERNAL] [FIXED] - Prevent alert example from crashing Pull Request resolved: https://github.com/facebook/react-native/pull/43084 Test Plan: `login-password` prompt example in `AlertExample` doesn't crash when pressing `OK` Reviewed By: cipolleschi Differential Revision: D53964494 Pulled By: lunaleaps fbshipit-source-id: 16a0364d3d65a33956c21a68b121e6c26b41d123 --- packages/rn-tester/js/examples/Alert/AlertExample.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/rn-tester/js/examples/Alert/AlertExample.js b/packages/rn-tester/js/examples/Alert/AlertExample.js index 22d058e2c99..895c9529fad 100644 --- a/packages/rn-tester/js/examples/Alert/AlertExample.js +++ b/packages/rn-tester/js/examples/Alert/AlertExample.js @@ -227,7 +227,9 @@ const AlertWithStylesPreferred = () => { }; const PromptOptions = () => { - const [promptValue, setPromptValue] = React.useState(''); + const [promptValue, setPromptValue] = React.useState< + string | {login: string, password: string}, + >(''); const customButtons = [ { @@ -243,7 +245,8 @@ const PromptOptions = () => { return ( - Prompt value: {promptValue} + Prompt value: + {JSON.stringify(promptValue, null, 2)}