Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

402
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!