私はreact-native
プロジェクトで作業しており、最近0.26
から0.30
にアップグレードしました。 ナビゲーション実験は、特に名前付け(NavigationRoute
、NavigationState
、...)と、onNavigateBack
となるNavigationCardStack
の方法onNavigate
の変更にかなりの変更を受けました。NavigationExperimentalプロパティ 'onNavigateBack`が見つかりません
私はフロー0.27.0
を使用して自分のコードをチェックしています。
のエラーからのエラーです。
app/containers/MyContainer.js:99
99: <NavigationCardStack
^props of React element `NavigationCardStack`
67: type Props = NavigationSceneRendererProps & {
^property `onNavigateBack`. Property not found in. See: node_modules/react-native/Libraries/CustomComponents/NavigationExperimental/NavigationHeader.js:67
113: {...props}
^^^^^ spread of identifier `props`
app/containers/MyContainer.js:112
112: <NavigationHeader
^React element `NavigationHeader`
67: type Props = NavigationSceneRendererProps & {
^property `onNavigateBack`. Property not found in. See: node_modules/react-native/Libraries/CustomComponents/NavigationExperimental/NavigationHeader.js:67
113: {...props}
^^^^^ spread of identifier `props`
ここにエラーが発生したコードを示します。 this.props.onNavigateBack
は、reduxのconnect
メソッドからその値を取得します。
class MyContainer extends Component {
props: Props;
render() {
return (
<NavigationCardStack
navigationState={this.props.navigationState}
onNavigateBack={this.props.onNavigateBack}
renderOverlay={props => this._renderNavigationHeader(props)}
renderScene={scene => (<View />)}
style={styles.container}
/>
)
}
_renderNavigationHeader(props) {
return (
<NavigationHeader
{...props}
style={styles.header}
textStyle={styles.title}
renderLeftComponent={props => (<View />)}
renderRightComponent={props => (<View />)}
renderTitleComponent={props => (<View />)}
/>
)
}
}
私は私が宣言Props
タイプが() => void
としてonNavigateBack
含まれています、できるだけコードは限り短く作ってみました。