堆:
- 反应原生
- 反应导航器
- 仅核心组件
我在 TabNavigator.tsx 上有这种风格:
const styles = StyleSheet.create({
tabStyle: {
backgroundColor: colors.background,
borderTopLeftRadius: 40,
borderTopRightRadius: 40,
height: 80,
overflow: 'hidden',
// position: 'absolute', // needed to ensure the bar has a transparent background in the corners
},
})
我一直在评论绝对位置,角落后面总是有背景,当另一种颜色的组件滚动时看起来很奇怪。
在这里,为了可见性,用黄色着色:
如果我取消注释绝对位置,标签栏后面的内容会流动,使它感觉更自然。
但...
我需要在每个屏幕上添加一个底部边距以补偿选项卡占用的空间,或者底部的内容被隐藏。
我觉得应该有一个好的做法或一个已知的模式,也许是一个经过测试的解决方法,这会让我的生活更轻松。你有想法吗?
谢谢