Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
React native 试图让模态在React Native中工作_React Native - Fatal编程技术网

React native 试图让模态在React Native中工作

React native 试图让模态在React Native中工作,react-native,React Native,正在尝试在我的react本机应用程序上运行模式。我希望更多页面显示更多选项的模式。我已经做了以下尝试,将模态放在更多菜单页面中。我当前遇到的错误是: MoreMenu.js import React,{Component}来自'React'; 从“react native”导入{Modal,Text,TouchableHighlight,View}; 类MoreMenu扩展组件{ 状态={ modalVisible:错误, } setModalVisible(可见){ this.setStat

正在尝试在我的react本机应用程序上运行模式。我希望更多页面显示更多选项的模式。我已经做了以下尝试,将模态放在更多菜单页面中。我当前遇到的错误是:

MoreMenu.js
import React,{Component}来自'React';
从“react native”导入{Modal,Text,TouchableHighlight,View};
类MoreMenu扩展组件{
状态={
modalVisible:错误,
}
setModalVisible(可见){
this.setState({modalVisible:visible});
}
render(){
返回(
{警报(“模式已关闭。”)}
>
你好,世界!
{
this.setModalVisible(!this.state.modalVisible)
}}>
隐藏模态
{
此.setModalVisible(true)
}}>
显示模态
);
}
}
TabsRoot.JS
类选项卡扩展组件{
_更改表(一){
const{changeTab}=this.props
更改表(一)
}
_renderabcontent(键){
开关(钥匙){
‘今日’个案:
返回
“共享”案例:
返回
案例“savequote”:
返回
“更多菜单”案例:
返回
}
}
渲染(){
const tabs=this.props.tabs.tabs.map((tab,i)=>{
返回(
这个._changeTab(i)}
所选={this.props.tabs.index==i}>
{this.\u renderabcontent(tab.key)}
)
})
返回(
{tabs}
)
}
}
导出默认选项卡

您忘了导出
更多菜单
组件。您可以使用
TabsRoot.js
中的
MoreMenu
组件

请在
MoreMenu.js

export default MoreMenu

您忘记了导出组件。您可以使用
TabsRoot.js
中的
MoreMenu
组件

请在
MoreMenu.js

export default MoreMenu

此部分正确吗
const tabs=this.props.tabs.tabs.map
?还是应该是这个.props.tabs.map?这部分正确吗
const tabs=this.props.tabs.tabs.map
?还是应该是this.props.tabs.map?
export default MoreMenu