1
1
import * as React from 'react' ;
2
2
import { StyleSheet , SafeAreaView , TextInput } from 'react-native' ;
3
- import { buildEventLogger } from '../utils/helpers' ;
3
+ import { buildEventLogger , logEvent } from '../utils/helpers' ;
4
4
5
5
const handlePressIn = buildEventLogger ( 'pressIn' ) ;
6
6
const handlePressOut = buildEventLogger ( 'pressOut' ) ;
7
7
const handleFocus = buildEventLogger ( 'focus' ) ;
8
8
const handleBlur = buildEventLogger ( 'blur' ) ;
9
9
const handleChange = buildEventLogger ( 'change' ) ;
10
10
const handleSubmitEditing = buildEventLogger ( 'submitEditing' ) ;
11
+ const handleKeyPress = buildEventLogger ( 'keyPress' ) ;
12
+ const handleTextInput = buildEventLogger ( 'textInput' ) ;
13
+ const handleSelectionChange = buildEventLogger ( 'selectionChange' ) ;
11
14
12
15
export function TextInputEvents ( ) {
13
16
const [ value , setValue ] = React . useState ( '' ) ;
14
17
15
18
const handleChangeText = ( value : string ) => {
16
19
setValue ( value ) ;
17
- console . log ( `Event: changeText` , value ) ;
20
+ logEvent ( ' changeText' , value ) ;
18
21
} ;
19
22
20
23
return (
@@ -30,6 +33,9 @@ export function TextInputEvents() {
30
33
onBlur = { handleBlur }
31
34
onChange = { handleChange }
32
35
onSubmitEditing = { handleSubmitEditing }
36
+ onSelectionChange = { handleSelectionChange }
37
+ onKeyPress = { handleKeyPress }
38
+ onTextInput = { handleTextInput }
33
39
/>
34
40
</ SafeAreaView >
35
41
) ;
0 commit comments