Search code examples
react-nativeuitextinput

My textinput in react native blurs directly after focus


I have two forms in react-native. One of the works perfectly, the other (in another component) has a bug. The TextInputs in the form keep blurring when getting focus.

The video I made (see gif below) shows that whenever I click in the input it gets focus and then immediately blurs right after it.

The code for the input (now with debugs):

<TextInput value={group.name}
    blurOnSubmit={false}
    onBlur={() => console.log('I blur')}
    onFocus={() => console.log('I focus')}
    autoFocus={true} style={styles.textInput} />

Everytime I click the input it focusses and blurs


Solution

  • I found the answer... and I am confused as to why it is the answer, but here we go:

    Apparently when you render a TextInput inside of a TabBarIOS component and you set selected={true} on your tab it will make it impossible to type into the TextInputs. I have no idea why. I had this on true in order to not have to click on the tab every time while building my views. I guess I will just set the default differently then :)