@@ -149,7 +149,7 @@ type TextInputStateType = $ReadOnly<{
149149 blurTextInput : ( textField : ?HostInstance ) => void ,
150150} > ;
151151
152- type ViewCommands = $NonMaybeType <
152+ type ViewCommands = NonNullable <
153153 | typeof AndroidTextInputCommands
154154 | typeof RCTMultilineTextInputNativeCommands
155155 | typeof RCTSinglelineTextInputNativeCommands ,
@@ -188,8 +188,8 @@ function useTextInputStateSynchronization({
188188 const [ lastNativeText , setLastNativeText ] = useState < ?Stringish > ( props . value ) ;
189189 const [ lastNativeSelectionState , setLastNativeSelection ] =
190190 useState < LastNativeSelection > ( {
191- selection : { start : - 1 , end : - 1 } ,
192- mostRecentEventCount : mostRecentEventCount ,
191+ mostRecentEventCount ,
192+ selection : { end : - 1 , start : - 1 } ,
193193 } ) ;
194194
195195 const lastNativeSelection = lastNativeSelectionState . selection ;
@@ -212,7 +212,7 @@ function useTextInputStateSynchronization({
212212 lastNativeSelection . end !== selection . end )
213213 ) {
214214 nativeUpdate . selection = selection ;
215- setLastNativeSelection ( { selection , mostRecentEventCount } ) ;
215+ setLastNativeSelection ( { mostRecentEventCount , selection } ) ;
216216 }
217217
218218 if ( Object . keys ( nativeUpdate ) . length === 0 ) {
@@ -240,7 +240,7 @@ function useTextInputStateSynchronization({
240240 viewCommands ,
241241 ] ) ;
242242
243- return { setLastNativeText , setLastNativeSelection } ;
243+ return { setLastNativeSelection , setLastNativeText } ;
244244}
245245
246246/**
@@ -377,8 +377,8 @@ function InternalTextInput(props: TextInputProps): React.Node {
377377 propsSelection == null
378378 ? null
379379 : {
380- start : propsSelection . start ,
381380 end : propsSelection . end ?? propsSelection . start ,
381+ start : propsSelection . start ,
382382 } ;
383383
384384 const text =
@@ -397,9 +397,9 @@ function InternalTextInput(props: TextInputProps): React.Node {
397397 const [ mostRecentEventCount , setMostRecentEventCount ] = useState < number > ( 0 ) ;
398398 const { setLastNativeText, setLastNativeSelection} =
399399 useTextInputStateSynchronization ( {
400- props,
401400 inputRef,
402401 mostRecentEventCount,
402+ props,
403403 selection,
404404 text,
405405 viewCommands,
@@ -469,13 +469,13 @@ function InternalTextInput(props: TextInputProps): React.Node {
469469 ) ;
470470 }
471471 } ,
472+ getNativeRef ( ) : ?TextInputInstance {
473+ return inputRef . current ;
474+ } ,
472475 // TODO: Fix this returning true on null === null, when no input is focused
473476 isFocused ( ) : boolean {
474477 return TextInputState . currentlyFocusedInput ( ) = == inputRef . current;
475478 } ,
476- getNativeRef ( ) : ?TextInputInstance {
477- return inputRef . current ;
478- } ,
479479 setSelection ( start : number , end : number ) : void {
480480 if ( inputRef . current != null ) {
481481 viewCommands . setTextAndSelection (
@@ -525,8 +525,8 @@ function InternalTextInput(props: TextInputProps): React.Node {
525525 }
526526
527527 setLastNativeSelection ( {
528- selection : event . nativeEvent . selection ,
529528 mostRecentEventCount,
529+ selection : event . nativeEvent . selection ,
530530 } ) ;
531531 } ;
532532
@@ -590,6 +590,7 @@ function InternalTextInput(props: TextInputProps): React.Node {
590590
591591 const config = useMemo (
592592 ( ) => ( {
593+ cancelable : Platform . OS === 'ios' ? ! rejectResponderTermination : null ,
593594 hitSlop,
594595 onPress : ( event : GestureResponderEvent ) => {
595596 onPress ?. ( event ) ;
@@ -599,9 +600,8 @@ function InternalTextInput(props: TextInputProps): React.Node {
599600 }
600601 }
601602 } ,
602- onPressIn : onPressIn ,
603- onPressOut : onPressOut ,
604- cancelable : Platform . OS === 'ios' ? ! rejectResponderTermination : null ,
603+ onPressIn,
604+ onPressOut,
605605 } ) ,
606606 [
607607 editable ,
@@ -740,12 +740,12 @@ function InternalTextInput(props: TextInputProps): React.Node {
740740 }
741741 // For consistency with iOS set cursor/selectionHandle color as selectionColor
742742 const colorProps = {
743+ cursorColor : cursorColor === undefined ? selectionColor : cursorColor ,
743744 selectionColor,
744745 selectionHandleColor :
745746 selectionHandleColor === undefined
746747 ? selectionColor
747748 : selectionHandleColor ,
748- cursorColor : cursorColor === undefined ? selectionColor : cursorColor ,
749749 } ;
750750 textInput = (
751751 /* $FlowFixMe[prop-missing] the types for AndroidTextInput don't match up
@@ -799,8 +799,8 @@ function InternalTextInput(props: TextInputProps): React.Node {
799799}
800800
801801const enterKeyHintToReturnTypeMap = {
802- enter : 'default' ,
803802 done : 'done' ,
803+ enter : 'default' ,
804804 go : 'go' ,
805805 next : 'next' ,
806806 previous : 'previous' ,
@@ -809,19 +809,20 @@ const enterKeyHintToReturnTypeMap = {
809809} as const ;
810810
811811const inputModeToKeyboardTypeMap = {
812- none : 'default' ,
813- text : 'default' ,
814812 decimal : 'decimal-pad' ,
813+ email : 'email-address' ,
814+ none : 'default' ,
815815 numeric : 'number-pad' ,
816- tel : 'phone-pad' ,
817816 search :
818817 Platform . OS === 'ios' ? ( 'web-search' as const ) : ( 'default' as const ) ,
819- email : 'email-address' ,
818+ tel : 'phone-pad' ,
819+ text : 'default' ,
820820 url : 'url' ,
821821} as const ;
822822
823823// Map HTML autocomplete values to Android autoComplete values
824824const autoCompleteWebToAutoCompleteAndroidMap = {
825+ 'additional-name' : 'name-middle' ,
825826 'address-line1' : 'postal-address-region' ,
826827 'address-line2' : 'postal-address-locality' ,
827828 bday : 'birthdate-full' ,
@@ -836,12 +837,11 @@ const autoCompleteWebToAutoCompleteAndroidMap = {
836837 country : 'postal-address-country' ,
837838 'current-password' : 'password' ,
838839 email : 'email' ,
840+ 'family-name' : 'name-family' ,
841+ 'given-name' : 'name-given' ,
839842 'honorific-prefix' : 'name-prefix' ,
840843 'honorific-suffix' : 'name-suffix' ,
841844 name : 'name' ,
842- 'additional-name' : 'name-middle' ,
843- 'family-name' : 'name-family' ,
844- 'given-name' : 'name-given' ,
845845 'new-password' : 'password-new' ,
846846 off : 'off' ,
847847 'one-time-code' : 'sms-otp' ,
@@ -856,33 +856,33 @@ const autoCompleteWebToAutoCompleteAndroidMap = {
856856
857857// Map HTML autocomplete values to iOS textContentType values
858858const autoCompleteWebToTextContentTypeMap = {
859+ 'additional-name' : 'middleName' ,
859860 'address-line1' : 'streetAddressLine1' ,
860861 'address-line2' : 'streetAddressLine2' ,
861862 bday : 'birthdate' ,
862863 'bday-day' : 'birthdateDay' ,
863864 'bday-month' : 'birthdateMonth' ,
864865 'bday-year' : 'birthdateYear' ,
866+ 'cc-additional-name' : 'creditCardMiddleName' ,
865867 'cc-csc' : 'creditCardSecurityCode' ,
868+ 'cc-exp' : 'creditCardExpiration' ,
866869 'cc-exp-month' : 'creditCardExpirationMonth' ,
867870 'cc-exp-year' : 'creditCardExpirationYear' ,
868- 'cc-exp' : 'creditCardExpiration' ,
869- 'cc-given-name' : 'creditCardGivenName' ,
870- 'cc-additional-name' : 'creditCardMiddleName' ,
871871 'cc-family-name' : 'creditCardFamilyName' ,
872+ 'cc-given-name' : 'creditCardGivenName' ,
872873 'cc-name' : 'creditCardName' ,
873874 'cc-number' : 'creditCardNumber' ,
874875 'cc-type' : 'creditCardType' ,
875- 'current-password' : 'password' ,
876876 country : 'countryName' ,
877+ 'current-password' : 'password' ,
877878 email : 'emailAddress' ,
878- name : 'name' ,
879- 'additional-name' : 'middleName' ,
880879 'family-name' : 'familyName' ,
881880 'given-name' : 'givenName' ,
882- nickname : 'nickname' ,
883881 'honorific-prefix' : 'namePrefix' ,
884882 'honorific-suffix' : 'nameSuffix' ,
883+ name : 'name' ,
885884 'new-password' : 'newPassword' ,
885+ nickname : 'nickname' ,
886886 off : 'none' ,
887887 'one-time-code' : 'oneTimeCode' ,
888888 organization : 'organizationName' ,
@@ -959,11 +959,10 @@ TextInput.displayName = 'TextInput';
959959
960960// $FlowFixMe[prop-missing]
961961TextInput . State = {
962- currentlyFocusedInput : TextInputState . currentlyFocusedInput ,
963-
962+ blurTextInput : TextInputState . blurTextInput ,
964963 currentlyFocusedField : TextInputState . currentlyFocusedField ,
964+ currentlyFocusedInput : TextInputState . currentlyFocusedInput ,
965965 focusTextInput : TextInputState . focusTextInput ,
966- blurTextInput : TextInputState . blurTextInput ,
967966} ;
968967
969968export type TextInputComponentStatics = $ReadOnly < {
@@ -981,9 +980,9 @@ const styles = StyleSheet.create({
981980
982981const verticalAlignToTextAlignVerticalMap = {
983982 auto : 'auto' ,
984- top : 'top' ,
985983 bottom : 'bottom' ,
986984 middle : 'center' ,
985+ top : 'top' ,
987986} as const ;
988987
989988// $FlowFixMe[unclear-type] Unclear type. Using `any` type is not safe.
0 commit comments