th3rdwave / react-native-safe-area-context

A flexible way to handle safe area insets in JS. Also works on Android and Web!
MIT License
2.13k stars 195 forks source link

SafeAreaView adding padding to bottom when used with ScrollView in React Navigation 6 #270

Closed thecannabisapp closed 2 years ago

thecannabisapp commented 2 years ago

Hello, I'm having some weird padding issues when I use a ScrollView inside a SafeAreaView using Expo 44, React Navigation 6 bottom Tab navigator, React Native Paper and tailwind.

Note that I'm running this using Expo Web and this is presented as a PWA in the iOS simulator. There's no padding issue inside Safari. Only when it is saved as a desktop bookmark and running as PWA the padding issue appears.

Any ideas on why and how to fix it, please? Thank you! 🙏🏻

Screenshot 2022-04-12 at 22 31 18
import React from "react";
import { SafeAreaView } from 'react-native-safe-area-context';
import { ScrollView } from "react-native";
import { Appbar } from "react-native-paper";
import tailwind from "tailwind-rn"

const Home: React.FC = () => {
  return (
    <SafeAreaView style={{flex: 1, padding: 0}}>
      <Appbar
        style={{
          height: 50,
        }}
      >
        <Appbar.Content
          subtitle="The highest authority"
          subtitleStyle={tailwind('text-xs')}
        />
        <Appbar.Action icon="menu" />
      </Appbar>
      <ScrollView style={tailwind("mb-0 pb-0 bg-black")}>
      {SOME LONG OVERFLOWING CONTENT HERE...}
      </ScrollView>
    </SafeAreaView>
  );
};

export default Home;
thecannabisapp commented 2 years ago

I solved it by adding <SafeAreaView edges={['top', 'left', 'right']} style={tailwind("flex-1 pb-0 mb-0")}>

Salman9000 commented 7 months ago

I solved it by adding <SafeAreaView edges={['top', 'left', 'right']} style={tailwind("flex-1 pb-0 mb-0")}>

Works like a charm! thank you