rn,invite: use custom clear button also on iOS

Otherwise it won't be visible if Dark Mode is enabled.
This commit is contained in:
Saúl Ibarra Corretgé 2020-04-02 09:59:03 +02:00 committed by Saúl Ibarra Corretgé
parent a9da047d3a
commit c5e693f14a
1 changed files with 4 additions and 7 deletions

View File

@ -201,7 +201,6 @@ class AddPeopleDialog extends AbstractAddPeopleDialog<Props, State> {
<TextInput
autoCorrect = { false }
autoFocus = { false }
clearButtonMode = 'always' // iOS only
onBlur = { this._onFocused(false) }
onChangeText = { this._onTypeQuery }
onFocus = { this._onFocused(true) }
@ -211,7 +210,7 @@ class AddPeopleDialog extends AbstractAddPeopleDialog<Props, State> {
ref = { this._setFieldRef }
style = { styles.searchField }
value = { this.state.fieldValue } />
{ this._renderAndroidClearButton() }
{ this._renderClearButton() }
</View>
{ Boolean(inviteItems.length) && <View style = { styles.invitedList }>
<FlatList
@ -461,14 +460,12 @@ class AddPeopleDialog extends AbstractAddPeopleDialog<Props, State> {
_query: (string) => Promise<Array<Object>>;
/**
* Renders a button to clear the text field on Android.
*
* NOTE: For the best platform experience we use the native solution on iOS.
* Renders a button to clear the text field.
*
* @returns {React#Element<*>}
*/
_renderAndroidClearButton() {
if (Platform.OS !== 'android' || !this.state.fieldValue.length) {
_renderClearButton() {
if (!this.state.fieldValue.length) {
return null;
}