Skip to content

Commit 9481b0f

Browse files
authored
Merge pull request #29 from rcaferati/independent-border-radius
Independent control for border radius
2 parents ae435c2 + 37c6808 commit 9481b0f

File tree

8 files changed

+7486
-24
lines changed

8 files changed

+7486
-24
lines changed

demo/.expo/packager-info.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"devToolsPort": 19002,
3-
"expoServerPort": 19000,
4-
"packagerPort": 19001,
5-
"packagerPid": 1665,
6-
"expoServerNgrokUrl": "https://in-qqr.rcaferati.demo.exp.direct",
7-
"packagerNgrokUrl": "https://packager.in-qqr.rcaferati.demo.exp.direct",
8-
"ngrokPid": 1754
3+
"expoServerPort": null,
4+
"packagerPort": null,
5+
"packagerPid": null,
6+
"expoServerNgrokUrl": null,
7+
"packagerNgrokUrl": null,
8+
"ngrokPid": null
99
}

demo/.expo/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
"lanType": "ip",
44
"dev": false,
55
"minify": true,
6-
"urlRandomness": "in-qqr"
6+
"urlRandomness": "6z-ap6"
77
}

demo/app.json

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,8 @@
33
"name": "React Native Awesome Button Component",
44
"slug": "react-native-really-awesome-button",
55
"privacy": "public",
6-
"sdkVersion": "32.0.0",
7-
"platforms": [
8-
"ios",
9-
"android"
10-
],
6+
"sdkVersion": "33.0.0",
7+
"platforms": ["ios", "android"],
118
"version": "1.0.0",
129
"orientation": "portrait",
1310
"icon": "./assets/images/icon.png",
@@ -19,13 +16,11 @@
1916
"updates": {
2017
"fallbackToCacheTimeout": 0
2118
},
22-
"assetBundlePatterns": [
23-
"**/*"
24-
],
19+
"assetBundlePatterns": ["**/*"],
2520
"ios": {
2621
"supportsTablet": false
2722
},
2823
"description": "React Native button component. 3D at 60fps, progress enabled, social ready, extendable, production ready component that renders an awesome animated set of UI buttons. Source @ https://github.com/rcaferati/react-native-really-awesome-button Author @ https://caferati.me",
2924
"githubUrl": "https://github.com/rcaferati/react-native-really-awesome-button"
3025
}
31-
}
26+
}

demo/assets/icon.png

2.91 KB
Loading

demo/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
},
1313
"dependencies": {
1414
"@expo/samples": "2.1.1",
15-
"expo": "^32.0.0",
15+
"expo": "^33.0.0",
1616
"react": "16.5.0",
17-
"react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",
17+
"react-native": "https://github.com/expo/react-native/archive/sdk-33.0.0.tar.gz",
1818
"react-native-really-awesome-button": "1.4.2",
1919
"react-navigation": "^3.0.9"
2020
},
2121
"devDependencies": {
2222
"babel-preset-expo": "^5.0.0",
23-
"jest-expo": "^32.0.0"
23+
"jest-expo": "^33.0.0"
2424
},
2525
"private": true
2626
}

demo/yarn.lock

Lines changed: 7439 additions & 0 deletions
Large diffs are not rendered by default.

src/index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ export default class Button extends React.Component {
4242
backgroundShadow: PropTypes.string,
4343
borderColor: PropTypes.string,
4444
borderRadius: PropTypes.number,
45+
borderBottomLeftRadius: PropTypes.number,
46+
borderBottomRightRadius: PropTypes.number,
47+
borderTopLeftRadius: PropTypes.number,
48+
borderTopRightRadius: PropTypes.number,
49+
borderLeftBottomRadius: PropTypes.number,
4550
borderWidth: PropTypes.number,
4651
children: PropTypes.node,
4752
ExtraContent: PropTypes.node,
@@ -74,6 +79,10 @@ export default class Button extends React.Component {
7479
backgroundShadow: DEFAULT_BACKGROUND_SHADOW,
7580
borderColor: null,
7681
borderRadius: DEFAULT_BORDER_RADIUS,
82+
borderBottomLeftRadius: null,
83+
borderBottomRightRadius: null,
84+
borderTopLeftRadius: null,
85+
borderTopRightRadius: null,
7786
borderWidth: DEFAULT_BORDER_WIDTH,
7887
children: null,
7988
disabled: false,

src/styles.js

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ const memoized = memoize(
1111
backgroundShadow,
1212
borderColor,
1313
borderRadius,
14+
borderBottomLeftRadius,
15+
borderBottomRightRadius,
16+
borderTopLeftRadius,
17+
borderTopRightRadius,
1418
borderWidth,
1519
height,
1620
paddingBottom,
@@ -27,6 +31,13 @@ const memoized = memoize(
2731
}) => {
2832
const calcHeight = height + paddingBottom + paddingTop;
2933
const calcWidth = stretch ? "100%" : width || stateWidth || null;
34+
const borderRadiusObject = {};
35+
36+
borderRadiusObject.borderRadius = borderRadius;
37+
borderRadiusObject.borderBottomLeftRadius = borderBottomLeftRadius;
38+
borderRadiusObject.borderBottomRightRadius = borderBottomRightRadius;
39+
borderRadiusObject.borderTopLeftRadius = borderTopLeftRadius;
40+
borderRadiusObject.borderTopRightRadius = borderTopRightRadius;
3041

3142
const dimensionsDiff = {
3243
width: calcWidth,
@@ -53,11 +64,11 @@ const memoized = memoize(
5364
shadow: {
5465
bottom: -raiseLevel / 2,
5566
height: height - raiseLevel,
56-
borderRadius,
67+
...borderRadiusObject,
5768
backgroundColor: backgroundShadow
5869
},
5970
bottom: {
60-
borderRadius,
71+
...borderRadiusObject,
6172
backgroundColor: backgroundDarker,
6273
...dimensionsDiff
6374
},
@@ -67,7 +78,7 @@ const memoized = memoize(
6778
},
6879
content: {
6980
...dimensionsDiff,
70-
borderRadius
81+
...borderRadiusObject
7182
},
7283
activeBackground: {
7384
...dimensionsDiff,
@@ -76,7 +87,7 @@ const memoized = memoize(
7687
text: {
7788
borderColor,
7889
borderWidth,
79-
borderRadius,
90+
...borderRadiusObject,
8091
backgroundColor
8192
}
8293
});
@@ -92,6 +103,10 @@ export const getStyles = ({
92103
backgroundShadow,
93104
borderColor,
94105
borderRadius,
106+
borderBottomLeftRadius,
107+
borderBottomRightRadius,
108+
borderTopLeftRadius,
109+
borderTopRightRadius,
95110
borderWidth,
96111
height,
97112
paddingBottom,
@@ -115,6 +130,10 @@ export const getStyles = ({
115130
backgroundShadow,
116131
borderColor,
117132
borderRadius,
133+
borderBottomLeftRadius,
134+
borderBottomRightRadius,
135+
borderTopLeftRadius,
136+
borderTopRightRadius,
118137
borderWidth,
119138
height,
120139
paddingBottom,
@@ -137,7 +156,7 @@ export const styles = StyleSheet.create({
137156
zIndex: 10
138157
},
139158
container__text: {
140-
width: '100%',
159+
width: "100%",
141160
fontWeight: "bold",
142161
zIndex: 10,
143162
textAlign: "center"

0 commit comments

Comments
 (0)