Skip to content

Instantly share code, notes, and snippets.

@ricardoleme
Created May 3, 2022 00:47
Show Gist options
  • Save ricardoleme/11de6ab67deb5d58346e2ca5ea3ecfba to your computer and use it in GitHub Desktop.
Save ricardoleme/11de6ab67deb5d58346e2ca5ea3ecfba to your computer and use it in GitHub Desktop.
import React, { useState } from 'react'
import styled from 'styled-components/native'
import { MaterialCommunityIcons } from '@expo/vector-icons'
import themes from '../../themes'
const InputArea = styled.View`
width: 100%;
height: 64px;
background-color: ${props => props.theme.card};
flex-direction: row;
border-radius: 32px;
padding-left: 16px;
align-items: center;
margin-bottom: 16px;
`
const Input = styled.TextInput`
flex: 1;
font-size: 16px;
color: ${props => props.theme.color_secondary};
margin-left: 8px;
`
const BotaoTouch = styled.TouchableOpacity`
padding-right: 8px;
`
export default ({ icon, placeholder, value, onChangeText, password}) => {
const [senha, setSenha] = useState(password);
return (
<InputArea>
<MaterialCommunityIcons name={icon} size={30} color={themes.padrao.colors.brand.laranja} />
<Input
placeholder={placeholder}
placeholderTextColor={themes.padrao.colors.brand.laranja}
value={value}
onChangeText={onChangeText}
secureTextEntry={senha}
/>
{password &&
<BotaoTouch onPress={() => setSenha(!senha)}>
<MaterialCommunityIcons name={senha ? 'eye' : 'eye-off'} size={30} color={themes.padrao.colors.brand.laranja50} />
</BotaoTouch>}
</InputArea>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment