@@ -4,17 +4,18 @@ import styled, { DefaultTheme } from 'styled-components/native'
44import { FontAwesome } from '@expo/vector-icons'
55
66export type Props = {
7- type : 'password' | 'text'
8- theme : DefaultTheme
7+ type ?: 'password' | 'text'
98} & TextInputProps
109
11- export const TextField : React . FC < Props > = props => {
12- const [ isSecureText , setShowSecureText ] = React . useState ( props . type === 'password' )
10+ type PropsWithTheme = Props & { theme : DefaultTheme }
11+
12+ export const TextField : React . FC < Props > = ( { type = 'text' , ...rest } ) => {
13+ const [ isSecureText , setShowSecureText ] = React . useState ( type === 'password' )
1314
1415 return (
1516 < Container >
16- < TextFieldStyled { ...props } secureTextEntry = { isSecureText } />
17- { props . type === 'password' ? (
17+ < TextFieldStyled { ...rest } secureTextEntry = { isSecureText } />
18+ { type === 'password' ? (
1819 < ToggleIcon >
1920 < FontAwesome size = { 28 } name = { isSecureText ? 'eye-slash' : 'eye' } onPress = { ( ) => setShowSecureText ( prev => ! prev ) } />
2021 </ ToggleIcon >
@@ -35,12 +36,15 @@ const Container = styled.View<Props>`
3536 background-color: ${ ( { theme } : { theme : DefaultTheme } ) => theme . textinputs ?. background } ;
3637`
3738
38- const TextFieldStyled = styled . TextInput . attrs ( ( props : Props ) => ( {
39+ const TextFieldStyled = styled . TextInput . attrs ( ( props : PropsWithTheme ) => ( {
3940 placeholderTextColor : props . theme . textinputs ?. placeholder . color || props . theme . colors . black ,
4041} ) ) `
4142 flex: 1;
4243 height: 40px;
4344 width: 100%;
45+ font-weight: 500;
46+ line-height: 20px;
47+ font-size: 18px;
4448 padding-horizontal: 16px;
4549 placeholder: ${ ( { theme } : { theme : DefaultTheme } ) => theme . colors . black } ;
4650 border-style: solid;
0 commit comments