Search code examples
react-nativesafeareaview

Do i have to make seperate MyComponent.android.js file to use SafeArea


I am pretty new to react-native. Whenever i have to make use of SafeAreaView I have to make a seperate .android.js file for same component without safe area leading to duplication.

Is it possible to conditionally use SafeAreaView with platform.os?


Solution

  • Yes, It is possible to use SafeAreaView with Conditionally for Platform.OS. SafeAreaView only applicable on ios, but also work on android. On my code SafeAreaView work on both OS. If there is a need only on a particular OS then give condition.