Javascript 必须将组件传递给connect返回的函数。而是收到了{“propTypes”:{}

Javascript 必须将组件传递给connect返回的函数。而是收到了{“propTypes”:{},javascript,reactjs,react-native,Javascript,Reactjs,React Native,我更新了Expo,在我的连接屏幕上收到了以下消息,根据用户是否连接,它应该更改屏幕标题 错误来自以下行: headerTitle: connect((state) => ({ children: this.getTitle(state) }))(Text) 错误是: You must pass a component to the function returned by connect. Instead received {"propTypes":{}} 它以前工作得很好,所以我不知

我更新了Expo,在我的连接屏幕上收到了以下消息,根据用户是否连接,它应该更改屏幕标题

错误来自以下行:

headerTitle: connect((state) => ({ children: this.getTitle(state) }))(Text)
错误是:

You must pass a component to the function returned by connect. Instead received {"propTypes":{}}
它以前工作得很好,所以我不知道发生了什么

import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Logo from '../components/Logo';
import Form from '../components/Form';
import Wallpaper from '../components/Wallpaper';
import ButtonSubmit from '../components/ButtonSubmit';
import SignupSection from '../components/SignupSection';
import { Router, Scene, Actions, ActionConst } from 'react-native-router-flux';
import ErrorMessage from '../components/ErrorMessage';
import Dimensions from 'Dimensions';
import {StyleSheet, View, Text, Image, KeyboardAvoidingView} from 'react-native';
import {connect} from "react-redux";
import {ifIphoneX} from 'react-native-iphone-x-helper'

import logoImg from '@assets/images/logo.png';

class ConnexionScreen extends React.Component {
    constructor(props) {
        super(props);
        getTitle=(state)=>{{
            if(state.login.status){
                return 'MON COMPTE'
            }
            return 'CONNEXION'         
        }
      }
}
    handleSubmit() {
        console.log(this.loginform);
      }
  static navigationOptions = {
    headerTitle: connect((state) => ({ children: this.getTitle(state) }))(Text),
    headerTintColor: 'white',
    headerStyle: {
        backgroundColor: '#000',
        ...ifIphoneX({marginTop:-55}),
    },
    headerTitleStyle: {
        fontWeight: 'bold'
      },
  };
  render() {
      const { navigation, login } = this.props;
      const { status, email} = login;

    return (
        status === 0 ? (
        <Wallpaper>   
            <KeyboardAvoidingView style={styles.container} behavior="position" enabled>
                    <View style={{flex:1,flexDirection:"row",alignItems:"center", justifyContent:"center"}}>
                        <Image source={logoImg} style={styles.image} />
                    </View>
                    <ErrorMessage />
                    <Form />
                    <ButtonSubmit />
                    <View style={styles.OrContainer}>
                        <Text style={styles.Ortext}>ou</Text>
                    </View>
                    <View style={styles.buttonContainer}>
                        <Text style={styles.buttonText} onPress={()=>this.props.navigation.navigate("VIP")}>
                            DEVENIR VIP
                        </Text>
                    </View>
                    <View style={{height:50}}></View>
            </KeyboardAvoidingView>
        </Wallpaper>) :
            (
               <Wallpaper>  
                   <View style={{ flex: 1,flexDirection: "column",justifyContent: "center",alignItems: "center"}}>
                <View style={{height:200}}> 
                    <Logo />
                </View>
                 <View>
                    <Text style={{ color: "rgba(255,204,51, 1)",fontSize: 18,fontFamily: "oswald-demi-bold"}}> {`Email : ${email}`}</Text>
                    <Text style={{color:'#fff',fontSize: 18,color: "rgba(255,255,255, 1)", textAlign:"center"}} onPress={() => this.props.logout()}> {`Logout`}</Text>
                </View>
                </View>
                </Wallpaper>
            )

    );
  }
}

const mapStateToProps = ({login}) => ({login});
const mapDispatchToProps = (dispatch) => {
    const loginAction = require('@redux/LoginRedux').default
    return {
        logout: () => dispatch(loginAction.logout()),
    };
};
export default connect(mapStateToProps, mapDispatchToProps)(ConnexionScreen)
import React,{Component}来自'React';
从“道具类型”导入道具类型;
从“../components/Logo”导入徽标;
从“../components/Form”导入表单;
从“../components/Wallpar”导入壁纸;
从“../components/ButtonsSubmit”导入按钮提交;
从“../components/SignupSection”导入SignupSection;
从“react native Router flux”导入{Router,Scene,Actions,ActionConst};
从“../components/ErrorMessage”导入ErrorMessage;
从“维度”导入维度;
从“react native”导入{样式表、视图、文本、图像、键盘视图};
从“react redux”导入{connect};
从“react-native-iphone-x-helper”导入{ifIphoneX}
从“@assets/images/logo.png”导入logoImg;
类ConnexionScreen扩展React.Component{
建造师(道具){
超级(道具);
getTitle=(状态)=>{{
if(state.login.status){
返回“moncompte”
}
返回“连接”
}
}
}
handleSubmit(){
console.log(this.loginform);
}
静态导航选项={
headerTitle:connect((state)=>({children:this.getTitle(state)}))(Text),
头部颜色:“白色”,
头型:{
背景颜色:“#000”,
…ifIphoneX({marginTop:-55}),
},
头饰样式:{
fontWeight:“粗体”
},
};
render(){
const{navigation,login}=this.props;
const{status,email}=login;
返回(
状态===0(
欧点
this.props.navigation.navigate(“VIP”)}>
德维尼尔贵宾酒店
) :
(
{`Email:${Email}`}
this.props.logout()}>{`logout`}
)
);
}
}
const mapStateToProps=({login})=>({login});
const mapDispatchToProps=(调度)=>{
const loginAction=require('@redux/LoginRedux')。默认值
返回{
注销:()=>dispatch(loginAction.logout()),
};
};
导出默认连接(MapStateTrops、mapDispatchToProps)(连接屏幕)
我得到的错误…任何帮助都将不胜感激

