我有一个组件显示ListView中的用户,它需要在呈现前进行抓取调用。React Native在渲染之前进行网络调用
我浏览到使用该组件:
this.props.navigator.resetTo({ id: 'ListUsers', getusers: true });
在ListUsers
组件我有componentWillReceiveProps
,这样我可以使读取调用之前渲染。
但是该方法从未被调用过。我可以导航到AddUser
组件。
从这里添加新用户或者用户可以取消。
如果添加新用户,我导航回用ListUsers
组件:
this.props.navigator.resetTo({ id: 'ListUsers', getusers: true });
此时componentWillReceiveProps
被调用。
如果用户取消,然后我用导航回到ListUsers
组件:
this.props.navigator.pop();
谁能帮助,看看有什么我做错了吗?