React-native-ui-kitten: RkChoiceGroup selected value

Created on 23 Nov 2017  路  3Comments  路  Source: akveo/react-native-ui-kitten

I have a question. How link value of selected radio button in RkChoiceGroup

<RkChoiceGroup radio style={styles.radioGroup} selectedIndex={1}> <TouchableOpacity choiceTrigger onPress={() => console.log('puff')}> <View style={[styles.radioRow, styles.spaceBottom]}> <RkChoice rkType='radio' style={styles.radio} onPress={() => console.log('puff')}/> <RkText rkType='bold'>Female</RkText> </View> </TouchableOpacity> <TouchableOpacity choiceTrigger onPress={() => console.log('puff')}> <View style={styles.radioRow}> <RkChoice rkType='radio' style={styles.radio} onPress={() => console.log('puff')}/> <RkText rkType='bold'>Male</RkText> </View> </TouchableOpacity> </RkChoiceGroup>

Most helpful comment

OK i answer by myself. Correct use is:

            <RkChoiceGroup radio style={styles.radioGroup} selectedIndex={0} onChange={(id) => console.log('id: ', id)} >
              <TouchableOpacity choiceTrigger>
                <View style={[styles.radioRow, styles.spaceBottom]}>
                  <RkChoice rkType='radio' style={styles.radio} />
                  <RkText rkType='bold'>Female</RkText>
                </View>
              </TouchableOpacity>
              <TouchableOpacity choiceTrigger >
                <View style={styles.radioRow}>
                  <RkChoice rkType='radio' style={styles.radio} />
                  <RkText rkType='bold'>Male</RkText>
                </View>
              </TouchableOpacity>
            </RkChoiceGroup>

All 3 comments

OK i answer by myself. Correct use is:

            <RkChoiceGroup radio style={styles.radioGroup} selectedIndex={0} onChange={(id) => console.log('id: ', id)} >
              <TouchableOpacity choiceTrigger>
                <View style={[styles.radioRow, styles.spaceBottom]}>
                  <RkChoice rkType='radio' style={styles.radio} />
                  <RkText rkType='bold'>Female</RkText>
                </View>
              </TouchableOpacity>
              <TouchableOpacity choiceTrigger >
                <View style={styles.radioRow}>
                  <RkChoice rkType='radio' style={styles.radio} />
                  <RkText rkType='bold'>Male</RkText>
                </View>
              </TouchableOpacity>
            </RkChoiceGroup>

Thanks, I think it should be on the docs

Done

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bkwhite picture bkwhite  路  3Comments

Gitldx picture Gitldx  路  3Comments

eyalyoli picture eyalyoli  路  3Comments

domsterthebot picture domsterthebot  路  3Comments

iosdev-republicofapps picture iosdev-republicofapps  路  3Comments