You must pass a component to the function returned by connect. Instead received {"propTypes":{}}

wrapWithConnect
    connectAdvanced.js:101:29
<unknown>
    ConnexionScreen.js:32:74
loadModuleImplementation
    require.js:292:12
<unknown>
    MainTabNavigator.js:17
loadModuleImplementation
    require.js:292:12
<unknown>
    RootNavigation.js:6
loadModuleImplementation
    require.js:292:12
<unknown>
    App.js:5
loadModuleImplementation
    require.js:292:12
<unknown>
    AppEntry.js:2
loadModuleImplementation
    require.js:292:12
guardedLoadModule
    require.js:179:45
global code
    <unknown file>:0
必须将组件传递给connect返回的函数。而是收到{“propTypes”:{}
幽灵连接
connectAdvanced.js:101:29
ConnexionScreen.js:32:74
加载模块实现
require.js:292:12
MainTabNavigator.js:17
加载模块实现
require.js:292:12
RootNavigation.js:6
加载模块实现
require.js:292:12
App.js:5
加载模块实现
require.js:292:12
AppEntry.js:2
加载模块实现
require.js:292:12
保护加载模块
require.js:179:45
全局代码
:0

const-mapStateToProps=this.state.login.status你能改变这个吗?问题来自这一行:headerTitle:connect((state)=>({children:this.getTitle(state)}))(Text),在静态元素中,你不能从this.getTitle(state)调用“this”。“这”在这里不理解。@HuyNguyen它在世博会更新之前运行良好…
const-mapStateToProps=this.state.login.status你能改变这个吗?问题来自这一行:headerTitle:connect((state)=>({children:this.getTitle(state)}))(Text),在静态元素中,你不能从this.getTitle(state)调用“this”。“这个”在这里不明白。@HuyNguyen在世博会更新之前它工作得很好。。。