我正在尝试在state
屏幕之间传递stacknavigation
。我已经用props
设置了MainScreen的NavigationInjectedProps
。
渲染props
时,它显示'id', 'title'
的属性undefined
。
这是我的代码:
import * as React from 'react';
import {NavigationInjectedProps, withNavigation} from 'react-navigation'
import {Card} from 'react-native-elements'
interface Props extends NavigationInjectedProps {
blog:{
id:number,
title:string,
}
}
class RegisterAgreeScreen extends React.Component<Props, State>{
render() {
const { id } = this.props.blog;
return (
<View style={{backgroundColor:'red'}}>
<Card
id={id}>
</Card>
</View>
);
}
}
export default withNavigation(RegisterAgreeScreen);
知道我做错了什么吗?