Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
unify border radius files and fix how we extract border radius modifiers
  • Loading branch information
ethanshar committed Apr 15, 2018
1 parent bf483b5 commit 0bbd651
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 26 deletions.
8 changes: 6 additions & 2 deletions src/commons/BaseComponent.js
Expand Up @@ -123,10 +123,14 @@ export default class BaseComponent extends Component {
}

extractBorderRadiusValue() {
const borderRadiusPropsKeys = _.chain(this.props)
.keys(this.props)
.filter(key => BorderRadiuses.getKeysPattern().test(key))
.value();
let borderRadius;
_.forEach(BorderRadiuses, (value, key) => {
_.forEach(borderRadiusPropsKeys, (key) => {
if (this.props[key] === true) {
borderRadius = value;
borderRadius = BorderRadiuses[key];
}
});

Expand Down
12 changes: 0 additions & 12 deletions src/style/BorderRadiuses.android.js

This file was deleted.

12 changes: 0 additions & 12 deletions src/style/BorderRadiuses.ios.js

This file was deleted.

26 changes: 26 additions & 0 deletions src/style/borderRadiuses.js
@@ -0,0 +1,26 @@
import _ from 'lodash';
import {Constants} from '../helpers';

class BorderRadiuses {
br0 = Constants.isIOS ? 0 : 0;
br10 = Constants.isIOS ? 3 : 2;
br20 = 6;
br30 = Constants.isIOS ? 9 : 8;
br40 = 12;
br50 = Constants.isIOS ? 15 : 16;
br60 = 20;
br100 = 999;

getKeysPattern() {
return new RegExp(
_.chain(this)
.keys()
.map(key => [`${key}`])
.flatten()
.join('|')
.value(),
);
}
}

export default new BorderRadiuses();

0 comments on commit 0bbd651

Please sign in to comment.