React-native-paper: Enforce Android-like Radio Button on iOS

Created on 19 Jun 2018  路  2Comments  路  Source: callstack/react-native-paper


Current behaviour


The iOS Radio Button is invisible while unchecked, being extremely hard to even notice it is a Radio Button.

Expected behaviour


While I found out that this behaviour follows the guidelines for iOS, I would like to have the option available to choose between following the native behaviour for each of them or to enforce one of them.

In this case, enforce the Android Radio Button for both platforms.

Code sample

renderOptions(options) {
    const radioButtons = options.map((el) =>
        <View key={el.type} style={styles.radioContainer}>
            <Text style={styles.radioText}>{el.description}</Text>
            <RadioButton
                value={el.type}
                uncheckedColor={Colors.GrayDark}
                color={Colors.BlueMedium}
                checked={this.state.type === el.type}
            />
        </View>
    );

    return (
        <RadioButtonGroup
            onValueChange={value => this.setState({ value })}
            value={this.state.value}
        >
            {radioButtons}
        </RadioButtonGroup>
    );
}

render() {
    const options = ...;
    return (
        <View style={styles.container}>
            <Title style={styles.header}>{header}</Title>
            {this.renderOptions(options)}
        </View>
    );
}

What have you tried


Expected the component to receive props defining which Platform is required to load. If none is received, get the running Platform.

Your Environment

| software | version
| --------------------- | -------
| ios or android | ios
| react-native | 0.55.2
| react-native-paper | 1.8.0
| node | 8.11.2
| npm or yarn | npm

Most helpful comment

Closing since now you can use RadioButton.Android on iOS.

All 2 comments

Closing since now you can use RadioButton.Android on iOS.

Was this page helpful?
0 / 5 - 0 ratings