Skip to content

Commit 3c78e3b

Browse files
Merge pull request #252 from galio-org/dev
v0.8.1
2 parents a5ece90 + a08de43 commit 3c78e3b

File tree

8 files changed

+9092
-87
lines changed

8 files changed

+9092
-87
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
node_modules/**/*
22
.expo/*
33
npm-debug.*
4-
package-lock.json
54
yarn.lock
65
.DS_Store

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Under Galio's belt:
7272

7373
## Documentation
7474

75-
The documentation for Galio is hosted at our [our website](https://galio.io/docs?ref=galio-repo)
75+
The documentation for Galio is hosted at [our website](https://galio.io/docs?ref=galio-repo)
7676

7777
## Resources
7878

@@ -88,7 +88,7 @@ The documentation for Galio is hosted at our [our website](https://galio.io/docs
8888
We use GitHub Issues as the official bug tracker for Galio. Here are some advices for our users that want to report an issue:
8989

9090
1. Make sure that you are using the latest version of Galio. Check for your fork's master branch status and see if it's up to date with the upstream/master (our repository)
91-
2. Provide us with reproductible steps for the issue.
91+
2. Provide us with reproducible steps for the issue.
9292
3. Some issues may be platform specific, so specifying what platform and if it's a simulator or a hardware device will help a lot.
9393

9494
## Contributors

package-lock.json

Lines changed: 8996 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "galio-framework",
33
"main": "src/index.js",
4-
"version": "0.8.0",
4+
"version": "0.8.1",
55
"files": [
66
"src/"
77
],

src/Radio.js

Lines changed: 67 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,20 @@ import Text from './atomic/ions/Text';
66
import GalioTheme, { withGalio } from './theme';
77

88
function Radio({
9-
color,
10-
containerStyle,
11-
disabled,
12-
flexDirection,
13-
initialValue,
14-
label,
15-
labelStyle,
16-
onChange,
17-
radioOuterStyle,
18-
radioInnerStyle,
19-
styles,
20-
theme,
21-
}) {
9+
color,
10+
containerStyle,
11+
disabled,
12+
flexDirection,
13+
initialValue,
14+
label,
15+
labelStyle,
16+
onChange,
17+
radioOuterStyle,
18+
radioInnerStyle,
19+
styles,
20+
theme,
21+
value
22+
}) {
2223
const [checked, setChecked] = React.useState(initialValue);
2324

2425
// A D D I N G - R E Q U I R E D - S P A C E (S) - B A S E D - O N - F L E X - D I R E C T I O N
@@ -52,15 +53,15 @@ function Radio({
5253

5354
// O N - P R E S S - H A N D L E R
5455
function radioPressHandler() {
55-
const current = !checked;
56+
const current = true;
5657
onChange(current);
5758
setChecked(current);
5859
}
5960

6061
const containerStyles = [styles.container, flexDirection && { flexDirection }, containerStyle];
6162

6263
const whichColor =
63-
color && theme.COLORS[color.toUpperCase()] ? theme.COLORS[color.toUpperCase()] : color;
64+
color && theme.COLORS[color.toUpperCase()] ? theme.COLORS[color.toUpperCase()] : color;
6465

6566
const radioButtonOuterStyles = [
6667
styles.radioOuterStyles,
@@ -76,54 +77,60 @@ function Radio({
7677
radioInnerStyle,
7778
];
7879

80+
81+
// O N - V A L U E - P R O P - U P D A T E
82+
React.useEffect(() => {
83+
setChecked(initialValue || value);
84+
}, [value]);
85+
7986
return (
80-
<TouchableOpacity
81-
onPress={() => radioPressHandler()}
82-
style={containerStyles}
83-
activeOpacity={0.8}
84-
disabled={disabled}>
85-
<View style={radioButtonOuterStyles}>
86-
{checked ? <View style={radioButtonInnerStyles} /> : null}
87-
</View>
88-
{renderLabel()}
89-
</TouchableOpacity>
87+
<TouchableOpacity
88+
onPress={() => radioPressHandler()}
89+
style={containerStyles}
90+
activeOpacity={0.8}
91+
disabled={disabled}>
92+
<View style={radioButtonOuterStyles}>
93+
{checked ? <View style={radioButtonInnerStyles} /> : null}
94+
</View>
95+
{renderLabel()}
96+
</TouchableOpacity>
9097
);
9198
}
9299

93100
const styles = theme =>
94-
StyleSheet.create({
95-
container: {
96-
flexDirection: 'row',
97-
alignItems: 'center',
98-
justifyContent: 'flex-start',
99-
},
100-
radioOuterStyles: {
101-
height: theme.SIZES.RADIO_HEIGHT,
102-
width: theme.SIZES.RADIO_WIDTH,
103-
borderRadius: theme.SIZES.RADIO_HEIGHT * 0.5,
104-
borderWidth: theme.SIZES.RADIO_THICKNESS,
105-
alignItems: 'center',
106-
justifyContent: 'center',
107-
},
108-
radioInnerStyles: {
109-
height: theme.SIZES.RADIO_HEIGHT * 0.5,
110-
width: theme.SIZES.RADIO_WIDTH * 0.5,
111-
borderRadius: theme.SIZES.RADIO_HEIGHT * 0.25,
112-
},
113-
disabledRadioOuter: {
114-
borderColor: theme.COLORS.MUTED,
115-
},
116-
disabledRadioInner: {
117-
backgroundColor: theme.COLORS.MUTED,
118-
},
119-
textStyles: {
120-
color: theme.COLORS.BLACK,
121-
},
122-
disabledLabel: {
123-
color: theme.COLORS.MUTED,
124-
opacity: theme.SIZES.OPACITY,
125-
},
126-
});
101+
StyleSheet.create({
102+
container: {
103+
flexDirection: 'row',
104+
alignItems: 'center',
105+
justifyContent: 'flex-start',
106+
},
107+
radioOuterStyles: {
108+
height: theme.SIZES.RADIO_HEIGHT,
109+
width: theme.SIZES.RADIO_WIDTH,
110+
borderRadius: theme.SIZES.RADIO_HEIGHT * 0.5,
111+
borderWidth: theme.SIZES.RADIO_THICKNESS,
112+
alignItems: 'center',
113+
justifyContent: 'center',
114+
},
115+
radioInnerStyles: {
116+
height: theme.SIZES.RADIO_HEIGHT * 0.5,
117+
width: theme.SIZES.RADIO_WIDTH * 0.5,
118+
borderRadius: theme.SIZES.RADIO_HEIGHT * 0.25,
119+
},
120+
disabledRadioOuter: {
121+
borderColor: theme.COLORS.MUTED,
122+
},
123+
disabledRadioInner: {
124+
backgroundColor: theme.COLORS.MUTED,
125+
},
126+
textStyles: {
127+
color: theme.COLORS.BLACK,
128+
},
129+
disabledLabel: {
130+
color: theme.COLORS.MUTED,
131+
opacity: theme.SIZES.OPACITY,
132+
},
133+
});
127134

128135
Radio.defaultProps = {
129136
color: 'primary',
@@ -135,6 +142,7 @@ Radio.defaultProps = {
135142
onChange: () => {},
136143
styles: {},
137144
theme: GalioTheme,
145+
value: false
138146
};
139147

140148
Radio.propTypes = {
@@ -153,6 +161,7 @@ Radio.propTypes = {
153161
onChange: PropTypes.func,
154162
styles: PropTypes.any,
155163
theme: PropTypes.any,
164+
value: PropTypes.bool
156165
};
157166

158167
export default withGalio(Radio, styles);

src/atomic/atoms/Input.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ function Input({
7979
/>
8080
</TouchableOpacity>
8181
);
82-
const labelContent = label && <Text style={[styles.label, labelStyles || {}]}>{label}</Text>;
83-
const helpContent = help && <Text style={[styles.helpText, helpStyles || {}]}>{help}</Text>;
82+
const labelContent = label?.length > 0 && <Text style={[styles.label, labelStyles || {}]}>{label}</Text>;
83+
const helpContent = help?.length > 0 && <Text style={[styles.helpText, helpStyles || {}]}>{help}</Text>;
8484

8585
return (
8686
<View

src/helpers/getIconType.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,36 +14,37 @@ import FA5Icon from 'react-native-vector-icons/FontAwesome5';
1414
import SimpleLineIcon from 'react-native-vector-icons/SimpleLineIcons';
1515
import FeatherIcon from 'react-native-vector-icons/Feather';
1616
import AntIcon from 'react-native-vector-icons/AntDesign';
17+
import Fontisto from 'react-native-vector-icons/Fontisto';
1718

1819
export default type => {
1920
switch (type.toLowerCase()) {
2021
case 'zocial':
2122
return ZocialIcon;
22-
case 'octicon':
23+
case 'octicons':
2324
return OcticonIcon;
24-
case 'material':
25+
case 'materialicons':
2526
return MaterialIcon;
26-
case 'material-community':
27+
case 'materialcommunityicons':
2728
return MaterialCommunityIcon;
28-
case 'ionicon':
29+
case 'ionicons':
2930
return Ionicon;
3031
case 'foundation':
3132
return FoundationIcon;
3233
case 'evilicons':
3334
return EvilIcon;
3435
case 'entypo':
3536
return EntypoIcon;
36-
case 'font-awesome':
37+
case 'fontawesome':
3738
return FAIcon;
38-
case 'font-awesome-5':
39+
case 'fontawesome5':
3940
return FA5Icon;
40-
case 'simple-line-icon':
41+
case 'simplelineicons':
4142
return SimpleLineIcon;
4243
case 'feather':
4344
return FeatherIcon;
4445
case 'antdesign':
4546
return AntIcon;
4647
default:
47-
return MaterialIcon;
48+
return Fontisto;
4849
}
49-
};
50+
};

src/index.d.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,19 @@ import {
1111
declare module 'galio-framework' {
1212
type IconFamilyType =
1313
| 'Galio'
14-
| 'AntDesign'
15-
| 'Entypo'
16-
| 'EvilIcons'
17-
| 'Feather'
18-
| 'FontAwesome'
19-
| 'FontAwesome5'
20-
| 'Fontisto'
21-
| 'Foundation'
22-
| 'Ionicons'
23-
| 'MaterialIcons'
24-
| 'MaterialCommunityIcons'
25-
| 'Octicons'
26-
| 'Zocial'
27-
| 'SimpleLineIcons';
14+
| 'zocial'
15+
| 'octicon'
16+
| 'material'
17+
| 'material-community'
18+
| 'ionicon'
19+
| 'foundation'
20+
| 'evilicons'
21+
| 'entypo'
22+
| 'font-awesome'
23+
| 'font-awesome-5'
24+
| 'simple-line-icon'
25+
| 'feather'
26+
| 'antdesign';
2827

2928
type BaseColorType = string;
3029

@@ -188,6 +187,7 @@ declare module 'galio-framework' {
188187
label?: string;
189188
labelStyle?: TextStyle;
190189
onChange?: () => void;
190+
value?: boolean;
191191
}
192192
export class Radio extends React.Component<RadioProps> {}
193193

0 commit comments

Comments
 (0)