undefined不是对象(评估'this.props = props')React-Native博览会

时间:2019-11-18 23:02:18

标签: javascript react-native react-navigation

刚开始项目就很烂

代码:

import React, {Component} from 'react';
import { Text, View } from 'react-native';
export default class SignUp extends Component() {
    constructor(props){
        super(props);
    }
    render() {
        return (
            <View>
                <Text>SignUp</Text>
            </View>
        );
    }
}

堆栈导航器:

import { createStackNavigator } from "react-navigation";
import SignUp from "../screens/SignUpScreen";

export default AuthStackNavigator = createStackNavigator({
    SignUp: SignUp,
})

出现此错误:

error pic

1 个答案:

答案 0 :(得分:2)

这是因为您应该写

export default class SignUp extends Component { ... } 

代替

export default class SignUp extends Component() { ... }