Mol*_*per 14 react-native native-base exponentjs
我正在使用带有Exponent的NativeBase.标题位于手机的StatusBar下方.您可以在Exponent发布的NativeBase演示中看到这一点.
有人有解决方法吗?
Var*_*ath 33
由于此问题仅出现在Android中,因此修复此问题的推荐方法是使用平台专门定位Android :
import {Platform, StatusBar} from 'react-native'
const styles = StyleSheet.create({
container: {
flex: 1,
...Platform.select({
android: {
marginTop: StatusBar.currentHeight
}
})
}
})
Run Code Online (Sandbox Code Playgroud)
容器是应用程序中的主要容器.
<View style={styles.container}>
// rest of the code here
</View>
Run Code Online (Sandbox Code Playgroud)
我最后添加了一个marginTop和设备的StatusBar的值.
import {
StatusBar,
} from 'react-native'
Run Code Online (Sandbox Code Playgroud)
在我的全局样式表中:
header: {
marginTop: StatusBar.currentHeight,
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5754 次 |
| 最近记录: |