radio button react native code example
Example 1: react native radio buttons
import RadioForm, {RadioButton, RadioButtonInput, RadioButtonLabel} from 'react-native-simple-radio-button'; var radio_props = [ {label: 'param1', value: 0 }, {label: 'param2', value: 1 }]; var RadioButtonProject = React.createClass({ getInitialState: function() { return { value: 0, } }, render: function() { return ( {this.setState({value:value})}} /> ); }});
Example 2: react radio button
var SearchResult = React.createClass({
getInitialState: function () {
return {
site: '',
address: ''
};
},
onSiteChanged: function (e) {
this.setState({
site: e.currentTarget.value
});
},
onAddressChanged: function (e) {
this.setState({
address: e.currentTarget.value
});
},
render: function(){
var resultRows = this.props.data.map(function(result){
return (
{result.SITE_NAME} |
{result.ADDRESS} |
);
}, this);
return (
Name |
Address |
{resultRows}
chosen site name {this.state.site} |
chosen address {this.state.address} |
);
}
});