Introduces AppLoading, AppTextInput, Button components redesign

This commit is contained in:
mashazyu
2020-03-23 10:01:40 +01:00
committed by Sofiya Tepikin
parent 8c1c72ccc9
commit 3f8f6dbbe6
6 changed files with 90 additions and 35 deletions
+12 -6
View File
@@ -1,18 +1,24 @@
import React from 'react'
import { View } from 'react-native'
import { StyleSheet, View } from 'react-native'
import AppText from './app-text'
import { Containers } from '../../styles/redesign'
import { shared } from '../../i18n/en/labels'
const AppLoadingView = () => {
return (
<View flex={1}>
<View style={{flex:1, justifyContent: 'center'}}>
<AppText style={{alignSelf: 'center'}}>{shared.loading}</AppText>
</View>
<View style={styles.container}>
<AppText>{shared.loading}</AppText>
</View>
)
}
const styles = StyleSheet.create({
container: {
...Containers.centerItems
}
})
export default AppLoadingView
+25 -8
View File
@@ -1,17 +1,26 @@
import React from 'react'
import PropTypes from 'prop-types'
import { TextInput } from 'react-native'
import styles from '../../styles'
import { StyleSheet, TextInput } from 'react-native'
export default function AppTextInput({ style, ...props }) {
import { Containers } from '../../styles/redesign'
const AppTextInput = ({
autoFocus,
onChangeText,
placeholder,
value,
style,
...props
}) => {
if (!Array.isArray(style)) style = [style]
return (
<TextInput
style={[styles.textInputField, ...style]}
autoFocus={props.autoFocus}
onChangeText={props.onChangeText}
value={props.value}
placeholder={props.placeholder}
autoFocus={autoFocus}
onChangeText={onChangeText}
placeholder={placeholder}
style={[styles.input, ...style]}
value={value}
{...props}
/>
)
@@ -28,3 +37,11 @@ AppTextInput.propTypes = {
AppTextInput.defaultProps = {
style: []
}
const styles = StyleSheet.create({
input: {
...Containers.greyBorder
}
})
export default AppTextInput
+25 -18
View File
@@ -1,31 +1,38 @@
import React from 'react'
import PropTypes from 'prop-types'
import { TouchableOpacity } from 'react-native'
import AppText from './app-text'
import styles from '../../styles'
import { StyleSheet, TouchableOpacity } from 'react-native'
export default function Button({
backgroundColor,
children,
onPress,
style,
testID
}) {
import AppText from './app-text'
import { Containers, Typography } from '../../styles/redesign'
const Button = ({ children, isOrange, onPress, testID }) => {
const buttonStyle = isOrange ? styles.orange : {}
const textStyle = isOrange ? styles.buttonTextBold : styles.buttonTextRegular
return (
<TouchableOpacity
onPress={onPress}
style={[styles.button, style, { backgroundColor }]}
testID={testID}
>
<AppText style={styles.homeButtonText}>{children}</AppText>
<TouchableOpacity onPress={onPress} style={buttonStyle} testID={testID}>
<AppText style={textStyle}>{children}</AppText>
</TouchableOpacity>
)
}
Button.propTypes = {
backgroundColor: PropTypes.string,
children: PropTypes.node,
isOrange: PropTypes.bool,
onPress: PropTypes.func,
style: PropTypes.object,
testID: PropTypes.string
}
const styles = StyleSheet.create({
orange: {
...Containers.orangeButton
},
buttonTextBold: {
...Typography.buttonTextBold
},
buttonTextRegular: {
...Typography.buttonTextRegular
}
})
export default Button