Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Correct way of rendering a React Native component

i have this simple component that has inputs, and when i type something only the target input will change, and it’s working fine.

  const ScaleLabel = (): JSX.Element => {
    return (
      <View>
        {scaleLabel.map((label, i) => (
          <TextInput
            value={label}
            onChangeText={(text) =>
              setScaleLabel(
                scaleLabel.map((item, index) => (index === i ? text : item))
              )
            }
          />
        ))}
      </View>
    );
  };

I’m rendering it as

 {choice === "Escala de 0 a 10" && ScaleLabel()}

But if i render it as

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

 {choice === "Escala de 0 a 10" && <ScaleLabel />}

Everytime i type something, the keyboard disappears. Why does it happen?

>Solution :

I found a same type question. Can you check whether this solves your problem?

Issue: React-Native – Keyboard closes on each keystroke for TextInput

https://stackoverflow.com/a/61701098/8743951

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading