React Navigation TabNavigator 滑动已禁用:SwipeRow (NativeBase) 未正确呈现 [Android]
React Navigation TabNavigator swipe disabled: SwipeRow (NativeBase) not rendering correctly [Android]
我使用 react-navigation
中的 TabNavigator,并且在一个选项卡中有一个可滑动的组件(来自 NativeBase 的 SwipeRow 组件)。在该组件上向左或向右滑动时,它会显示上下文菜单,因此我通过在 TabNavigator
中声明 swipeEnabled: false
来禁用 android 中选项卡的滑动功能(iOS 默认为 false) =].好吧,TabSwiping 现在被禁用了,但是突然之间,上下文菜单不再正确呈现。在 Android 和 swipeEnabled: true
和 iOS 上一切正常!
截图(卡片元素向左滑动):
Android 与 swipeEnabled: false
iOS(正确)
代码:
<SwipeRow
leftOpenValue={100}
rightOpenValue={-100}
left={<View style={{flex: 1,
flexDirection: 'column',
justifyContent: 'space-between',
marginTop: 7,
marginBottom: 7,
marginLeft: 3,
marginRight: 3,}}>
<Button>...</Button>
<Button>...</Button>
</View>}
body={<Card > ... </Card>}
right={/* similar to `left` */}
style={{backgroundColor: 'transparent',
padding: 0,
paddingRight:0,
paddingLeft:0,
paddingTop:0,
paddingBottom:0,
margin: 0,
marginTop: 0,
marginLeft: 0,
marginRight: 0,
marginBottom: 0,
borderBottomWidth:0,
flex: 1,
}}
/>
知道为什么会这样吗?我能否以其他方式禁用 TabSwiping,或者我能否以不同的方式设置菜单样式,以便在 android 上使用 swipeEnabled: false
正确呈现?
我现在很确定这是样式问题。向 SwipeRow 添加固定高度 style-prop 解决了这个问题,flex: 1
(见上文)使上下文菜单扩展到整个显示高度。不过,我不知道内容的高度是多少。现在我尝试计算它非常接近,但我对 swipeEnabled: false
之前的解决方案更满意。禁用此选项对整个 NativeBase Content
、Container
或 Tab 组件有何影响?
我使用 react-navigation
中的 TabNavigator,并且在一个选项卡中有一个可滑动的组件(来自 NativeBase 的 SwipeRow 组件)。在该组件上向左或向右滑动时,它会显示上下文菜单,因此我通过在 TabNavigator
中声明 swipeEnabled: false
来禁用 android 中选项卡的滑动功能(iOS 默认为 false) =].好吧,TabSwiping 现在被禁用了,但是突然之间,上下文菜单不再正确呈现。在 Android 和 swipeEnabled: true
和 iOS 上一切正常!
截图(卡片元素向左滑动):
Android 与 swipeEnabled: false
iOS(正确)
代码:
<SwipeRow
leftOpenValue={100}
rightOpenValue={-100}
left={<View style={{flex: 1,
flexDirection: 'column',
justifyContent: 'space-between',
marginTop: 7,
marginBottom: 7,
marginLeft: 3,
marginRight: 3,}}>
<Button>...</Button>
<Button>...</Button>
</View>}
body={<Card > ... </Card>}
right={/* similar to `left` */}
style={{backgroundColor: 'transparent',
padding: 0,
paddingRight:0,
paddingLeft:0,
paddingTop:0,
paddingBottom:0,
margin: 0,
marginTop: 0,
marginLeft: 0,
marginRight: 0,
marginBottom: 0,
borderBottomWidth:0,
flex: 1,
}}
/>
知道为什么会这样吗?我能否以其他方式禁用 TabSwiping,或者我能否以不同的方式设置菜单样式,以便在 android 上使用 swipeEnabled: false
正确呈现?
我现在很确定这是样式问题。向 SwipeRow 添加固定高度 style-prop 解决了这个问题,flex: 1
(见上文)使上下文菜单扩展到整个显示高度。不过,我不知道内容的高度是多少。现在我尝试计算它非常接近,但我对 swipeEnabled: false
之前的解决方案更满意。禁用此选项对整个 NativeBase Content
、Container
或 Tab 组件有何影响?