Skip to content

Commit

Permalink
ran prettier; update to v0.11.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Monte9 committed Apr 23, 2017
1 parent 37450dd commit ddc4d50
Show file tree
Hide file tree
Showing 12 changed files with 153 additions and 117 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-elements",
"version": "0.11.0",
"version": "0.11.2",
"description": "React Native Elements & UI Toolkit",
"main": "src/index.js",
"repository": {
Expand All @@ -21,7 +21,7 @@
"postinstall": "./node_modules/.bin/opencollective-postinstall || exit 0",
"lint": "eslint src/",
"precommit": "lint-staged",
"prettify": "prettier --single-quote --trailing-comma --write 'src/**/*.js'"
"prettify": "prettier --single-quote --trailing-comma es5 --write 'src/**/*.js'"
},
"peerDependencies": {
"react-native-vector-icons": "~4.0.0"
Expand Down
8 changes: 7 additions & 1 deletion src/avatar/Avatar.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import React, { PropTypes } from 'react';
import { View, Image, StyleSheet, TouchableOpacity, Text as NativeText } from 'react-native';
import {
View,
Image,
StyleSheet,
TouchableOpacity,
Text as NativeText,
} from 'react-native';

import Icon from '../icons/Icon';
import Text from '../text/Text';
Expand Down
10 changes: 5 additions & 5 deletions src/badge/__tests__/badge.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@ import Badge from '../badge';

describe('Badge Component', () => {
it('should render without issue', () => {
const component = shallow(<Badge/>);
const component = shallow(<Badge />);

expect(component.length).toBe(1);
expect(toJson(component)).toMatchSnapshot();
});

it('should throw Error if value and child are included', () => {
expect(() => {
shallow(<Badge value={"hello"}><Text/></Badge>);
shallow(<Badge value={'hello'}><Text /></Badge>);
}).toThrow('Badge can only contain a single child or string value');
});

it('should render if element included', () => {
const component = shallow(<Badge ><Text title='foo' /></Badge>);
const component = shallow(<Badge><Text title="foo" /></Badge>);

expect(component.length).toBe(1);
expect(toJson(component)).toMatchSnapshot();
expect(component.props().children.props.title).toBe('foo');
});

it('old badge props should still work', () => {
const component = shallow(<Badge badge={{value: 'foo'}} />);
const component = shallow(<Badge badge={{ value: 'foo' }} />);

expect(component.length).toBe(1);
expect(toJson(component)).toMatchSnapshot();
})
});
});
8 changes: 4 additions & 4 deletions src/badge/badge.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Badge.propTypes = {
containerStyle: View.propTypes.style,
textStyle: View.propTypes.style,
children: PropTypes.element,
value: PropTypes.string
value: PropTypes.string,
};

styles = StyleSheet.create({
Expand All @@ -40,12 +40,12 @@ styles = StyleSheet.create({
backgroundColor: '#444',
borderRadius: 20,
position: 'absolute',
right: 30
right: 30,
},
text: {
fontSize: 14,
color: 'white'
}
color: 'white',
},
});

export default Badge;
34 changes: 17 additions & 17 deletions src/buttons/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
View,
Platform,
ActivityIndicator,
Text as NativeText
Text as NativeText,
} from 'react-native';
import colors from '../config/colors';
import Text from '../text/Text';
Expand Down Expand Up @@ -63,7 +63,7 @@ const Button = props => {
size={icon.size || (large ? 26 : 18)}
style={[
iconRight ? styles.iconRight : styles.icon,
icon.style && icon.style
icon.style && icon.style,
]}
name={icon.name}
/>
Expand Down Expand Up @@ -110,7 +110,7 @@ const Button = props => {
!large && styles.small,
buttonStyle && buttonStyle,
disabled && { backgroundColor: colors.disabled },
disabled && disabledStyle && disabledStyle
disabled && disabledStyle && disabledStyle,
]}
>
{icon && !iconRight && iconElement}
Expand All @@ -123,7 +123,7 @@ const Button = props => {
fontSize && { fontSize },
textStyle && textStyle,
fontWeight && { fontWeight },
fontFamily && { fontFamily }
fontFamily && { fontFamily },
]}
>
{title}
Expand Down Expand Up @@ -161,7 +161,7 @@ Button.propTypes = {
iconRight: PropTypes.bool,
fontWeight: PropTypes.string,
disabledStyle: View.propTypes.style,
fontFamily: PropTypes.string
fontFamily: PropTypes.string,
};

