Skip to content

Commit

Permalink
add example and description for #48
Browse files Browse the repository at this point in the history
  • Loading branch information
moschan committed Aug 13, 2017
1 parent 26d224c commit ee4bddd
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -129,6 +129,7 @@ callback when radio button clicked.

### initial (Default: `0`)
initial selected
> If you want to make it empty initially, please pass `-1`
### buttonColor(Default: '#2196f3')
change radio button color
Expand Down
17 changes: 17 additions & 0 deletions example/index.android.js
Expand Up @@ -24,6 +24,8 @@ class RadioButtonExample extends Component {
types1: [{label: 'param1', value: 0}, {label: 'param2', value: 1}],
value1: 0,
value1Index: 0,
value1_1: 0,
value1_1Index: 0,
types2: [{label: 'param1', value: 0}, {label: 'param2', value: 1}, {label: 'param3', value: 2},],
value2: 0,
value2Index: 0,
Expand All @@ -38,6 +40,7 @@ class RadioButtonExample extends Component {
<ScrollView>
<Text style={styles.welcome}>React Native Simple Radio Button Demo</Text>
<Text style={styles.welcome}>1. Basic</Text>

<View style={styles.component}>
<RadioForm
ref="radioForm"
Expand All @@ -62,6 +65,20 @@ class RadioButtonExample extends Component {
onPress={() => this.refs.radioForm.updateIsActiveIndex(0)}> Force Update </Button>
</View>

<View style={styles.component}>
<Text style={styles.welcome}>No initial set</Text>
<RadioForm
initial={-1}
radio_props={this.state.types1}
onPress={(value, index) => {
this.setState({
value1_1:value,
value1_1Index:index
})
}}
/>
</View>


<Text style={styles.welcome}>2. Advanced</Text>
<View style={styles.component}>
Expand Down
17 changes: 17 additions & 0 deletions example/index.ios.js
Expand Up @@ -24,6 +24,8 @@ class RadioButtonExample extends Component {
types1: [{label: 'param1', value: 0}, {label: 'param2', value: 1}],
value1: 0,
value1Index: 0,
value1_1: 0,
value1_1Index: 0,
types2: [{label: 'param1', value: 0}, {label: 'param2', value: 1}, {label: 'param3', value: 2},],
value2: 0,
value2Index: 0,
Expand All @@ -38,6 +40,7 @@ class RadioButtonExample extends Component {
<ScrollView>
<Text style={styles.welcome}>React Native Simple Radio Button Demo</Text>
<Text style={styles.welcome}>1. Basic</Text>

<View style={styles.component}>
<RadioForm
ref="radioForm"
Expand All @@ -62,6 +65,20 @@ class RadioButtonExample extends Component {
onPress={() => this.refs.radioForm.updateIsActiveIndex(0)}> Force Update </Button>
</View>

<View style={styles.component}>
<Text style={styles.welcome}>No initial set</Text>
<RadioForm
initial={-1}
radio_props={this.state.types1}
onPress={(value, index) => {
this.setState({
value1_1:value,
value1_1Index:index
})
}}
/>
</View>


<Text style={styles.welcome}>2. Advanced</Text>
<View style={styles.component}>
Expand Down

0 comments on commit ee4bddd

Please sign in to comment.