這是我的場景。 使用GetObjectField部件我填充一個TextInput,的 的onfocus將TextInput移動到另一組件使用導航推送方法 有我填充使用GenericSummary component.When我選擇對象 應該是該對象的對象列表替換到GetObjectField的TextInput一個組件的選定值應該使用反應本機填充到另一個組件中
var GetObjectField = React.createClass({
getInitialState:function(){
return {textValue:""};
},
changeState:function(text){
var self=this;//here also i am getting text value but i am unable to do the setState
self.setState({textValue: text });
},
view:function(value){
this.changeState(value);//Here i am getting selected object value
}
render : function(){
return (<View>
<TextInput id={key} style={styles.textInput} value={this.state.textValue} placeholder="select object" onFocus={getDataFromDB.bind(this,this.view)} />
</View>)
}
})
function getDataFromDB(fillObject,ev){
var target=ev;
this.props.navigator.push({
id:'LookupComponent',
name:'LookupComponent',
fillObject : fillObject,
target:target,
})
}
var LookupComponent=React.createClass({
renderScene:function(route, navigator) {
var self=this
var target = this.props.target;
var fillObject=this.props.fillObject;
return (
<TouchableHighlight onPress={this.fillData.bind(this,item.value[refKey],fillObject, target,self.props.navigator)} underlayColor="#ffa456" navigator = {self.props.navigator}>
<View >
<GenericSummary record={item.value} recordId={item.id} org={self.props.org} navigator = {self.props.navigator}/>
</View>
</TouchableHighlight>)
},
render:function() {
return(<Navigator
renderScene={this.renderScene.bind(this)}
navigator={this.props.navigator}
navigationBar={
<Navigator.NavigationBar style={styles.navBarStyle} routeMapper={NavigationBarRouteMapperPopUp} />
} />)
}
})
function fillData(data,fillObject,nav,ev){
nav.pop();//when pop the component the getObjectField component is rerendering again
if(typeof fillObject != undefined){
fillObject(rowData,target,data);
}
}
你的問題是什麼? –
當點擊TextInput我移動到另一個場景那裏我填充列表。當選擇列表中的值我需要將該值填充到TextInput的前一個組件 – vasavi