Allow `ReactNode` as a `label` of `RadioButton`
Closed this issue · 1 comments
Hey,
I would be interested to see if the label
prop of the RadioButton
could accept a ReactNode
instead of a string.
An example of what I want to achieve is shown in the screenshot, where I have some additional text with a different styling. Or even a text input. This is from a webapp.
This would also allow people to use any themed Text
components they might have, without having to override the labelStyle
prop.
I reckon, the code would look something like
const labelComp = (typeof label === "string" || typeof label === "number") ? <Text style={[margin, labelStyle]}>{label}</Text> : label;
This should keep it backwards compatible.
The docs then should probably state, that labelStyle
is ignored if the label
Prop is not a string.
A similar thing could be done for the description
prop.
I would be willing to contribute a PR for this.
@Haschikeks Interesting please send a PR.