diff --git a/android/app/src/main/res/drawable/heart.png b/android/app/src/main/res/drawable/heart.png new file mode 100644 index 0000000..e2760cc Binary files /dev/null and b/android/app/src/main/res/drawable/heart.png differ diff --git a/src/components/CustomTextInput/index.js b/src/components/CustomTextInput/index.js index 26ea779..38f4063 100644 --- a/src/components/CustomTextInput/index.js +++ b/src/components/CustomTextInput/index.js @@ -1,37 +1,51 @@ import React, {useState} from 'react'; -import {TextInput, View, Text, Dimensions} from 'react-native'; +import {TextInput, View, Text, Dimensions, StyleSheet} from 'react-native'; -const FloatingLabelInput = ({label}) => { +const FloatingLabelInput = ({ + label, + textAlign, + direction, + onInputChange, + labelBackgroundColor, + onChangeText, + value, + ...props +}) => { const [isFocused, setIsFocused] = useState(false); - - const labelStyle = { - position: 'absolute', - right: 10, - backgroundColor : '#eee', - zIndex: 100, - paddingHorizontal : 5, - top: !isFocused ? '50%' : 0, - fontSize: !isFocused ? Dimensions.get('window').width / 25 : 14, - transform: [{translateY: -Dimensions.get('window').width / 35}], - color: !isFocused ? '#000' : '#000', - }; + const styles = StyleSheet.create({ + labelStyle: { + position: 'absolute', + right: 15, + backgroundColor: labelBackgroundColor, + zIndex : 100, + paddingHorizontal: 5, + textAlign: 'center', + top: !isFocused ? '50%' : 0, + fontSize: !isFocused ? Dimensions.get('window').width / 25 : 14, + transform: [{translateY: -Dimensions.get('window').width / 35}], + color: !isFocused ? '#000' : '#6CBE44', + // transition: Transitions.all(Transitions.) + }, + inputStyle: { + fontSize: Dimensions.get('window').width / 25, + color: '#000', + borderWidth: 0.5, + borderColor: isFocused ? '#6CBE44' : '#555', + borderRadius: 10, + padding: 10, + direction: direction, + textAlign: textAlign, + }, + }); return ( - {label} + {label} onChangeText(text)} onFocus={() => setIsFocused(true)} - onBlur={() => setIsFocused(false)} + onBlur={() => (value ? setIsFocused(true) : setIsFocused(false))} /> ); diff --git a/src/views/Home/index.js b/src/views/Home/index.js index 20eea71..5bcc076 100644 --- a/src/views/Home/index.js +++ b/src/views/Home/index.js @@ -1,11 +1,24 @@ -import React from 'react'; -import {View} from 'react-native'; +import React, {useState} from 'react'; +import {View, Text} from 'react-native'; import CustomTextInput from '../../components/CustomTextInput/index'; function Home({}) { + const [firstName, setFirstName] = useState(''); return ( - + + {firstName} ); }