File tree Expand file tree Collapse file tree 3 files changed +40
-1
lines changed Expand file tree Collapse file tree 3 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ The following props are applicable for the component along with **props supporte
37
37
| inputCellLength | number | Yes | 1 | Number of character that can be entered inside a single cell. |
38
38
| containerStyle | object | Yes | {} | style for overall container. |
39
39
| textInputStyle | object | Yes | {} | style for text input. |
40
+ | testIDPrefix | string | Yes | 'otp_input_ ' | testID prefix, the result will be ` otp_input_0 ` until inputCount |
40
41
41
42
#### Helper Functions
42
43
Original file line number Diff line number Diff line change @@ -157,6 +157,7 @@ class OTPTextView extends Component {
157
157
containerStyle,
158
158
textInputStyle,
159
159
keyboardType,
160
+ testIDPrefix,
160
161
...textInputProps
161
162
} = this . props ;
162
163
@@ -192,6 +193,7 @@ class OTPTextView extends Component {
192
193
multiline = { false }
193
194
onKeyPress = { ( e ) => this . onKeyPress ( e , i ) }
194
195
{ ...textInputProps }
196
+ testID = { `${ testIDPrefix } ${ i } ` }
195
197
/>
196
198
) ;
197
199
}
@@ -211,6 +213,7 @@ OTPTextView.propTypes = {
211
213
handleTextChange : PropTypes . func ,
212
214
inputType : PropTypes . string ,
213
215
keyboardType : PropTypes . string ,
216
+ testIDPrefix : PropTypes . string ,
214
217
} ;
215
218
216
219
OTPTextView . defaultProps = {
@@ -222,7 +225,8 @@ OTPTextView.defaultProps = {
222
225
containerStyle : { } ,
223
226
textInputStyle : { } ,
224
227
handleTextChange : ( ) => { } ,
225
- keyboardType : "numeric" ,
228
+ testIDPrefix : "otp_input_" ,
229
+
226
230
} ;
227
231
228
232
export default OTPTextView ;
Original file line number Diff line number Diff line change
1
+ # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
+ # yarn lockfile v1
3
+
4
+
5
+ " js-tokens@^3.0.0 || ^4.0.0 " :
6
+ version "4.0.0"
7
+ resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
8
+ integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==
9
+
10
+ loose-envify@^1.4.0 :
11
+ version "1.4.0"
12
+ resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf"
13
+ integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==
14
+ dependencies :
15
+ js-tokens "^3.0.0 || ^4.0.0"
16
+
17
+ object-assign@^4.1.1 :
18
+ version "4.1.1"
19
+ resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
20
+ integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==
21
+
22
+ prop-types@^15.6.2 :
23
+ version "15.8.1"
24
+ resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5"
25
+ integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==
26
+ dependencies :
27
+ loose-envify "^1.4.0"
28
+ object-assign "^4.1.1"
29
+ react-is "^16.13.1"
30
+
31
+ react-is@^16.13.1 :
32
+ version "16.13.1"
33
+ resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
34
+ integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==
You can’t perform that action at this time.
0 commit comments