Reputation: 3451
I am usingreact-native-radio-buttons-group for radio buttons in my app. I have a bit of difficulty to paint the labels of the radio buttons in some colors. I tried the example:
{
label: 'option one',
color: '#FFFFFF',
},
but only the bullets were painted. I want to paint the labels as well.
Now I got this:
Upvotes: 1
Views: 3221
Reputation: 1
The labelStyle you want is added to the RadioGroup.
<RadioGroup
radioButtons={radioButtons}
onPress={handleOnPress}
selectedId={value}
containerStyle={styles.radioGroup}
labelStyle={styles.labelStyle}
layout='row'
/>
Upvotes: 0
Reputation: 3451
I found a solution to my problem. It is a bit hacky but works. I wrapped the labels in <Text>
tags whit inline style as follows:
deliveryRadioData: [
{
id: 1,
label: (
<Text style={{color: '#FFFFFF'}}>{'option one'}</Text>
),
selected: true,
color: '#FFFFFF',
size: 16,
},
{
id: 2,
label: (
<Text style={{color: '#FFFFFF'}}>
{'option two'}
</Text>
),
selected: false,
color: '#FFFFFF',
size: 16,
},
],
};
Now the radio buttons look like this:
Upvotes: 2
Reputation: 3117
Check if there is labelStyle
prop.
Otherwise, try react-native-btr
NOTE: This package is updated and actively maintained in react-native-btr library. Hence, we recommend you to use this component from react-native-btr library.
Upvotes: 1