@@ -2,6 +2,7 @@ import React from "react";
22import {
33 StyleProp ,
44 ViewStyle ,
5+ TextStyle ,
56 TextInput as NativeTextInput ,
67 View ,
78 StyleSheet ,
@@ -29,14 +30,10 @@ interface PinInputProps extends TextInputProps {
2930 blurOnFull ?: boolean ;
3031 renderItem ?: ( { cellValue, index, isFocused } : CellItem ) => JSX . Element ;
3132 focusedBorderColor ?: string ;
32- unFocusedBorderColor ?: string ;
3333 focusedBackgroundColor ?: string ;
34- unFocusedBackgroundColor ?: string ;
3534 focusedBorderWidth ?: number ;
36- unFocusedBorderWidth ?: number ;
3735 focusedTextColor ?: string ;
38- unFocusedTextColor ?: string ;
39- style ?: StyleProp < ViewStyle > ;
36+ style ?: StyleProp < ViewStyle | TextStyle > ;
4037 theme : Theme ;
4138}
4239
@@ -51,14 +48,10 @@ const PinInput = React.forwardRef<NativeTextInput, PinInputProps>(
5148 renderItem,
5249 value,
5350 onChangeText,
54- focusedBorderColor = theme . colors . primary ,
55- unFocusedBorderColor = theme . colors . disabled ,
51+ focusedBorderColor,
5652 focusedBackgroundColor,
57- unFocusedBackgroundColor,
58- focusedBorderWidth = 2 ,
59- unFocusedBorderWidth = 1 ,
60- focusedTextColor = theme . colors . strong ,
61- unFocusedTextColor = focusedTextColor ,
53+ focusedBorderWidth,
54+ focusedTextColor,
6255 style,
6356 ...rest
6457 } ,
@@ -109,27 +102,27 @@ const PinInput = React.forwardRef<NativeTextInput, PinInputProps>(
109102 testID = "default-code-input-cell"
110103 style = { [
111104 styles . cell ,
112- {
113- borderWidth : isFocused
114- ? focusedBorderWidth
115- : unFocusedBorderWidth ,
116- borderColor : isFocused
117- ? focusedBorderColor
118- : unFocusedBorderColor ,
119- backgroundColor : isFocused
120- ? focusedBackgroundColor
121- : unFocusedBackgroundColor ,
122- } ,
105+ { borderColor : theme . colors . disabled } ,
123106 viewStyles ,
107+ isFocused && focusedBorderWidth
108+ ? { borderWidth : focusedBorderWidth }
109+ : undefined ,
110+ isFocused && focusedBorderColor
111+ ? { borderColor : focusedBorderColor }
112+ : undefined ,
113+ isFocused && focusedBackgroundColor
114+ ? { backgroundColor : focusedBackgroundColor }
115+ : undefined ,
124116 ] }
125117 >
126118 < PinInputText
127119 style = { [
128120 styles . cellText ,
129- {
130- color : isFocused ? focusedTextColor : unFocusedTextColor ,
131- } ,
121+ { color : theme . colors . strong } ,
132122 textStyles ,
123+ isFocused && focusedTextColor
124+ ? { color : focusedTextColor }
125+ : undefined ,
133126 ] }
134127 isFocused = { isFocused }
135128 >
@@ -156,6 +149,7 @@ const styles = StyleSheet.create({
156149 aspectRatio : 1 ,
157150 maxWidth : 70 ,
158151 maxHeight : 70 ,
152+ borderWidth : 1 ,
159153 } ,
160154 cellText : {
161155 fontSize : 25 ,
0 commit comments