Skip to content

Commit c80c5cb

Browse files
committed
Show email and name conditionally
1 parent 7109deb commit c80c5cb

File tree

1 file changed

+23
-15
lines changed

1 file changed

+23
-15
lines changed

packages/core/src/js/feedback/FeedbackForm.tsx

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -80,28 +80,36 @@ export class FeedbackForm extends React.Component<FeedbackFormProps, FeedbackFor
8080
<View style={styles.container}>
8181
<Text style={styles.title}>{text.formTitle}</Text>
8282

83-
<Text style={styles.label}>
83+
{config.showName && (
84+
<>
85+
<Text style={styles.label}>
8486
{text.nameLabel}
8587
{config.isNameRequired && ` ${text.isRequiredLabel}`}
86-
</Text>
87-
<TextInput
88-
style={styles.input}
89-
placeholder={text.namePlaceholder}
90-
value={name}
91-
onChangeText={(value) => this.setState({ name: value })}
88+
</Text>
89+
<TextInput
90+
style={styles.input}
91+
placeholder={text.namePlaceholder}
92+
value={name}
93+
onChangeText={(value) => this.setState({ name: value })}
9294
/>
95+
</>
96+
)}
9397

94-
<Text style={styles.label}>
98+
{config.showEmail && (
99+
<>
100+
<Text style={styles.label}>
95101
{text.emailLabel}
96102
{config.isEmailRequired && ` ${text.isRequiredLabel}`}
97-
</Text>
98-
<TextInput
99-
style={styles.input}
100-
placeholder={text.emailPlaceholder}
101-
keyboardType={'email-address' as KeyboardTypeOptions}
102-
value={email}
103-
onChangeText={(value) => this.setState({ email: value })}
103+
</Text>
104+
<TextInput
105+
style={styles.input}
106+
placeholder={text.emailPlaceholder}
107+
keyboardType={'email-address' as KeyboardTypeOptions}
108+
value={email}
109+
onChangeText={(value) => this.setState({ email: value })}
104110
/>
111+
</>
112+
)}
105113

106114
<Text style={styles.label}>
107115
{text.messageLabel}

0 commit comments

Comments
 (0)