normal_input.tsx 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import React from "react";
  2. import { TextInput, StyleSheet, StyleProp, ViewStyle, KeyboardTypeOptions } from "react-native";
  3. interface NormalInputProps {
  4. placeholder: string;
  5. extendedStyle?: StyleProp<ViewStyle>;
  6. onChangeText: (text: string) => void;
  7. type?: KeyboardTypeOptions;
  8. secureTextEntry?: boolean;
  9. value?: string;
  10. }
  11. const NormalInput: React.FC<NormalInputProps> = ({
  12. placeholder,
  13. extendedStyle,
  14. type,
  15. onChangeText,
  16. secureTextEntry = false,
  17. value,
  18. }) => {
  19. return (
  20. <TextInput
  21. style={[styles.textInput, extendedStyle]}
  22. placeholder={placeholder}
  23. placeholderTextColor={"#888888"}
  24. secureTextEntry={secureTextEntry}
  25. keyboardType={type ? type : "default"}
  26. // onChangeText={(t) => console.log(t)}
  27. // onChangeText={onChangeText}
  28. value={value}
  29. onChangeText={(value) => onChangeText(value)}
  30. />
  31. );
  32. };
  33. const styles = StyleSheet.create({
  34. textInput: {
  35. maxWidth: "100%",
  36. fontSize: 16,
  37. borderWidth: 1,
  38. padding: 20,
  39. borderRadius: 12,
  40. borderColor: "#bbbbbb",
  41. },
  42. });
  43. export default NormalInput;