normal_input.tsx 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. textContentType?: "oneTimeCode";
  11. }
  12. const NormalInput: React.FC<NormalInputProps> = ({
  13. placeholder,
  14. extendedStyle,
  15. type,
  16. onChangeText,
  17. secureTextEntry = false,
  18. value,
  19. textContentType,
  20. }) => {
  21. return (
  22. <TextInput
  23. style={[styles.textInput, extendedStyle]}
  24. placeholder={placeholder}
  25. placeholderTextColor={"#888888"}
  26. secureTextEntry={secureTextEntry}
  27. keyboardType={type ? type : "default"}
  28. value={value}
  29. onChangeText={(value) => onChangeText(value)}
  30. textContentType={textContentType}
  31. />
  32. );
  33. };
  34. const styles = StyleSheet.create({
  35. textInput: {
  36. maxWidth: "100%",
  37. fontSize: 16,
  38. borderWidth: 1,
  39. padding: 20,
  40. borderRadius: 12,
  41. borderColor: "#bbbbbb",
  42. },
  43. });
  44. export default NormalInput;