Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace 'width:100%' with 'marginHorizontal' #80

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/line/line.js
Expand Up @@ -4,7 +4,6 @@ import { View } from 'react-native';
export const Line = ({
textSize = 12,
color = '#efefef',
width = '100%',
style,
noMargin = false,
...props
Expand All @@ -14,14 +13,13 @@ export const Line = ({
const backgroundColor = color;
const borderRadius = textSize / 4;
const marginBottom = noMargin ? 0 : textSize;

const computedStyle = {
height,
alignSelf,
backgroundColor,
borderRadius,
width,
marginBottom,
marginHorizontal: 0
};

return <View style={[computedStyle, style]} {...props} />;
Expand Down
24 changes: 13 additions & 11 deletions src/placeholder/placeholder.js
Expand Up @@ -4,22 +4,22 @@ import Animations from '../animation/animations';

const styles = StyleSheet.create({
container: {
width: '100%',
flexDirection: 'row',
flex: 1,
marginHorizontal: 0
},
centerElement: {
flex: 1,
flex: 1
},
leftSide: {
marginRight: 12,
marginRight: 12
},
rightSide: {
marginLeft: 12,
},
marginLeft: 12
}
});

const makeRoot = (animation) => {
const makeRoot = animation => {
if (animation) {
const Animation = Animations[animation];

Expand Down Expand Up @@ -53,14 +53,16 @@ export const Placeholder = ({

const childrenArray = React.Children.toArray(children);
const sizeOfChildren = childrenArray.length;

const userStyle = props.style;
return (
<Root style={styles.container} {...props}>
<Root {...props} style={[styles.container, userStyle]}>
{renderLeft && withView(renderLeft, { style: styles.leftSide })}
<View style={styles.centerElement}>
{childrenArray.map((element, index) => React.cloneElement(element, {
noMargin: index === sizeOfChildren - 1,
}))}
{childrenArray.map((element, index) =>
React.cloneElement(element, {
noMargin: index === sizeOfChildren - 1
})
)}
</View>
{renderRight && withView(renderRight, { style: styles.rightSide })}
</Root>
Expand Down