Skip to content

Commit b0b3128

Browse files
committed
RadioGroup containerStyle added
1 parent d096716 commit b0b3128

File tree

4 files changed

+12
-13
lines changed

4 files changed

+12
-13
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ value | string | no | | any string
117117
#### RadioGroup
118118
Key | Type | Required | Default | Valid Values
119119
--- | --- | --- | --- | ---
120+
containerStyle | object | no | | react style
120121
layout | enum | no | column | row / column
121122
onPress | function | no | | any function
122123
radioButtons | array | yes | | arrary of [RadioButton](#radiobutton) objects

lib/RadioGroup.tsx

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import _ from 'lodash';
44

55
import { RadioButton, RadioButtonProps, RadioGroupProps } from './index';
66

7-
export default function RadioGroup({ layout = 'column', onPress, radioButtons }: RadioGroupProps) {
7+
export default function RadioGroup({ containerStyle, layout = 'column', onPress, radioButtons }: RadioGroupProps) {
88

99
const [radioButtonsLocal, setRadioButtonsLocal] = useState<RadioButtonProps[]>(radioButtons);
1010

@@ -24,23 +24,20 @@ export default function RadioGroup({ layout = 'column', onPress, radioButtons }:
2424
}
2525

2626
return (
27-
<View style={styles.container}>
28-
<View style={{ flexDirection: layout }}>
29-
{radioButtonsLocal.map((button) => (
30-
<RadioButton
31-
{...button}
32-
key={button.id}
33-
onPress={handlePress}
34-
/>
35-
))}
36-
</View>
27+
<View style={[styles.container, { flexDirection: layout }, containerStyle]}>
28+
{radioButtonsLocal.map((button) => (
29+
<RadioButton
30+
{...button}
31+
key={button.id}
32+
onPress={handlePress}
33+
/>
34+
))}
3735
</View>
3836
)
3937
}
4038

4139
const styles = StyleSheet.create({
4240
container: {
43-
justifyContent: 'center',
4441
alignItems: 'center',
4542
}
4643
});

lib/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export type RadioButtonProps = {
1414
};
1515

1616
export type RadioGroupProps = {
17+
containerStyle?: object;
1718
layout?: 'row' | 'column';
1819
onPress?: (radioButtons: RadioButtonProps[]) => void;
1920
radioButtons: RadioButtonProps[];

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-radio-buttons-group",
3-
"version": "2.2.4",
3+
"version": "2.2.5",
44
"description": "Simple and Best. An easy to use radio buttons for react native apps.",
55
"main": "./lib/index.ts",
66
"scripts": {

0 commit comments

Comments
 (0)