| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- import React, { forwardRef } from 'react';
- import { TextInput, StyleSheet, StyleProp, ViewStyle, KeyboardTypeOptions } from 'react-native';
- interface NormalInputProps {
- placeholder: string | undefined;
- extendedStyle?: StyleProp<ViewStyle>;
- onChangeText: (text: string) => void;
- type?: KeyboardTypeOptions;
- secureTextEntry?: boolean;
- value?: string;
- editable?: boolean;
- keyboardType?: KeyboardTypeOptions;
- autoCapitalize?: 'none' | 'sentences' | 'words' | 'characters' | undefined;
- textContentType?:
- | 'none'
- | 'URL'
- | 'addressCity'
- | 'addressCityAndState'
- | 'addressState'
- | 'countryName'
- | 'creditCardNumber'
- | 'emailAddress'
- | 'familyName'
- | 'fullStreetAddress'
- | 'givenName'
- | 'jobTitle'
- | 'location'
- | 'middleName'
- | 'name'
- | 'namePrefix'
- | 'nameSuffix'
- | 'nickname'
- | 'organizationName'
- | 'postalCode'
- | 'streetAddressLine1'
- | 'streetAddressLine2'
- | 'sublocality'
- | 'telephoneNumber'
- | 'username'
- | 'password'
- | 'newPassword'
- | 'oneTimeCode';
- autoComplete?:
- | 'name'
- | 'nickname'
- | 'username'
- | 'password'
- | 'new-password'
- | 'one-time-code'
- | 'email'
- | 'tel'
- | 'street-address'
- | 'postal-code'
- | 'cc-number'
- | 'cc-exp'
- | 'cc-csc'
- | 'cc-exp-month'
- | 'cc-exp-year'
- | 'off'
- | 'password-new';
- }
- const NormalInput = forwardRef<TextInput, NormalInputProps>(
- (
- {
- placeholder,
- extendedStyle,
- onChangeText,
- autoComplete,
- secureTextEntry = false,
- value,
- keyboardType,
- editable,
- textContentType = 'oneTimeCode',
- autoCapitalize
- },
- ref
- ) => {
- return (
- <TextInput
- ref={ref}
- style={[styles.textInput, extendedStyle, , {fontFamily: 'Roboto-Regular'}]}
- placeholder={placeholder}
- placeholderTextColor={'#888888'}
- secureTextEntry={secureTextEntry}
- keyboardType={keyboardType ? keyboardType : 'default'}
- value={value}
- onChangeText={(value) => onChangeText(value)}
- textContentType={textContentType}
- editable={editable}
- autoComplete={autoComplete}
- autoCapitalize={autoCapitalize}
- />
- );
- }
- );
- const styles = StyleSheet.create({
- textInput: {
- maxWidth: '100%',
- fontSize: 16,
- borderWidth: 1,
- padding: 20,
- borderRadius: 12,
- borderColor: '#bbbbbb'
- }
- });
- export default NormalInput;
|