const styles = StyleSheet.create({
Expand All @@ -172,41 +172,41 @@ const styles = StyleSheet.create({
backgroundColor: colors.primary,
justifyContent: 'center',
alignItems: 'center',
flexDirection: 'row'
flexDirection: 'row',
},
text: {
color: 'white',
fontSize: normalize(16)
fontSize: normalize(16),
},
icon: {
marginRight: 10
marginRight: 10,
},
iconRight: {
marginLeft: 10
marginLeft: 10,
},
small: {
padding: 12
padding: 12,
},
smallFont: {
fontSize: normalize(14)
fontSize: normalize(14),
},
activityIndicatorStyle: {
marginHorizontal: 10,
height: 0
height: 0,
},
raised: {
...Platform.select({
ios: {
shadowColor: 'rgba(0,0,0, .4)',
shadowOffset: { height: 1, width: 1 },
shadowOpacity: 1,
shadowRadius: 1
shadowRadius: 1,
},
android: {
elevation: 2
}
})
}
elevation: 2,
},
}),
},
});

export default Button;
116 changes: 64 additions & 52 deletions src/buttons/ButtonGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,60 +29,66 @@ const ButtonGroup = props => {
onShowUnderlay,
setOpacityTo,
containerBorderRadius,
...attributes,
...attributes
} = props;

