【发布时间】:2017-10-14 07:59:31
【问题描述】:
我有这个表格代码:
<Form>
<Item floatingLabel last>
<Label>Email</Label>
<Input onChangeText={ (text)=> this.setState({email: text}) }
/>
</Item>
<Item floatingLabel last>
<Label>Mobile</Label>
<Input onChangeText={ (text)=> this.setState({reg_mob_no: text}) }
/>
</Item>
<Item disabled floatingLabel last>
<Label>Package : {this.props.package_name}</Label>
<Input disabled onChange={(text) => this.setState({package_select:this.props.package_id}) }
/>
</Item>
<Item floatingLabel last>
<Label>Password</Label>
<Input onChangeText={ (text)=> this.setState({password: text}) }
secureTextEntry={true}/>
</Item>
<View padder>
<Button block style={{ backgroundColor:"#FF69B4" }} onPress={this.onRegisterPressed.bind(this)} >
<Text>Submit</Text>
</Button>
</View>
</Form>
我想将props 值传递给package_select 表单字段。this.props.package_id 是道具,道具值是整数。
我将如何将 prop 值传递给表单字段?
【问题讨论】:
标签: javascript reactjs react-native textinput