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: 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
This commit is contained in:
Kacper Rozniata
2024-02-26 13:17:53 -08:00
committed by Facebook GitHub Bot
parent fcabb2ad21
commit cb2b265c20
@@ -227,7 +227,9 @@ const AlertWithStylesPreferred = () => {
};
const PromptOptions = () => {
const [promptValue, setPromptValue] = React.useState<string>('');
const [promptValue, setPromptValue] = React.useState<
string | {login: string, password: string},
>('');
const customButtons = [
{
@@ -243,7 +245,8 @@ const PromptOptions = () => {
return (
<View>
<Text style={styles.promptValue}>
<Text style={styles.bold}>Prompt value:</Text> {promptValue}
<Text style={styles.bold}>Prompt value:</Text>
{JSON.stringify(promptValue, null, 2)}
</Text>
<Pressable