Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.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,我正在尝试为storybook创建一个dev菜单按钮,例如 if(\uuu DEV\uuu){ const DevMenu=require('react-native-dev-menu'); 让IsToryBook=false; DevMenu.addItem('Toggle Storybook',()=>{ 如果(IStorybook){ AppRegistry.unununapplicationComponentAtrottag( AppRegistry.getAppKeys()?.inde

我正在尝试为storybook创建一个dev菜单按钮,例如

if(\uuu DEV\uuu){
const DevMenu=require('react-native-dev-menu');
让IsToryBook=false;
DevMenu.addItem('Toggle Storybook',()=>{
如果(IStorybook){
AppRegistry.unununapplicationComponentAtrottag(
AppRegistry.getAppKeys()?.indexOf('故事书')
);
renderApp();
}否则{
配置(()=>{
require('./src/stories.tsx');//我们将在接下来的步骤中创建此文件
},模块);
const-StorybookUIRoot=getStorybookUI({});
AppRegistry.unununapplicationComponentAtrottag(
AppRegistry.getAppKeys()?.indexOf(appName)
);
AppRegistry.registerComponent('Storybook',()=>StorybookUIRoot);
}
isStorybook=!isStorybook;
});
}
预期结果是在storybook应用程序和实际应用程序之间切换。 实际发生的是故事书代码运行(我得到了与故事书相关的警告),但主应用程序仍然显示

没有这个设置,只需运行
constStoryBookUIRoot=getStorybookUI({});AppRegistry.registerComponent('Storybook',()=>StorybookUIRoot)有效,所以这不是故事书,而是我尝试加载和卸载应用程序的方式是错误的