gpt4 book ai didi

javascript - React-Native:期望一个字符串或类/函数,但得到:对象

转载 作者:行者123 更新时间:2023-12-03 02:58:26 25 4
gpt4 key购买 nike

对于我的 react native 应用程序,我得到

Element type is invalid: expected a string (for built-in components) or a class/function(for composite components) but got: object

应用程序/index.js:

import React, { Component } from 'react';
import EStyleSheet from 'react-native-extended-stylesheet';
import { Provider } from 'react-redux';

import Navigator from './config/routes';
import { AlertProvider } from './redux/components/Alert';
import store from './config/stores';


EStyleSheet.build({
$primaryBlue: '#4F6D7A',
$primaryOrange: '#D57A66',
$primaryGreen: '#00BD9D',
$primaryPurple: '#9E768F',

$white: '#FFFFFF',
$lightGray: '#F0F0F0',
$border: '#E2E2E2',
$inputText: '#797979',
$darkText: '#343434',
});

export default () => (
<Provider store={store}>
<AlertProvider>
<Navigator onNavigationStateChange={null} />
</AlertProvider>
</Provider>
);

index.android.js 和index.ios.js:

import App from './app/index';
import React, { Component } from 'react';
import { AppRegistry } from 'react-native';

AppRegistry.registerComponent("TestApp", App);

我尝试删除 Provider、AlertProvider 和 Navigator 标记并添加 View 标记,只是为了看看是否仍然会收到错误,但我收到了相同的错误。

我做错了什么?

最佳答案

尝试注册您的根组件

AppRegistry.registerComponent("TestApp", () => App);

关于javascript - React-Native:期望一个字符串或类/函数,但得到:对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47518303/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com