我花了很多时间来解决这个问题,但是没有成功。当我单击开始按钮时,我得到: Navigation.getRegisteredScreen:使用了clientApp.StartRegistration,但尚未注册。 undefined不是对象(正在评估“ n.navigatorButtons”)。
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { NAVBAR_STYLE } from '../styles/NavBar';
import StartRegistrationContainer from './sign-in/StartRegistrationContainer';
import ProofOfAddressContainer from './sign-in/ProofOfAddressContainer';
import StartComponent from './StartComponent';
class StartContainer extends Component {
static navigatorStyle = NAVBAR_STYLE;
static navigatorOptions = {
screen: 'clientApp.Start',
};
onJumpPress = () => {
this.props.navigator.push(ProofOfAddressContainer.navigatorOptions);
};
onStartPress = () => {
this.props.navigator.push(StartRegistrationContainer.navigatorOptions);
}
render() {
return (
<StartComponent
onJumpPress={this.onJumpPress}
onStartPress={this.onStartPress}
/>
);
}
}
StartContainer.propTypes = {
navigator: PropTypes.object.isRequired,
};
export default StartContainer;
这是我单击“开始”按钮时所呼叫的班级:
import React, { Component } from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import StartRegistrationComponent from './StartRegistrationComponent';
import TermsAndConditionsContainer from './TermsAndConditionsContainer';
class StartRegistrationContainer extends Component {
static navigatorStyle = NAVBAR_NAVIGATION_STYLE;
static navigatorOptions = {
screen: 'clientApp.StartRegistration',
};
constructor() {
super();
this.state = { loading: false };
}
render() {
return (
<StartRegistrationComponent
navigator={this.props.navigator}
onStartPress={this.onStartPress}
loading={this.state.loading}
/>
);
}
我正在使用: 反应:“ 16.5.0,反应本机”:“ 0.57.1 react-native-camera“:” ^ 1.3.0 react-native-config“:” ^ 0.11.5 react-native-navigation“:” 1.x.x。