React native React Native-找不到名称“的视图配置”;定制标签";

React native React Native-找不到名称“的视图配置”;定制标签";,react-native,jsx,React Native,Jsx,我使用的是react native navigation v2,每个组件都需要通过调用registerComponent()注册到导航中。然而,我发现自己有500行代码,其中我使用相同的registerComponent结构注册应用程序的每个组件,唯一的区别是对我注册的每个组件使用不同的jsx标记,如下所示: import ItemsList from './src/components/ItemsList'; import { Navigation } from "react-native-n

我使用的是react native navigation v2,每个组件都需要通过调用registerComponent()注册到导航中。然而,我发现自己有500行代码,其中我使用相同的registerComponent结构注册应用程序的每个组件,唯一的区别是对我注册的每个组件使用不同的jsx标记,如下所示:

import ItemsList from './src/components/ItemsList';
import { Navigation } from "react-native-navigation";
import { Provider } from "react-redux";
import reduxStore from "./src/store";

Navigation.registerComponent(
  "app.ItemsList",
  () => props => (
    <Provider store={reduxStore}>
      <ItemsList {...props} />
    </Provider>
  ),
  () => ItemsList
);
+++ 35 more components almost exactly just like this one
(function componentsRegistration() {
  return components.map(({ name, component }) => {
    const Tag = name;
    Navigation.registerComponent(
      `app.${name}`,
      () => props => (
        <Provider store={reduxStore}>
          <Tag {...props} />
        </Provider>
      ),
      () => component
    );
  });
})()
然后对每个项目调用registerComponent并返回我需要的JSX,如下所示:

import ItemsList from './src/components/ItemsList';
import { Navigation } from "react-native-navigation";
import { Provider } from "react-redux";
import reduxStore from "./src/store";

Navigation.registerComponent(
  "app.ItemsList",
  () => props => (
    <Provider store={reduxStore}>
      <ItemsList {...props} />
    </Provider>
  ),
  () => ItemsList
);
+++ 35 more components almost exactly just like this one
(function componentsRegistration() {
  return components.map(({ name, component }) => {
    const Tag = name;
    Navigation.registerComponent(
      `app.${name}`,
      () => props => (
        <Provider store={reduxStore}>
          <Tag {...props} />
        </Provider>
      ),
      () => component
    );
  });
})()
(函数组件注册(){
返回components.map({name,component})=>{
const Tag=名称;
Navigation.registerComponent(
`app.${name}`,
()=>道具=>(
),
()=>组件
);
});
})()

在这个特定的操作之后,我的应用程序不再渲染。相反,它抛出“不变冲突:未找到name ItemsList的视图配置”。我想我已经按照React命令(大写字母jsx标记等)完成了所有这些,但是无法让它工作。如果有人可以,请提供帮助。

[p>[SOLVED]我遇到了一个错误,因为我试图传递一个带有组件名称而不是组件本身的字符串

正确的方法是:

const Tag = component;
而不是:

const Tag = name;

[已解决]我遇到一个错误,因为我试图传递一个带有组件名称而不是组件本身的字符串

正确的方法是:

const Tag = component;
而不是:

const Tag = name;