0

I use the alternative style in <SafeAreaView>. but this method not working for me? The code of my application is given below.

import { StatusBar } from 'expo-status-bar';
import { Platform, SafeAreaView, StyleSheet, Text} from 'react-native';

export default function App() {

  return (
    <SafeAreaView style={styles.AndroidSafeArea} >
      <Text>this is my app</Text>
    </SafeAreaView>
  );
}


const styles = StyleSheet.create({
  AndroidSafeArea: {
    flex: 1,
    backgroundColor: 'white',
    paddingTop: Platform.OS === 'android' ? StatusBar.currentHeight : 0
    *// working only when I use paddingTop: 25, (directly num)*

  }
});

I try to add a paddingTop according to the Platform that user use, unfortunetly condition is not working. But if I give paddingTop directly like paddingTop: 25, it work normally

0 Answers0