为什么我更改导航器道具执行两次处理程序?
why I change the navigator props execute twice handler?
这是我切换页面的视图
this.props.navigator.push({
component: QuestionDetail,
passProps: {
id: id,
enteredDetail: function() {
console.log(this)
}
}
});
// in QuestionDetail
render: function() {
this.props.enteredDetail();
....
在 Xcode 我看到了这个
RCTJSLog> {"navigator":{},"route":{"passProps":{"id":"1010000002652090"}},"id":"1010000002652090"}
RCTJSLog> {"navigator":{},"route":{"passProps":{"id":"1010000002652090"}},"id":"1010000002652090"}
它出现了两次!为什么?
看到这个问题:
https://github.com/facebook/react-native/issues/151
in order for the react diffing algorithm to correctly reset properties
back to their default state, we create a single dummy "defaultView"
for every type of view
这是我切换页面的视图
this.props.navigator.push({
component: QuestionDetail,
passProps: {
id: id,
enteredDetail: function() {
console.log(this)
}
}
});
// in QuestionDetail
render: function() {
this.props.enteredDetail();
....
在 Xcode 我看到了这个
RCTJSLog> {"navigator":{},"route":{"passProps":{"id":"1010000002652090"}},"id":"1010000002652090"}
RCTJSLog> {"navigator":{},"route":{"passProps":{"id":"1010000002652090"}},"id":"1010000002652090"}
它出现了两次!为什么?
看到这个问题:
https://github.com/facebook/react-native/issues/151
in order for the react diffing algorithm to correctly reset properties back to their default state, we create a single dummy "defaultView" for every type of view