Search code examples
react-nativenative-baseexponentjs

NativeBase + Exponent Header


I'm using NativeBase with Exponent. The Header goes beneath the phone's StatusBar. You can see this in the NativeBase demo that Exponent released.

enter image description here

Does anyone have a fix for this?


Solution

  • Since this issue only comes up in Android, the recommended way to fix this would be to target Android specifically using Platform :

    import {Platform, StatusBar} from 'react-native'
    
    const styles = StyleSheet.create({
        container: {
                flex: 1,
                ...Platform.select({
                    android: {
                        marginTop: StatusBar.currentHeight
                    }
                })
    
            }
    })
    

    Where container is the main container in the app.

    <View style={styles.container}>
     // rest of the code here
    </View>