React native React Native-React Apollo-数据属性未定义
我需要在我的组件的scrollview中使用数据道具进行刷新。因此,我需要在我的React native React Native-React Apollo-数据属性未定义,react-native,amazon-dynamodb,react-apollo,apollo-client,aws-appsync,React Native,Amazon Dynamodb,React Apollo,Apollo Client,Aws Appsync,我需要在我的组件的scrollview中使用数据道具进行刷新。因此,我需要在我的onRefresh中调用data.refetch进行刷新。但我得到的数据是未定义的错误 代码: abc类扩展组件{ render(){ 返回( ..... ); } } 导出默认组合( ...., 图形ql( 我的疑问{ ..... } ) )(abc); 为什么我的数据属性未定义 这是我自己想出来的 class abc extends Component { static propTypes = {
onRefresh
中调用data.refetch
进行刷新。但我得到的数据是未定义的错误
代码:
abc类扩展组件{
render(){
返回(
.....
);
}
}
导出默认组合(
....,
图形ql(
我的疑问{
.....
}
)
)(abc);
为什么我的数据属性未定义 这是我自己想出来的
class abc extends Component {
static propTypes = {
....
refetchData: PropTypes.func.isRequired,
....
};
render() {
return (
<ScrollView>
<RefreshControl
onRefresh={this.props.refetchData}
refreshing={this.props.refreshing}
/>
</ScrollView>
);
}
}
export default compose(
graphql(MyQuery, {
props: props => ({
refetchData: props.data.refetch,
refreshing: props.data.networkStatus === 4,
})
}),
);
abc类扩展组件{
静态类型={
....
refetchData:PropTypes.func.isRequired,
....
};
render(){
返回(
);
}
}
导出默认组合(
graphql(MyQuery{
道具:道具=>({
refetchData:props.data.refetch,
刷新:props.data.networkStatus==4,
})
}),
);
我将refetch道具映射到一个自定义屏幕道具,并从RefreshControl调用它。我自己解决了这个问题
class abc extends Component {
static propTypes = {
....
refetchData: PropTypes.func.isRequired,
....
};
render() {
return (
<ScrollView>
<RefreshControl
onRefresh={this.props.refetchData}
refreshing={this.props.refreshing}
/>
</ScrollView>
);
}
}
export default compose(
graphql(MyQuery, {
props: props => ({
refetchData: props.data.refetch,
refreshing: props.data.networkStatus === 4,
})
}),
);
abc类扩展组件{
静态类型={
....
refetchData:PropTypes.func.isRequired,
....
};
render(){
返回(
);
}
}
导出默认组合(
graphql(MyQuery{
道具:道具=>({
refetchData:props.data.refetch,
刷新:props.data.networkStatus==4,
})
}),
);
我将refetch道具映射到自定义屏幕道具,并从RefreshControl调用它。否。我没有使用名称。我只需要刷新数据。无论如何,我已经通过将props.data.refetch映射到容器中的一个道具找到了答案。谢谢,不用了。我没有用名字。我只需要刷新数据。无论如何,我已经通过将props.data.refetch映射到容器中的一个道具找到了答案。非常感谢。