'Keyboard being dismissed immediately after pressing TextInput

I created simple component for textinput that looks like that (without styles)

import { FC } from "react"
import { TextInput, TextInputProps, View } from "react-native"

interface IProps {
    value: string,
    setValue: (arg: string) => void
    placeholder: string,
    type?: TextInputProps['textContentType'],
    keyboardType?: TextInputProps['keyboardType']
}

const Input: FC<IProps> = ({ value, setValue, placeholder, type = 'none', keyboardType = "default" }) => {
    return (
        <View>
            <TextInput textContentType={type} keyboardType={keyboardType} placeholder={placeholder} defaultValue={value} onChangeText={setValue} />
        </View>
    )
}

but everytime I press that input, keyboard is being shown and immediately dismissed. I'm using Expo bare workflow with react-navigation 6. These are all dependencies that I'm using.

"dependencies": {
    "@react-navigation/native": "^6.0.8",
    "@react-navigation/stack": "^6.1.1",
    "axios": "^0.27.1",
    "expo": "~44.0.0",
    "expo-splash-screen": "~0.14.1",
    "expo-status-bar": "~1.2.0",
    "punycode": "^2.1.1",
    "react": "17.0.1",
    "react-dom": "17.0.1",
    "react-native": "0.64.3",
    "react-native-gesture-handler": "^2.4.1",
    "react-native-markdown-display": "^7.0.0-alpha.2",
    "react-native-safe-area-context": "^4.2.4",
    "react-native-screens": "^3.12.0",
    "react-native-web": "0.17.1"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@types/react": "~17.0.21",
    "@types/react-native": "~0.64.12",
    "typescript": "~4.3.5"
  },

Any ideas what is causing that problem and how to solve it?



Solution 1:[1]

I had the same problem, coming seemingly from nowhere. What I had to do to solve it was a change in android/app/src/main/AndroidManifest.xml.

from: android:windowSoftInputMode="adjustResize" to: android:windowSoftInputMode="stateAlwaysHidden|adjustPan"

Hope it works for you as well!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mattias Almén