Skip to content

Instantly share code, notes, and snippets.

@AksAman
Created June 12, 2023 16:55
Show Gist options
  • Select an option

  • Save AksAman/b119ec8ee3cb9ac077797a922fe05b80 to your computer and use it in GitHub Desktop.

Select an option

Save AksAman/b119ec8ee3cb9ac077797a922fe05b80 to your computer and use it in GitHub Desktop.
React Native SafeAreaView Component for Android/iOS
import { StyleSheet, Platform, StatusBar, SafeAreaView } from "react-native";
import React from "react";
const styles = StyleSheet.create({
container: {
flex: 1,
paddingTop: Platform.OS === "android" ? StatusBar.currentHeight : 0
}
});
type CustomSafeAreaViewProps = {
children: React.ReactNode
}
const CustomSafeAreaView: React.FC<CustomSafeAreaViewProps> = (props) => {
return (
<SafeAreaView style={styles.container}>
{props.children}
</SafeAreaView>
);
}
export default CustomSafeAreaView;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment