@janiscommerce/ui-native 1.22.0 → 1.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -10,7 +10,7 @@ declare const CheckSizeValues: {
|
|
|
10
10
|
type sizeType = typeof CheckSizeValues;
|
|
11
11
|
type sizeKeys = keyof sizeType;
|
|
12
12
|
interface RadioButtonProps {
|
|
13
|
-
children
|
|
13
|
+
children?: React.ReactNode | string;
|
|
14
14
|
selected?: boolean;
|
|
15
15
|
onPress?: () => {};
|
|
16
16
|
checkPosition?: positions;
|
|
@@ -18,5 +18,5 @@ interface RadioButtonProps {
|
|
|
18
18
|
checkSize?: sizeKeys;
|
|
19
19
|
style?: ViewStyle;
|
|
20
20
|
}
|
|
21
|
-
declare const RadioButton: ({ children, onPress, selected, checkPosition, checkSize, disabled, style, ...props }: RadioButtonProps) => React.JSX.Element
|
|
21
|
+
declare const RadioButton: ({ children, onPress, selected, checkPosition, checkSize, disabled, style, ...props }: RadioButtonProps) => React.JSX.Element;
|
|
22
22
|
export default RadioButton;
|
|
@@ -35,9 +35,6 @@ const styles = StyleSheet.create({
|
|
|
35
35
|
},
|
|
36
36
|
});
|
|
37
37
|
const RadioButton = ({ children, onPress, selected = false, checkPosition = 'left', checkSize = 'sm', disabled = false, style, ...props }) => {
|
|
38
|
-
if (!children) {
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
38
|
const { container, row, reverseRow, checkToLeft, checkToRight } = styles;
|
|
42
39
|
const isStringChild = typeof children === 'string';
|
|
43
40
|
const checkLeft = checkPosition === 'left';
|
|
@@ -45,7 +42,7 @@ const RadioButton = ({ children, onPress, selected = false, checkPosition = 'lef
|
|
|
45
42
|
return (<TouchableOpacity style={[container, checkLeft ? row : reverseRow, style]} disabled={disabled} onPress={onPress} {...props}>
|
|
46
43
|
<CheckBox checked={selected} disabled={disabled} customSize={customSize} borderRadius={customSize / 2} onPress={onPress}/>
|
|
47
44
|
<View style={checkLeft ? checkToLeft : checkToRight}>
|
|
48
|
-
{isStringChild ? <Typography>{children}</Typography> : children}
|
|
45
|
+
{children && (isStringChild ? <Typography>{children}</Typography> : children)}
|
|
49
46
|
</View>
|
|
50
47
|
</TouchableOpacity>);
|
|
51
48
|
};
|