Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

404
Visualizações
React Native - Keyboard covers bottom part of the input

In my app keyboard covers only bottom part of the text input. I have tried several ways to solve this by changing styles by adding padding or margin, and also KeyboardAvoidingView didn't help.

Another problem is that keyboard shifts the whole screen and header becomes invisible as it goes above.

Edit: It works fine on IOS devices.

How can I fix these problems? Thanks

Code:

<>
           <CustomHeader title={item.title}
                         leftChild={<SvgImageComp name={MENU_ICON}/>}
                         centerChild={
                             <TextComp text={'Title'} style={compStyle.title}/>
                         }
           />
           <View style={{
               flex: 1,
               justifyContent: 'flex-end'
           }}>
               <KeyboardAvoidingView
                   behavior={"height"}
               >
               <TextInputComp fontFamily={NUNITO_SANS_REGULAR}
                              fontSize={15}
                              lineHeight={20}
                              autoFocus={true}
                              style={{
                                  paddingVertical: 10,
                                  paddingHorizontal: 20,
                                  borderWidth: 1,
                                  borderColor: '#000',
                                  borderRadius: 200,
                              }}
               />
               </KeyboardAvoidingView>
           </View>
       </>

enter image description here

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

For Android you don't need to pass behavior to KeyboardAvoidingView. For IOS you need to pass behavior="position" and keyboardVerticalOffset=[height of your input].

 <KeyboardAvoidingView
          {...(Platform.OS === 'ios'
            ? {
                behavior: 'position' ,
                keyboardVerticalOffset: [inputHeight], // calculate height using onLayout callback method
              }
            : {})}>

enter image description here

about 4 years ago · Juan Pablo Isaza Relatório

0

I avoid this issue by wrapping the screen in <ScrollView contentContainerStyle={flexGrow: 1}><ScrollView> This will make the whole screen turn into a scroll view once the keyboard opens. Allowing the box to be out of the way of the keyboard. This also has the added benefit of allowing you to scroll to other sections of the screen for reference while the keyboard stays open.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda