Javascript 反应本机:模式中的Flatlist无法滚动

Javascript 反应本机:模式中的Flatlist无法滚动,javascript,react-native,react-native-flatlist,Javascript,React Native,React Native Flatlist,自从升级到最新的React本机版本(0.55.4)以来,我一直对在modals中滚动列表存在问题。在本例中,它是一个平面列表 有问题的平面列表位于一个模式中,该模式位于另一个模式中,该模式在另一个平面列表上呈现为页脚组件(它是一个添加按钮) 请帮忙!多谢各位 代码: Flatlist页脚组件(添加按钮): @observer 类AddButton扩展组件{ @可见可见=假; 建造师(道具){ 超级(道具); 此.state={ 合并名称:“”, 硬币:未定义 }; } show=()=>{ 可见

自从升级到最新的React本机版本(0.55.4)以来,我一直对在modals中滚动列表存在问题。在本例中,它是一个平面列表

有问题的平面列表位于一个模式中,该模式位于另一个模式中,该模式在另一个平面列表上呈现为页脚组件(它是一个添加按钮)

请帮忙!多谢各位

代码:

Flatlist页脚组件(添加按钮):

@observer
类AddButton扩展组件{
@可见可见=假;
建造师(道具){
超级(道具);
此.state={
合并名称:“”,
硬币:未定义
};
}
show=()=>{
可见=真实;
};
隐藏=()=>{
可见=假;
};
render(){
返回(
{
this.show();
}}
标题={'add'}
风格={{
宽度:“50%”,
对齐自我:“中心”,
利润率:16
}}
/>
{'cancel'}
{'coin'}:
{
这个。handleSelect();
}}
数据={allCoins}
/>
);
}
}
导出默认添加按钮;
常量contentStyle={
弹性:1,
背景颜色:“#0003”,
paddingLeft:10,
边界半径:3
};
常量行=({style,…rest})=>(
);
const RowLabel=props=>(
);
常量输入=(props:TextInputProperties)=>(
);
模态组件(选择器)中存在问题的平面列表:

@observer
类选择器扩展组件{
@可观察值=“”;
@可见=假;
建造师(道具){
超级(道具);
如果(道具修改){
此参数为.selectValue();
}
}
选择值=()=>{
this.value=this.props.value;
};
show=()=>{
如果(this.props.force)this.visible=true;
如果(!this.props.coin)返回;
可见=真实;
};
隐藏=()=>{
this.filterText='';
可见=假;
};
handleSelect=项目=>{
该值=项目;
if(typeof this.props.onSelect==='function'){
此.props.onSelect(项目);
}
this.hide();
};
组件将接收道具(下一步){
if(nextrops.value!==此.value){
this.value=nextrops.value | |“”;
}
}
renderItem=({item})=>{
返回(
此.handleSelect(项目)}
风格={{
背景颜色:“#fff”,
身高:40,
paddingLeft:10,
为内容辩护:“中心”
}}
>
{item.toUpperCase()}
);
};
render(){
让data=this.props.data;
返回(
{(
这就是价值||
这个.props.placeholder||
''
).toUpperCase()}
i}
getItemLayout={({,索引)=>{
常数高度=40+宽度;
返回{
长度:高度,
偏移量:高度*索引,
指数
};
}}
ItemSeparatorComponent={HairSpacer}
renderItem={this.renderItem}
/>
);
}
}
导出默认选择器;
常量contentStyle={
弹性:1,
背景颜色:“#0003”,
paddingLeft:10,
边界半径:3
};

我使用ScrollView进行求解,如下所示:

              <ScrollView>
                <FlatList
                  data={this.state.dataSource}
                  renderItem={({ item, index }) => (
                    <CountryItem item={item} index={index}/>
                  )}
                  horizontal={false}
                  onEndThreshold={0}
                  keyExtractor={item => ''.concat(Math.random())}/>
              </ScrollView>

(
)}
水平={false}
onEndThreshold={0}
keyExtractor={item=>''.concat(Math.random())}/>

或者使用ListView。

确保您已在ScrollView中添加了平面列表,并添加键盘应使用PersistTaps='always'

<ScrollView style={{ flex: 1 }} keyboardShouldPersistTaps='always'>
            <FlatList
              .................
            />
 </ScrollView>


只需添加键盘就可以将PersistTaps='always'添加到平面列表中

平面列表不应是ScrollView的子级。这将触发RN的警告。
              <ScrollView>
                <FlatList
                  data={this.state.dataSource}
                  renderItem={({ item, index }) => (
                    <CountryItem item={item} index={index}/>
                  )}
                  horizontal={false}
                  onEndThreshold={0}
                  keyExtractor={item => ''.concat(Math.random())}/>
              </ScrollView>
<ScrollView style={{ flex: 1 }} keyboardShouldPersistTaps='always'>
            <FlatList
              .................
            />
 </ScrollView>