Skip to content

Commit cb2b265

Browse files
krozniatafacebook-github-bot
authored andcommitted
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 `<Text>` ## Changelog: [INTERNAL] [FIXED] - Prevent alert example from crashing Pull Request resolved: #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
1 parent fcabb2a commit cb2b265

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/rn-tester/js/examples/Alert/AlertExample.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,9 @@ const AlertWithStylesPreferred = () => {
227227
};
228228

229229
const PromptOptions = () => {
230-
const [promptValue, setPromptValue] = React.useState<string>('');
230+
const [promptValue, setPromptValue] = React.useState<
231+
string | {login: string, password: string},
232+
>('');
231233

232234
const customButtons = [
233235
{
@@ -243,7 +245,8 @@ const PromptOptions = () => {
243245
return (
244246
<View>
245247
<Text style={styles.promptValue}>
246-
<Text style={styles.bold}>Prompt value:</Text> {promptValue}
248+
<Text style={styles.bold}>Prompt value:</Text>
249+
{JSON.stringify(promptValue, null, 2)}
247250
</Text>
248251

249252
<Pressable

0 commit comments

Comments
 (0)