Moves unique styles of AppTextInput to local file and does some cleanup

This commit is contained in:
mashazyu
2020-03-23 15:51:23 +01:00
committed by Sofiya Tepikin
parent 652bc1ffe2
commit 3de92b9f77
2 changed files with 6 additions and 16 deletions
+6 -10
View File
@@ -2,24 +2,22 @@ import React from 'react'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import { StyleSheet, TextInput } from 'react-native' import { StyleSheet, TextInput } from 'react-native'
import { Containers } from '../../styles/redesign' import { Colors } from '../../styles/redesign'
const AppTextInput = ({ const AppTextInput = ({
autoFocus, autoFocus,
onChangeText, onChangeText,
placeholder, placeholder,
value, value,
style,
...props ...props
}) => { }) => {
if (!Array.isArray(style)) style = [style]
return ( return (
<TextInput <TextInput
autoFocus={autoFocus} autoFocus={autoFocus}
onChangeText={onChangeText} onChangeText={onChangeText}
placeholder={placeholder} placeholder={placeholder}
style={[styles.input, ...style]} style={styles.input}
value={value} value={value}
{...props} {...props}
/> />
@@ -30,17 +28,15 @@ AppTextInput.propTypes = {
autoFocus: PropTypes.bool, autoFocus: PropTypes.bool,
onChangeText: PropTypes.func, onChangeText: PropTypes.func,
placeholder: PropTypes.string, placeholder: PropTypes.string,
style: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
value: PropTypes.string, value: PropTypes.string,
} }
AppTextInput.defaultProps = {
style: []
}
const styles = StyleSheet.create({ const styles = StyleSheet.create({
input: { input: {
...Containers.greyBorder borderColor: Colors.grey,
borderRadius: 5,
borderStyle: 'solid',
borderWidth: 1,
} }
}) })
-6
View File
@@ -6,12 +6,6 @@ export default {
flex: 1, flex: 1,
justifyContent: 'center' justifyContent: 'center'
}, },
greyBorder: {
borderColor: Colors.grey,
borderRadius: 5,
borderStyle: 'solid',
borderWidth: 1,
},
page: { page: {
backgroundColor: Colors.tourquiseLight, backgroundColor: Colors.tourquiseLight,
flex: 1 flex: 1