Created
June 12, 2023 16:55
-
-
Save AksAman/b119ec8ee3cb9ac077797a922fe05b80 to your computer and use it in GitHub Desktop.
React Native SafeAreaView Component for Android/iOS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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