Skip to content

Commit a2dbe84

Browse files
authored
fix(button): fix button styles using StyleSheet class (#17)
1 parent 601257c commit a2dbe84

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

src/components/Button/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const getStyle = (template, primary, danger, style) => {
1414
computedStyle = template.buttonDefault;
1515
}
1616

17-
return Object.assign({}, template.button, computedStyle, style);
17+
return [template.button, computedStyle, style];
1818
};
1919

2020
const getIcon = (primary, danger, icon) => {
@@ -29,7 +29,7 @@ const getIcon = (primary, danger, icon) => {
2929
} else {
3030
computedStyle = styles.buttonIcon.buttonDefault;
3131
}
32-
return Object.assign({}, icon, computedStyle);
32+
return [icon, computedStyle];
3333
};
3434

3535
const Button = ({

src/components/Button/styles.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
import {StyleSheet} from 'react-native';
2+
13
export default {
2-
button: {
4+
button: StyleSheet.create({
35
button: {
46
borderRadius: 4,
57
minWidth: 250
@@ -17,8 +19,8 @@ export default {
1719
borderWidth: 1,
1820
borderColor: 'red'
1921
}
20-
},
21-
buttonText: {
22+
}),
23+
buttonText: StyleSheet.create({
2224
button: {},
2325
buttonDefault: {
2426
color: '#333333'
@@ -27,8 +29,8 @@ export default {
2729
buttonDanger: {
2830
color: 'red'
2931
}
30-
},
31-
buttonIcon: {
32+
}),
33+
buttonIcon: StyleSheet.create({
3234
button: {},
3335
buttonDefault: {
3436
color: '#333333'
@@ -37,5 +39,5 @@ export default {
3739
buttonDanger: {
3840
color: 'red'
3941
}
40-
}
42+
})
4143
};

0 commit comments

Comments
 (0)