Fix: close keyboard when viewing the self-label modal (#1153)

zio/stable
Paul Frazee 2023-08-11 08:50:24 -07:00 committed by GitHub
parent 821b9ba6e6
commit 993026cbc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 3 deletions

View File

@ -1,5 +1,5 @@
import React from 'react' import React from 'react'
import {StyleSheet} from 'react-native' import {Keyboard, StyleSheet} from 'react-native'
import {observer} from 'mobx-react-lite' import {observer} from 'mobx-react-lite'
import {Button} from 'view/com/util/forms/Button' import {Button} from 'view/com/util/forms/Button'
import {usePalette} from 'lib/hooks/usePalette' import {usePalette} from 'lib/hooks/usePalette'
@ -7,6 +7,7 @@ import {useStores} from 'state/index'
import {ShieldExclamation} from 'lib/icons' import {ShieldExclamation} from 'lib/icons'
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
import {FontAwesomeIconStyle} from '@fortawesome/react-native-fontawesome' import {FontAwesomeIconStyle} from '@fortawesome/react-native-fontawesome'
import {isNative} from 'platform/detection'
export const LabelsBtn = observer(function LabelsBtn({ export const LabelsBtn = observer(function LabelsBtn({
labels, labels,
@ -25,9 +26,14 @@ export const LabelsBtn = observer(function LabelsBtn({
style={styles.button} style={styles.button}
accessibilityLabel="Content warnings" accessibilityLabel="Content warnings"
accessibilityHint="" accessibilityHint=""
onPress={() => onPress={() => {
if (isNative) {
if (Keyboard.isVisible()) {
Keyboard.dismiss()
}
}
store.shell.openModal({name: 'self-label', labels, onChange}) store.shell.openModal({name: 'self-label', labels, onChange})
}> }}>
<ShieldExclamation style={pal.link} size={26} /> <ShieldExclamation style={pal.link} size={26} />
{labels.length > 0 ? ( {labels.length > 0 ? (
<FontAwesomeIcon <FontAwesomeIcon