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 { StyleSheet, TextInput } from 'react-native'
import { Containers } from '../../styles/redesign'
import { Colors } from '../../styles/redesign'
const AppTextInput = ({
autoFocus,
onChangeText,
placeholder,
value,
style,
...props
}) => {
if (!Array.isArray(style)) style = [style]
return (
<TextInput
autoFocus={autoFocus}
onChangeText={onChangeText}
placeholder={placeholder}
style={[styles.input, ...style]}
style={styles.input}
value={value}
{...props}
/>
@@ -30,17 +28,15 @@ AppTextInput.propTypes = {
autoFocus: PropTypes.bool,
onChangeText: PropTypes.func,
placeholder: PropTypes.string,
style: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
value: PropTypes.string,
}
AppTextInput.defaultProps = {
style: []
}
const styles = StyleSheet.create({
input: {
...Containers.greyBorder
borderColor: Colors.grey,
borderRadius: 5,
borderStyle: 'solid',
borderWidth: 1,
}
})