当我在iOS上启动我的应用时,我收到了以下错误: 元素类型无效:期望一个字符串或类/函数,但得到:undefined。您可能忘记从其定义的文件中导出组件。 检查LoginForm的render方法
这是我的App.js:
import React, { Component } from 'react';
import { View, Text } from 'react-native';
import { Provider } from 'react-redux';
import { createStore } from 'redux';
import firebase from 'firebase';
import reducers from './reducers';
import LoginForm from './components/LoginForm';
const store = createStore(reducers);
class App extends Component {
componentWillMount() {
const config = {
apiKey: 'dawdawdas',
authDomain: 'dasdasd',
databaseURL: 'dasdasd',
projectId: 'dasd',
storageBucket: 'dsdasd',
messagingSenderId: 'dasdasda'
};
firebase.initializeApp(config);
}
render() {
return (
<Provider store={store}>
<LoginForm />
</Provider>
);
}
}
export default App;
和LoginForm.js:
import React, { Component } from 'react';
import { Card, CardSectiion, Input, Button } from './common';
export default class LoginForm extends Component {
render() {
return (
<Card>
<CardSectiion>
<Input
label="Email"
placeholder="User@example.com"
/>
</CardSectiion>
<CardSectiion>
<Input
secureTextEntry
label="Password"
placeholder="Password"
/>
</CardSectiion>
<CardSectiion>
<Button>
Login
</Button>
</CardSectiion>
</Card>
);
}
}
我导出了LoginForm类,但是出现了这个错误。 我做错了什么?
答案 0 :(得分:0)
import { Card, CardSectiion, Input, Button } from './common';
&#13;
此部分似乎出现了问题。请检查每个组件是否已正确导出。