Skip to content

Commit

Permalink
add factor parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
ming436534 committed Jan 10, 2017
1 parent 5dd8dcd commit 1323ff8
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/Avatar/Avatar.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,29 @@ const propTypes = {
container: View.propTypes.style,
content: Text.propTypes.style,
}),
/**
* Padding factor
*/
factor: PropTypes.number,
};
const defaultProps = {
style: {},
factor: 1,
};
const contextTypes = {
uiTheme: PropTypes.object.isRequired,
};

function getStyles(props, context) {
const { avatar } = context.uiTheme;
const { size } = props;

const { size, factor } = props;
const local = {};

if (size) {
local.container = {
height: size,
width: size,
borderRadius: size / 2,
height: size * factor,
width: size * factor,
borderRadius: size * factor / 2,
};
}

Expand Down Expand Up @@ -83,10 +87,8 @@ class Avatar extends PureComponent {


return (
<View style={{ flexGrow: 1 }}>
<View style={styles.container} >
{content}
</View>
<View style={styles.container} >
{content}
</View>
);
}
Expand Down

0 comments on commit 1323ff8

Please sign in to comment.