我正在使用基于本机的Tabs
,我想在其中一个选项卡中使用水平ScrollView
。
我的代码如下:
<Tabs>
<Tab
<MyComponent/>
</Tab>
<Tab
<MyComponent/>
</Tab>
</Tabs>
但是孩子的卷轴不起作用。
当孩子滚动时,我设法使其锁定了父选项卡。
有显示如何做的小吃here
这里是相关代码:
<Tabs locked={this.state.isLocked}>
<Tab
<MyComponent lockTab={this.lockTab}/>
</Tab>
<Tab
<MyComponent/>
</Tab>
</Tabs>
在MyComponent
内部:
handleInnerPressIn = () => this.props.lockTab(true);
handleInnerPressOut = () => this.props.lockTab(false);
<TouchableWithoutFeedback
onPressIn={this.handleInnerPressIn}
onPressOut={this.handleInnerPressOut}>
<ScrollView nestedScrollEnable={true} horizontal={true}>
</SrollView>
</TouchableWithoutFeedback>