1

I'm using the latest RN version + expo development build.

I have noticed an issue on Android that only happens when I'm using the Stack.Screen headers.

Here's an example snippet -

<>
  <Stack.Screen
    options={{
      headerShown: true,
      title: "Create Announcement",
    }}
  />
  {Platform.OS === "android" && (
    <KeyboardAvoidingView behavior={"padding"} style={{ flex: 1 }}>
      <ScrollView className="flex-1" contentContainerStyle={{ flex: 1 }}>
        <View className="border border-border m-2 flex-1 rounded-lg">
          <Textarea
            autoFocus
            multiline
            scrollEnabled
            style={{
              flex: 1,
              padding: 16,
              textAlignVertical: "top",
            }}
            className="border-0 rounded-none shadow-none"
            placeholder="Type here..."
          />
        </View>
        <View style={{ height: 100, backgroundColor: "red" }} />
      </ScrollView>
    </KeyboardAvoidingView>
  )}
</>

This results in the following - enter image description here

enter image description here

How can I get the Red bar to fully show up above the keyboard always?

I tried so many things, like wrapping it inside SafeAreaView but to no avail.

What am I doing wrong?

2
  • @ikp check this package kirillzyusko.github.io/react-native-keyboard-controller/docs/… it might help. Commented Nov 17 at 5:18
  • 1
    Thanks. I tried that and it didn't solve the problem. I think the core issue is with using out of the box headers that come with expo-router. I ended up swapping those out for custom headers, and now it works perfectly. Plus, I'm able to do some of the interactions I desired for the headers (bonus!) I'd love to dive deeper into this issue, but I don't have the time. Cheers! Commented Nov 18 at 4:23

1 Answer 1

-1

use keyboardVerticalOffset={100} as a prop in KeyboardAvoidingView

New contributor
Ammar El-Sayed is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
Sign up to request clarification or add additional context in comments.

2 Comments

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
That's not going to solve the issue, every device is different... you should never hard code that value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.