Created
December 19, 2023 17:38
-
-
Save alic-xc/eee609cf2b94de993b6e53b5b9e9d403 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { View, Text, StyleSheet, TextInput } from "react-native"; | |
import React from "react"; | |
interface FormInputProps { | |
placeholder?: string; | |
title: string; | |
} | |
const FormInput = (props: FormInputProps) => { | |
const [value, setValue] = React.useState<string>(""); | |
const inputHandler = (val: string) => { | |
setValue(val); | |
}; | |
return ( | |
<View style={style.formInputContainer}> | |
<Text style={style.formInputLabel}>{props.title}</Text> | |
<TextInput | |
value={value} | |
style={style.formInput} | |
placeholder={props.placeholder} | |
onChangeText={inputHandler} | |
/> | |
</View> | |
); | |
}; | |
const style = StyleSheet.create({ | |
formInputContainer: { | |
display: "flex", | |
flexDirection: "column", | |
marginTop: 10, | |
marginBottom: 15, | |
}, | |
formInputLabel: { marginBottom: 5 }, | |
formInput: { | |
borderWidth: 1, | |
borderColor: "#E5E5E5", | |
padding: 5, | |
fontSize: 17, | |
borderRadius: 10, | |
}, | |
}); | |
export default FormInput; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment