import React from 'react'; import PropTypes from 'prop-types'; import { Animated, TextInput, TouchableWithoutFeedback, View, StyleSheet, } from 'react-native'; import BaseInput from './BaseInput'; export default class Sae extends BaseInput { static propTypes = { height: PropTypes.number, /* * active border height */ borderHeight: PropTypes.number, /* * This is the icon component you are importing from react-native-vector-icons. * import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome'; * iconClass={FontAwesomeIcon} */ iconClass: PropTypes.func.isRequired, /* * Passed to react-native-vector-icons library as name prop */ iconName: PropTypes.string, /* * Passed to react-native-vector-icons library as color prop. * This is also used as border color. */ iconColor: PropTypes.string, inputPadding: PropTypes.number, labelHeight: PropTypes.number, }; static defaultProps = { iconColor: 'white', height: 48, inputPadding: 16, labelHeight: 24, borderHeight: 2, animationDuration: 300, iconName: 'pencil', }; render() { const { iconClass, iconColor, iconName, label, style: containerStyle, height: inputHeight, inputPadding, labelHeight, borderHeight, inputStyle, labelStyle, } = this.props; const { width, focusedAnim, value } = this.state; const AnimatedIcon = Animated.createAnimatedComponent(iconClass); return ( {label} {/* bottom border */} ); } } const styles = StyleSheet.create({ container: { overflow: 'hidden', }, label: { backgroundColor: 'transparent', fontWeight: 'bold', color: '#7771ab', }, textInput: { position: 'absolute', bottom: 0, left: 0, paddingLeft: 0, color: 'white', fontSize: 18, }, });