带有EXPO Reaction Native的应用程序剪辑找不到应用程序入口点模块名称? [英] App Clip with EXPO React Native not found the app entry point module name?

查看:31
本文介绍了带有EXPO Reaction Native的应用程序剪辑找不到应用程序入口点模块名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将App Clip功能集成到在Reaction Native With EXPO中开发的应用程序中。

我声明我已经在没有世博会的Reaction Native项目中集成了App Clip功能,并且我没有遇到任何重大问题,而在世博会上我有一个无法解决的问题。

我在main.m文件中收到此错误:

不变违规:";ReactNativeTest";尚未注册。在以下情况下可能会发生这种情况:

  • Metro(本地开发服务器)从错误的文件夹运行。检查Metro是否正在运行,停止它,然后在当前项目中重新启动它。
  • 由于错误,模块加载失败,AppRegistry.registerComponent未被调用。

我认为在这一点上问题与ViewController.m文件有关:

// moduleName corresponds to the appName used for the
// app entry point in "index.js"
RCTRootView *rootView = [[RCTRootView alloc]
initWithBundleURL:jsCodeLocation moduleName:@"ReactNativeTest"
initialProperties:nil launchOptions:nil];

在没有博览会的项目中,";index.js";中的应用程序入口点的modeName是

但在这种情况下它不起作用,您有解决方案吗?

推荐答案

好的,我自己找到了解决方案,如果有人需要,我按照以下步骤操作:

在index.appclip.js中,我将其修改为:

import { AppRegistry, View, Text } from 'react-native';
import { name as appName } from './app.json';
import React from 'react';

const AppClip = () => (
  <View style={{
    flex: 1,
    justifyContent: "center",
    alignItems: "center",
    backgroundColor: "#BFEFFF"
  }}>
    <Text style={{
      fontSize: 26,
      color: "#204080"
    }}>Hello React Native App Clip</Text>
  </View>
);

AppRegistry.registerComponent(appName, () => AppClip);

至此:

import { View, Text } from 'react-native';
import { registerRootComponent } from 'expo';
import React from 'react';

const AppClip = () => (
  <View style={{
    flex: 1,
    justifyContent: "center",
    alignItems: "center",
    backgroundColor: "#BFEFFF"
  }}>
    <Text style={{
      fontSize: 26,
      color: "#204080"
    }}>Hello React Native App Clip</Text>
  </View>
);

registerRootComponent(AppClip);

,并且";index.js";中的应用程序入口点的modeName是";main";,因此我修改了ViewController.m,如下所示:

// moduleName corresponds to the appName used for the
// app entry point in "index.js"
RCTRootView *rootView = [[RCTRootView alloc]
initWithBundleURL:jsCodeLocation moduleName:@"main"
initialProperties:nil launchOptions:nil];

这篇关于带有EXPO Reaction Native的应用程序剪辑找不到应用程序入口点模块名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