Skip to content

Instantly share code, notes, and snippets.

@alic-xc
Created December 19, 2023 17:38
Show Gist options
  • Save alic-xc/eee609cf2b94de993b6e53b5b9e9d403 to your computer and use it in GitHub Desktop.
Save alic-xc/eee609cf2b94de993b6e53b5b9e9d403 to your computer and use it in GitHub Desktop.
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