const Component = component || TouchableHighlight;
return (
<View style={[styles.container, containerStyle && containerStyle]} {...attributes}>
{
buttons.map((button, i) => {
return (
<Component
activeOpacity={activeOpacity}
setOpacityTo={setOpacityTo}
onHideUnderlay={onHideUnderlay}
onShowUnderlay={onShowUnderlay}
underlayColor={underlayColor || '#ffffff'}
onPress={onPress? () => onPress(i) : () => {}}
key={i}
style={[
styles.button,
i < buttons.length - 1 && {
borderRightWidth: innerBorderStyle && innerBorderStyle.width || 1,
borderRightColor: innerBorderStyle && innerBorderStyle.color || colors.grey4
},
i === buttons.length - 1 && {
...lastBorderStyle,
borderTopRightRadius: containerBorderRadius || 0,
borderBottomRightRadius: containerBorderRadius || 0,
},
i === 0 && {
borderTopLeftRadius: containerBorderRadius || 0,
borderBottomLeftRadius: containerBorderRadius || 0,
},
selectedIndex === i && {backgroundColor: selectedBackgroundColor || 'white'},
]}>
<View style={[
styles.textContainer,
buttonStyle && buttonStyle
]}>
{
button.element ? <button.element /> : (
<Text
style={[
styles.buttonText,
textStyle && textStyle,
selectedIndex === i && {color: colors.grey1},
selectedIndex === i && selectedTextStyle
]}>{button}</Text>
)
}
</View>
</Component>
);
})
}
<View
style={[styles.container, containerStyle && containerStyle]}
{...attributes}
>
{buttons.map((button, i) => {
return (
<Component
activeOpacity={activeOpacity}
setOpacityTo={setOpacityTo}
onHideUnderlay={onHideUnderlay}
onShowUnderlay={onShowUnderlay}
underlayColor={underlayColor || '#ffffff'}
onPress={onPress ? () => onPress(i) : () => {}}
key={i}
style={[
styles.button,
i < buttons.length - 1 && {
borderRightWidth: (innerBorderStyle &&
innerBorderStyle.width) ||
1,
borderRightColor: (innerBorderStyle &&
innerBorderStyle.color) ||
colors.grey4,
},
i === buttons.length - 1 && {
...lastBorderStyle,
borderTopRightRadius: containerBorderRadius || 0,
borderBottomRightRadius: containerBorderRadius || 0,
},
i === 0 && {
borderTopLeftRadius: containerBorderRadius || 0,
borderBottomLeftRadius: containerBorderRadius || 0,
},
selectedIndex === i && {
backgroundColor: selectedBackgroundColor || 'white',
},
]}
>
<View style={[styles.textContainer, buttonStyle && buttonStyle]}>
{button.element
? <button.element />
: <Text
style={[
styles.buttonText,
textStyle && textStyle,
selectedIndex === i && { color: colors.grey1 },
selectedIndex === i && selectedTextStyle,
]}
>
{button}
</Text>}
</View>
</Component>
);
})}
</View>
);
};
Expand Down Expand Up @@ -134,8 +140,14 @@ ButtonGroup.propTypes = {
onHideUnderlay: PropTypes.func,
onShowUnderlay: PropTypes.func,
setOpacityTo: PropTypes.any,
innerBorderStyle: PropTypes.oneOf(View.propTypes.style, NativeText.propTypes.style),
lastBorderStyle: PropTypes.oneOf(View.propTypes.style, NativeText.propTypes.style),
innerBorderStyle: PropTypes.oneOf(
View.propTypes.style,
NativeText.propTypes.style
),
lastBorderStyle: PropTypes.oneOf(
View.propTypes.style,
NativeText.propTypes.style
),
buttonStyle: View.propTypes.style,
selectedBackgroundColor: PropTypes.string,
containerBorderRadius: PropTypes.number,
Expand Down
8 changes: 7 additions & 1 deletion src/checkbox/CheckBox.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import React, { PropTypes } from 'react';
import { StyleSheet, TouchableOpacity, View, Platform, Text as NativeText } from 'react-native';
import {
StyleSheet,
TouchableOpacity,
View,
Platform,
Text as NativeText,
} from 'react-native';
import Text from '../text/Text';
import fonts from '../config/fonts';
import colors from '../config/colors';
Expand Down
8 changes: 7 additions & 1 deletion src/containers/Card.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import React, { PropTypes } from 'react';
import { View, StyleSheet, Platform, Image, Text as NativeText } from 'react-native';
import {
View,
StyleSheet,
Platform,
Image,
Text as NativeText,
} from 'react-native';
import fonts from '../config/fonts';
import colors from '../config/colors';
import Text from '../text/Text';
Expand Down
20 changes: 10 additions & 10 deletions src/form/FormInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
View,
Platform,
Dimensions,
Text as NativeText
Text as NativeText,
} from 'react-native';
import colors from '../config/colors';
import normalize from '../helpers/normalizeText';
Expand Down Expand Up @@ -51,7 +51,7 @@ FormInput.propTypes = {
inputStyle: NativeText.propTypes.style,
selectionColor: PropTypes.string,
textInputRef: PropTypes.string,
containerRef: PropTypes.string
containerRef: PropTypes.string,
};

const styles = StyleSheet.create({
Expand All @@ -63,23 +63,23 @@ const styles = StyleSheet.create({
borderBottomColor: colors.grey4,
borderBottomWidth: 1,
marginLeft: 20,
marginRight: 20
}
})
marginRight: 20,
},
}),
},
input: {
...Platform.select({
android: {
height: 46
height: 46,
},
ios: {
height: 36
}
height: 36,
},
}),
width: width,
color: colors.grey3,
fontSize: normalize(14)
}
fontSize: normalize(14),
},
});

export default FormInput;
Loading

0 comments on commit ddc4d50

Please sign in to comment.