react-native-confirmation-code-field
Advanced tools
Comparing version 4.0.0 to 4.1.0
@@ -30,3 +30,3 @@ import * as React from 'react'; | ||
CellComponent?: React.ComponentType<any>, | ||
CellComponent?: React.ComponentType<any>; | ||
activeColor?: string; | ||
@@ -46,3 +46,6 @@ cellBorderWidth?: number; | ||
cellProps?: ReactNative.TextInputProps | CellPropsFn; | ||
inputProps?: ReactNative.TextInputProps; | ||
inputProps?: Omit< | ||
ReactNative.TextInputProps, | ||
'autoFocus' | 'keyboardType' | 'value' | ||
>; | ||
containerProps?: ReactNative.ViewProps; | ||
@@ -49,0 +52,0 @@ |
{ | ||
"name": "react-native-confirmation-code-field", | ||
"version": "4.0.0", | ||
"version": "4.1.0", | ||
"main": "src/components/ConfirmationCodeInput/index.js", | ||
@@ -5,0 +5,0 @@ "peerDependencies": { |
// @flow | ||
import React, { PureComponent, createRef } from 'react'; | ||
import { View, TextInput as TextInputNative, Platform } from 'react-native'; | ||
import React, { createRef, PureComponent } from 'react'; | ||
import { Platform, TextInput as TextInputNative, View } from 'react-native'; | ||
@@ -14,3 +14,3 @@ import { concatStyles } from '../../styles'; | ||
import type { Props, State } from './types'; | ||
import type { Props, State, TextInputProp } from './types'; | ||
import type { | ||
@@ -139,3 +139,6 @@ LayoutEvent, | ||
inheritTextInputMethod(methodName: string, handler: Function) { | ||
inheritTextInputMethod<MethodName: string>( | ||
methodName: MethodName, | ||
handler: $ElementType<TextInputProp, MethodName>, | ||
) { | ||
return (e: mixed) => { | ||
@@ -152,4 +155,4 @@ handler(e); | ||
handlerOnTextChange = this.inheritTextInputMethod( | ||
'onTextChange', | ||
handlerOnTextChange = this.inheritTextInputMethod<'onChangeText'>( | ||
'onChangeText', | ||
(text: string) => { | ||
@@ -258,7 +261,7 @@ const codeValue = this.truncateString(text); | ||
handlerOnFocus = this.inheritTextInputMethod('onFocus', () => | ||
handlerOnFocus = this.inheritTextInputMethod<'onFocus'>('onFocus', () => | ||
this.setState({ isFocused: true }), | ||
); | ||
handlerOnBlur = this.inheritTextInputMethod('onBlur', () => | ||
handlerOnBlur = this.inheritTextInputMethod<'onBlur'>('onBlur', () => | ||
this.setState({ isFocused: false }), | ||
@@ -284,5 +287,5 @@ ); | ||
onBlur={this.handlerOnBlur} | ||
onChangeText={this.handlerOnTextChange} | ||
onFocus={this.handlerOnFocus} | ||
style={concatStyles(styles.maskInput, inputProps.style)} | ||
onChangeText={this.handlerOnTextChange} | ||
value={this.state.codeValue} | ||
@@ -289,0 +292,0 @@ /> |
@@ -44,3 +44,10 @@ // @flow | ||
containerProps: ViewProps, | ||
inputProps: TextInputProp, | ||
inputProps: $Diff< | ||
TextInputProp, | ||
{ | ||
autoFocus: any, | ||
keyboardType: any, | ||
value: any, | ||
}, | ||
>, | ||
testID?: any, | ||
@@ -47,0 +54,0 @@ |}>; |
30291
672