vas*_*avi 5 javascript jquery reactjs react-native
在我的场景中,我使用导航器渲染组件.在该组件中,我执行了一些操作,例如保存记录,然后我动态地向现有组件添加了一个新的prop.但是这里的动态道具在该组件中是不可见的,只有之前的道具才可见.如何使用导航器为组件添加动态道具.
这里我在使用React Native导航器时提供代码我正在调用DisplayCustomSchema组件,如下所示
this.props.navigator.push({
id: 'DisplayCustomSchema',
name: 'DisplayCustomSchema',
org:this.props.org
});
Run Code Online (Sandbox Code Playgroud)
在DisplayCustomSchema组件中,componentDidMount我调用一个ajax发布它返回一些数据.
var DisplayCustomSchema = React.createClass({
componentDidMount : function(){
ajaxpost(data){//example only
this.props.record=data
//here i am try to move response data to props because I am using this data in saveRecord function but in save record props contain name and org only
}
}
render: function(){
<View>
<TouchableHighlight style={styles.touchButtonBorder} underlayColor="#ffa456" onPress={saveRecord.bind(this,this.props)}>
<Text style={styles.button}>SAVE</Text>
</TouchableHighlight>
</View>
}
})
Run Code Online (Sandbox Code Playgroud)
这里我的问题是为什么数据不会移动到道具
| 归档时间: |
|
| 查看次数: |
5458 次 |
| 最近记录: |