0
<SafeAreaView style={[styles.mainContainer, Props.style]}>
  <View style={[styles.titleContainer, Props.titleContainerStyle]}>
    <Text style={[styles.title, Props.titleStyle]}>{Props.title}</Text>
  </View>
  <ScrollView keyboardShouldPersistTaps="never">
    {Props.column === (1 || undefined) ? (
      <TouchableWithoutFeedback
        onPress={Keyboard.dismiss}
        accessible={false}>
        <View style={styles.contentContainer}>
          <TextInput
            placeholder="Hello"
            onChangeText={setInputField}
            value={inputField}
            style={[styles.textInput, Props.textInputStyle]}
          />
        </View>
      </TouchableWithoutFeedback>
    ) : Props.column === 2 ? (
      <View>
        <Text>Input2</Text>
      </View>
    ) : Props.column === 3 ? (
      <View>
        <Text>Input3</Text>
      </View>
    ) : (
      <View>
        <Text>Select Values between and 1 and 3 </Text>
      </View>
    )}
  </ScrollView>
</SafeAreaView>

I have searched for the solutions and found this and this one but even after trying with what has been mentioned in those links it still does not lose focus and hide the keyboard. ( I checked only in the android emulator )

Athavan T
  • 306
  • 2
  • 15

2 Answers2

0

Remove keyboardShouldPersistTaps

And remove the keyboard.dismiss function with the touchable remove.

Scroll view dismiss the focus when click outside function without any extra things.

Altommy
  • 26
  • 2
0

If you're trying to click a Touchable without losing focus, you should be able to just set keyboardShouldPersistTaps="always" on the ScrollView.