react-native-acoustic-connect-beta 18.0.12 → 18.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Examples/SampleUI/src/RootNavigator.tsx +1 -1
- package/Examples/SampleUI/src/index.native.tsx +46 -31
- package/android/src/main/assets/ConnectAdvancedConfig.json +1 -1
- package/android/src/main/assets/TealeafAdvancedConfig.json +1 -1
- package/lib/commonjs/TLTRN.js +219 -0
- package/lib/commonjs/TLTRN.js.map +1 -0
- package/lib/commonjs/components/Connect.js +37 -30
- package/lib/commonjs/components/Connect.js.map +1 -1
- package/lib/commonjs/components/ConnectProfiler.js +45 -0
- package/lib/commonjs/components/ConnectProfiler.js.map +1 -0
- package/lib/commonjs/index.js +14 -3
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/KeyboardListener.js +110 -0
- package/lib/commonjs/utils/KeyboardListener.js.map +1 -0
- package/lib/module/TLTRN.js +214 -0
- package/lib/module/TLTRN.js.map +1 -0
- package/lib/module/components/Connect.js +37 -30
- package/lib/module/components/Connect.js.map +1 -1
- package/lib/module/components/ConnectProfiler.js +40 -0
- package/lib/module/components/ConnectProfiler.js.map +1 -0
- package/lib/module/index.js +4 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/KeyboardListener.js +105 -0
- package/lib/module/utils/KeyboardListener.js.map +1 -0
- package/lib/typescript/src/TLTRN.d.ts +47 -0
- package/lib/typescript/src/TLTRN.d.ts.map +1 -0
- package/lib/typescript/src/components/Connect.d.ts +2 -1
- package/lib/typescript/src/components/Connect.d.ts.map +1 -1
- package/lib/typescript/src/components/ConnectProfiler.d.ts +23 -0
- package/lib/typescript/src/components/ConnectProfiler.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +3 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/{jslib/components/ConnectProfiler.js → lib/typescript/src/utils/KeyboardListener.d.ts} +9 -29
- package/lib/typescript/src/utils/KeyboardListener.d.ts.map +1 -0
- package/package.json +1 -2
- package/scripts/ConnectConfig.json +1 -1
- package/{jslib/TLTRN.js → src/TLTRN.ts} +54 -39
- package/src/components/Connect.tsx +102 -86
- package/src/components/ConnectProfiler.ts +43 -0
- package/src/index.ts +4 -2
- package/src/utils/KeyboardListener.ts +113 -0
- package/jslib/utils/KeyboardListener.js +0 -100
- package/lib/typescript/jslib/TLTRN.d.ts +0 -37
- package/lib/typescript/jslib/TLTRN.d.ts.map +0 -1
- package/lib/typescript/jslib/components/ConnectProfiler.d.ts +0 -10
- package/lib/typescript/jslib/components/ConnectProfiler.d.ts.map +0 -1
- package/lib/typescript/jslib/utils/KeyboardListener.d.ts +0 -10
- package/lib/typescript/jslib/utils/KeyboardListener.d.ts.map +0 -1
|
@@ -7,104 +7,120 @@
|
|
|
7
7
|
* Acoustic, L.P. Any unauthorized copying or distribution of content from this file is
|
|
8
8
|
* prohibited.
|
|
9
9
|
********************************************************************************************/
|
|
10
|
-
import React, { useCallback, useEffect, useRef } from "react";
|
|
10
|
+
import React, { useCallback, useEffect, useRef, forwardRef } from "react";
|
|
11
11
|
import { View, StyleSheet, Platform, NativeModules, findNodeHandle } from "react-native";
|
|
12
|
-
import type { LayoutChangeEvent } from "react-native";
|
|
13
|
-
|
|
12
|
+
import type { LayoutChangeEvent } from "react-native";
|
|
13
|
+
import TLTRN from "../TLTRN";
|
|
14
14
|
|
|
15
15
|
interface ConnectProps {
|
|
16
16
|
children: React.ReactNode;
|
|
17
17
|
captureKeyboardEvents: boolean;
|
|
18
|
+
navigationRef?: React.RefObject<any>;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
const Connect
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
typeof navigation.current.addListener !== "function" ||
|
|
33
|
-
typeof navigation.current.getCurrentRoute !== "function"
|
|
34
|
-
) {
|
|
35
|
-
console.warn(
|
|
36
|
-
"Connect: The Connect component's first child must be a NavigationContainer with a ref."
|
|
37
|
-
);
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const unsubscribe = navigation.current.addListener("state", () => {
|
|
42
|
-
currentRoute.current = extractName(navigation) || navigation.current.getCurrentRoute()?.name;
|
|
43
|
-
console.log("State change - ", currentRoute.current);
|
|
44
|
-
|
|
45
|
-
if (Platform.OS === "ios" && currentRoute && currentRoute.current) {
|
|
46
|
-
// TLTRN.setCurrentScreenName(currentRoute.current);
|
|
47
|
-
} else if (Platform.OS === "android") {
|
|
48
|
-
// TLTRN.setCurrentScreenName(currentRoute.current);
|
|
49
|
-
// TLTRN.logScreenLayout(currentRoute.current);
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
return unsubscribe;
|
|
54
|
-
}, [navigation]);
|
|
55
|
-
|
|
56
|
-
const onStartShouldSetResponderCapture = useCallback((event: any) => {
|
|
57
|
-
currentRoute.current = extractName(navigation) || navigation.current.getCurrentRoute()?.name;
|
|
58
|
-
if (currentRoute && currentRoute.current) {
|
|
59
|
-
// TLTRN.setCurrentScreenName(currentRoute.current);
|
|
60
|
-
}
|
|
61
|
-
// Log the click event
|
|
62
|
-
console.log("event - ", event.nativeEvent);
|
|
63
|
-
// TLTRN.logClickEvent(event);
|
|
64
|
-
return false; // Must be false; true means this component becomes the touch responder and events don't bubble
|
|
65
|
-
}, []);
|
|
66
|
-
|
|
67
|
-
const onLayout = useCallback((event: LayoutChangeEvent) => {
|
|
68
|
-
if (initial.current) {
|
|
69
|
-
return false;
|
|
70
|
-
}
|
|
71
|
-
initial.current = true;
|
|
72
|
-
|
|
73
|
-
console.log("event - ", event.nativeEvent);
|
|
74
|
-
|
|
75
|
-
currentRoute.current = navigation.current.getCurrentRoute()?.name;
|
|
76
|
-
if (Platform.OS === "ios" && currentRoute && currentRoute.current) {
|
|
77
|
-
// TLTRN.setCurrentScreenName(currentRoute.current);
|
|
78
|
-
} else if (Platform.OS === "android") {
|
|
79
|
-
// TLTRN.logScreenLayout(currentRoute.current);
|
|
80
|
-
}
|
|
81
|
-
return true
|
|
82
|
-
}, [navigation]);
|
|
83
|
-
|
|
84
|
-
return (
|
|
85
|
-
<View
|
|
86
|
-
style={styles.connect_main}
|
|
87
|
-
onLayout={onLayout}
|
|
88
|
-
onStartShouldSetResponderCapture={onStartShouldSetResponderCapture}
|
|
89
|
-
>
|
|
90
|
-
{children}
|
|
91
|
-
</View>
|
|
92
|
-
);
|
|
93
|
-
};
|
|
21
|
+
const Connect = forwardRef<any, ConnectProps>(
|
|
22
|
+
({ children, captureKeyboardEvents, navigationRef }, ref) => {
|
|
23
|
+
const navigation = navigationRef || useRef(null);
|
|
24
|
+
|
|
25
|
+
// Handle forwarded ref
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (ref && typeof ref === "object" && ref !== null) {
|
|
28
|
+
navigation.current = ref.current;
|
|
29
|
+
} else if (typeof ref === "function") {
|
|
30
|
+
ref(navigation.current);
|
|
31
|
+
}
|
|
32
|
+
}, [ref]);
|
|
94
33
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
34
|
+
const currentRoute = useRef<string | undefined>(undefined);
|
|
35
|
+
const initial = useRef<boolean>(false);
|
|
36
|
+
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
TLTRN.interceptKeyboardEvents(captureKeyboardEvents);
|
|
39
|
+
}, [captureKeyboardEvents]);
|
|
40
|
+
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
if (
|
|
43
|
+
!navigation.current ||
|
|
44
|
+
typeof navigation.current.addListener !== "function" ||
|
|
45
|
+
typeof navigation.current.getCurrentRoute !== "function"
|
|
46
|
+
) {
|
|
47
|
+
console.warn(
|
|
48
|
+
"Connect: The Connect component's ref must be a NavigationContainer with a ref."
|
|
49
|
+
);
|
|
50
|
+
return;
|
|
100
51
|
}
|
|
101
|
-
|
|
52
|
+
|
|
53
|
+
const unsubscribe = navigation.current.addListener("state", () => {
|
|
54
|
+
currentRoute.current = extractName(navigation);
|
|
55
|
+
console.log("State change - ", currentRoute.current);
|
|
56
|
+
|
|
57
|
+
if (Platform.OS === "ios" && currentRoute.current) {
|
|
58
|
+
TLTRN.logScreenViewPageName(currentRoute.current);
|
|
59
|
+
} else if (Platform.OS === "android") {
|
|
60
|
+
TLTRN.logScreenViewPageName(currentRoute.current);
|
|
61
|
+
TLTRN.logScreenLayout(currentRoute.current);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
return unsubscribe;
|
|
66
|
+
}, [navigation]);
|
|
67
|
+
|
|
68
|
+
const onStartShouldSetResponderCapture = useCallback(
|
|
69
|
+
(event: any) => {
|
|
70
|
+
currentRoute.current = extractName(navigation);
|
|
71
|
+
if (currentRoute.current) {
|
|
72
|
+
TLTRN.logScreenViewPageName(currentRoute.current);
|
|
73
|
+
}
|
|
74
|
+
TLTRN.logClickEvent(event);
|
|
75
|
+
return false;
|
|
76
|
+
},
|
|
77
|
+
[navigation]
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
const onLayout = useCallback(
|
|
81
|
+
(event: LayoutChangeEvent) => {
|
|
82
|
+
if (initial.current) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
initial.current = true;
|
|
86
|
+
|
|
87
|
+
console.log("event - ", event.nativeEvent);
|
|
88
|
+
|
|
89
|
+
currentRoute.current = navigation.current?.getCurrentRoute()?.name;
|
|
90
|
+
if (Platform.OS === "ios" && currentRoute.current) {
|
|
91
|
+
TLTRN.logScreenViewPageName(currentRoute.current);
|
|
92
|
+
} else if (Platform.OS === "android") {
|
|
93
|
+
TLTRN.logScreenLayout(currentRoute.current);
|
|
94
|
+
}
|
|
95
|
+
return true;
|
|
96
|
+
},
|
|
97
|
+
[navigation]
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<View
|
|
102
|
+
style={styles.connect_main}
|
|
103
|
+
onLayout={onLayout}
|
|
104
|
+
onStartShouldSetResponderCapture={onStartShouldSetResponderCapture}
|
|
105
|
+
>
|
|
106
|
+
{children}
|
|
107
|
+
</View>
|
|
108
|
+
);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
function extractName(navigation: any): string {
|
|
112
|
+
const routeParams = navigation.current?.getCurrentRoute()?.params;
|
|
113
|
+
if (routeParams) {
|
|
114
|
+
const { name } = routeParams;
|
|
115
|
+
return name || "";
|
|
116
|
+
}
|
|
117
|
+
return navigation.current?.getCurrentRoute()?.name || "";
|
|
102
118
|
}
|
|
103
119
|
|
|
104
120
|
export default Connect;
|
|
105
121
|
|
|
106
122
|
const styles = StyleSheet.create({
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
123
|
+
connect_main: {
|
|
124
|
+
flex: 1,
|
|
125
|
+
},
|
|
110
126
|
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/********************************************************************************************
|
|
2
|
+
* Copyright (C) 2025 Acoustic, L.P. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* NOTICE: This file contains material that is confidential and proprietary to
|
|
5
|
+
* Acoustic, L.P. and/or other developers. No license is granted under any intellectual or
|
|
6
|
+
* industrial property rights of Acoustic, L.P. except as may be provided in an agreement with
|
|
7
|
+
* Acoustic, L.P. Any unauthorized copying or distribution of content from this file is
|
|
8
|
+
* prohibited.
|
|
9
|
+
********************************************************************************************/
|
|
10
|
+
|
|
11
|
+
import React, { Component } from "react";
|
|
12
|
+
import TLTRN from "../TLTRN";
|
|
13
|
+
|
|
14
|
+
interface ConnectProfilerProps {
|
|
15
|
+
profileName?: string; // Optional property
|
|
16
|
+
children?: React.ReactNode; // For rendering child components
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
class ConnectProfiler extends Component<ConnectProfilerProps> {
|
|
20
|
+
startTime = 0;
|
|
21
|
+
endTime = 0;
|
|
22
|
+
|
|
23
|
+
constructor(props: ConnectProfilerProps) {
|
|
24
|
+
super(props);
|
|
25
|
+
this.startTime = new Date().getTime();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
componentDidMount() {
|
|
29
|
+
this.endTime = new Date().getTime();
|
|
30
|
+
const pageLoadTime = this.endTime - this.startTime;
|
|
31
|
+
const { profileName } = this.props;
|
|
32
|
+
|
|
33
|
+
if (profileName) {
|
|
34
|
+
TLTRN.logCustomEvent("Load Time", { profileName, pageLoadTime }, 1);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
render() {
|
|
39
|
+
return this.props.children;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export default ConnectProfiler;
|
package/src/index.ts
CHANGED
|
@@ -13,9 +13,11 @@
|
|
|
13
13
|
|
|
14
14
|
import { NitroModules } from 'react-native-nitro-modules'
|
|
15
15
|
import type { AcousticConnectRN as AcousticConnectRNSpec } from './specs/react-native-acoustic-connect.nitro'
|
|
16
|
-
import Connect from './components/Connect'
|
|
16
|
+
import Connect from './components/Connect'
|
|
17
|
+
import KeyboardListener from './utils/KeyboardListener'
|
|
18
|
+
import TLTRN from './TLTRN'
|
|
17
19
|
|
|
18
20
|
const AcousticConnectRN = NitroModules.createHybridObject<AcousticConnectRNSpec>('AcousticConnectRN')
|
|
19
21
|
|
|
20
|
-
export { Connect }
|
|
22
|
+
export { Connect, TLTRN, KeyboardListener}
|
|
21
23
|
export default AcousticConnectRN
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/********************************************************************************************
|
|
2
|
+
* Copyright (C) 2025 Acoustic, L.P. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* NOTICE: This file contains material that is confidential and proprietary to
|
|
5
|
+
* Acoustic, L.P. and/or other developers. No license is granted under any intellectual or
|
|
6
|
+
* industrial property rights of Acoustic, L.P. except as may be provided in an agreement with
|
|
7
|
+
* Acoustic, L.P. Any unauthorized copying or distribution of content from this file is
|
|
8
|
+
* prohibited.
|
|
9
|
+
********************************************************************************************/
|
|
10
|
+
|
|
11
|
+
import { Keyboard, Platform, TextInput } from "react-native";
|
|
12
|
+
import TLTRN from '../TLTRN';
|
|
13
|
+
|
|
14
|
+
class KeyboardListener {
|
|
15
|
+
static TLTRN: TLTRN | null = null;
|
|
16
|
+
static listener: KeyboardListener | null = null;
|
|
17
|
+
|
|
18
|
+
static _instance(_TLTRN: TLTRN): KeyboardListener {
|
|
19
|
+
if (!KeyboardListener.listener) {
|
|
20
|
+
KeyboardListener.listener = new KeyboardListener(_TLTRN);
|
|
21
|
+
}
|
|
22
|
+
return KeyboardListener.listener;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
enabled: boolean;
|
|
26
|
+
|
|
27
|
+
constructor(_TLTRN: TLTRN) {
|
|
28
|
+
KeyboardListener.TLTRN = _TLTRN;
|
|
29
|
+
|
|
30
|
+
this.enabled = false;
|
|
31
|
+
let _x: Record<string, any> = {};
|
|
32
|
+
let _i: Record<string, any> = {};
|
|
33
|
+
|
|
34
|
+
const sanitize = (target: string, text: string): string => {
|
|
35
|
+
if (!_x[target].secureTextEntry || typeof _x[target].secureTextEntry === "undefined") {
|
|
36
|
+
return text;
|
|
37
|
+
}
|
|
38
|
+
return new Array(text.length).fill("*").join("");
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const flushData = (): void => {
|
|
42
|
+
_i = {};
|
|
43
|
+
_x = {};
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const keyListener = (evt: any, bubbledEvent: string): void => {
|
|
47
|
+
let _nativeTag = evt?.target?._nativeTag;
|
|
48
|
+
|
|
49
|
+
let valid = this.enabled && (!_i[_nativeTag] || _i[_nativeTag] === bubbledEvent);
|
|
50
|
+
if (!valid) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
_i[_nativeTag] = bubbledEvent;
|
|
55
|
+
if (!_x[_nativeTag]) {
|
|
56
|
+
_x[_nativeTag] = { text: "" };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
_x[_nativeTag].target = evt?.target?._nativeTag;
|
|
60
|
+
_x[_nativeTag].controlId = evt?._targetInst?.memoizedProps?.id;
|
|
61
|
+
_x[_nativeTag].ariaLabel = evt?._targetInst?.memoizedProps?.accessible?.accessibilityLabel;
|
|
62
|
+
_x[_nativeTag].secureTextEntry = evt?._targetInst?.memoizedProps?.secureTextEntry;
|
|
63
|
+
|
|
64
|
+
const anon = (_k: string): string => {
|
|
65
|
+
if (_k !== "Backspace" && _k.length === 1) {
|
|
66
|
+
return (_x[_nativeTag].text += sanitize(_nativeTag, _k));
|
|
67
|
+
} else if (_k !== "Backspace" && _k.length > 1) {
|
|
68
|
+
return sanitize(_nativeTag, _k);
|
|
69
|
+
} else {
|
|
70
|
+
return _x[_nativeTag].text.slice(0, -1);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
let text: string | null = null;
|
|
75
|
+
switch (bubbledEvent) {
|
|
76
|
+
case "onTextInput":
|
|
77
|
+
text = evt?.nativeEvent?.text;
|
|
78
|
+
_x[_nativeTag].text = sanitize(_nativeTag, text || "");
|
|
79
|
+
break;
|
|
80
|
+
case "onKeyPress":
|
|
81
|
+
text = evt?.nativeEvent?.key;
|
|
82
|
+
_x[_nativeTag].text = anon(text || "");
|
|
83
|
+
break;
|
|
84
|
+
case "onChange":
|
|
85
|
+
text = evt?.nativeEvent?.text;
|
|
86
|
+
_x[_nativeTag].text = sanitize(_nativeTag, text || "");
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const keyboardDidHide = async (): Promise<void> => {
|
|
92
|
+
let values = Object.values(_x);
|
|
93
|
+
for (let value of values) {
|
|
94
|
+
let { text, controlId, ariaLabel, target } = value;
|
|
95
|
+
TLTRN.logTextChangeEvent(target, controlId, text, ariaLabel);
|
|
96
|
+
}
|
|
97
|
+
flushData();
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
// @ts-ignore: Ignore TypeScript error for defaultProps
|
|
101
|
+
TextInput.defaultProps = TextInput.defaultProps || {};
|
|
102
|
+
// @ts-ignore: Ignore TypeScript error for defaultProps
|
|
103
|
+
TextInput.defaultProps.onChange = (evt: any) => keyListener(evt, "onChange");
|
|
104
|
+
|
|
105
|
+
Keyboard.addListener("keyboardDidHide", keyboardDidHide);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
interceptKeyboardEvents(enable: boolean): void {
|
|
109
|
+
this.enabled = enable;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export default KeyboardListener;
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
/********************************************************************************************
|
|
2
|
-
* Copyright (C) 2025 Acoustic, L.P. All rights reserved.
|
|
3
|
-
*
|
|
4
|
-
* NOTICE: This file contains material that is confidential and proprietary to
|
|
5
|
-
* Acoustic, L.P. and/or other developers. No license is granted under any intellectual or
|
|
6
|
-
* industrial property rights of Acoustic, L.P. except as may be provided in an agreement with
|
|
7
|
-
* Acoustic, L.P. Any unauthorized copying or distribution of content from this file is
|
|
8
|
-
* prohibited.
|
|
9
|
-
********************************************************************************************/
|
|
10
|
-
|
|
11
|
-
import { Keyboard, Platform, TextInput } from "react-native";
|
|
12
|
-
|
|
13
|
-
class KeyboardListener{
|
|
14
|
-
static TLTRN = null;
|
|
15
|
-
static listener = null;
|
|
16
|
-
|
|
17
|
-
static _instance(_TLTRN){
|
|
18
|
-
if(!KeyboardListener.listener){ KeyboardListener.listener = new KeyboardListener(_TLTRN); }
|
|
19
|
-
return KeyboardListener.listener;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
constructor(_TLTRN) {
|
|
23
|
-
KeyboardListener.TLTRN = _TLTRN;
|
|
24
|
-
|
|
25
|
-
this.enabled = false;
|
|
26
|
-
let _x = {};
|
|
27
|
-
let _i = {};
|
|
28
|
-
|
|
29
|
-
const sanitize = (target, text) => {
|
|
30
|
-
if(!_x[target].secureTextEntry || typeof _x[target].secureTextEntry === 'undefined'){ return text; }
|
|
31
|
-
return new Array(text.length).fill('*').join('');
|
|
32
|
-
};
|
|
33
|
-
const flushData = () => {
|
|
34
|
-
_i = {};
|
|
35
|
-
_x = {};
|
|
36
|
-
};
|
|
37
|
-
const keyListener = (evt, bubbledEvent) => {
|
|
38
|
-
let _nativeTag = evt?.target?._nativeTag;
|
|
39
|
-
|
|
40
|
-
let valid = this.enabled && (!_i[_nativeTag] || _i[_nativeTag] === bubbledEvent);
|
|
41
|
-
if(!valid){ return false; }
|
|
42
|
-
|
|
43
|
-
// console.log('parent keyListener evt', evt);
|
|
44
|
-
// console.log('parent keyListener evt?._targetInst?.secureTextEntry', evt?._targetInst?.memoizedProps?.secureTextEntry);
|
|
45
|
-
|
|
46
|
-
_i[_nativeTag] = bubbledEvent;
|
|
47
|
-
if(!_x[_nativeTag]){ _x[_nativeTag] = { text: '' }; }
|
|
48
|
-
|
|
49
|
-
_x[_nativeTag].target = evt?.target?._nativeTag;
|
|
50
|
-
_x[_nativeTag].controlId = evt?._targetInst?.memoizedProps?.id;
|
|
51
|
-
_x[_nativeTag].ariaLabel = evt?._targetInst?.memoizedProps?.accessible?.accessibilityLabel;
|
|
52
|
-
_x[_nativeTag].secureTextEntry = evt?._targetInst?.memoizedProps?.secureTextEntry;
|
|
53
|
-
|
|
54
|
-
let anon = _k => {
|
|
55
|
-
if(_k !== 'Backspace' && _k.length === 1){ return _x[_nativeTag].text += sanitize(_nativeTag, _k); }
|
|
56
|
-
else if(_k !== 'Backspace' && _k.length > 1){ return sanitize(_nativeTag, _k); }
|
|
57
|
-
else { return _x[_nativeTag].text.slice(0, -1); }
|
|
58
|
-
};
|
|
59
|
-
let text = null;
|
|
60
|
-
switch(bubbledEvent){
|
|
61
|
-
case 'onTextInput':
|
|
62
|
-
text = evt?.nativeEvent?.text;
|
|
63
|
-
if(_k !== 'Backspace' && _k.length === 1){ _x[_nativeTag] = _x[_nativeTag].text += sanitize(_nativeTag, _k); }
|
|
64
|
-
else if(_k !== 'Backspace' && _k.length > 1){ _x[_nativeTag].text = sanitize(_nativeTag, _k); }
|
|
65
|
-
else { _x[_nativeTag].text = _x[_nativeTag].text.slice(0, -1); }
|
|
66
|
-
|
|
67
|
-
break;
|
|
68
|
-
case 'onKeyPress':
|
|
69
|
-
text = evt?.nativeEvent?.key;
|
|
70
|
-
_x[_nativeTag].text = anon(text);
|
|
71
|
-
break;
|
|
72
|
-
case 'onChange':
|
|
73
|
-
text = evt?.nativeEvent?.text;
|
|
74
|
-
_x[_nativeTag].text = sanitize(_nativeTag, text);
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
const keyboardDidHide = async () => {
|
|
80
|
-
let values = Object.values(_x);
|
|
81
|
-
for (let value of values) {
|
|
82
|
-
let {text, controlId, ariaLabel, target} = value;
|
|
83
|
-
await KeyboardListener.TLTRN.logTextChangeEvent(target, controlId, text, ariaLabel);
|
|
84
|
-
}
|
|
85
|
-
flushData();
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
TextInput.defaultProps = TextInput.defaultProps || {};
|
|
89
|
-
|
|
90
|
-
// Shotgun approach; if any of these listeners are set on the component the event doesn't bubble up
|
|
91
|
-
// TextInput.defaultProps.onKeyPress = evt => keyListener(evt, 'onKeyPress');
|
|
92
|
-
TextInput.defaultProps.onChange = evt => keyListener(evt, 'onChange');
|
|
93
|
-
// TextInput.defaultProps.onTextInput = evt => keyListener(evt, 'onTextInput');
|
|
94
|
-
|
|
95
|
-
Keyboard.addListener('keyboardDidHide', keyboardDidHide);
|
|
96
|
-
}
|
|
97
|
-
interceptKeyboardEvents(enable){ this.enabled = enable; }
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export default KeyboardListener;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export default TLTRN;
|
|
2
|
-
declare class TLTRN {
|
|
3
|
-
static currentScreen: string;
|
|
4
|
-
static lastJSBridgeMessageTime: number;
|
|
5
|
-
static totalRenderTime: number;
|
|
6
|
-
static messageRenderTime: number;
|
|
7
|
-
static countMsgs: number;
|
|
8
|
-
static messageConsole: number;
|
|
9
|
-
static lastMessageConsole: number;
|
|
10
|
-
static isLoggingData: number;
|
|
11
|
-
static displayDebug: number;
|
|
12
|
-
static myTimer: {
|
|
13
|
-
handle: number;
|
|
14
|
-
started: number;
|
|
15
|
-
time: number;
|
|
16
|
-
/**
|
|
17
|
-
* @type Class
|
|
18
|
-
*/
|
|
19
|
-
startTimer: Class;
|
|
20
|
-
/**
|
|
21
|
-
* @type Class
|
|
22
|
-
*/
|
|
23
|
-
stopTimer: Class;
|
|
24
|
-
};
|
|
25
|
-
static init: (initialCurrentScreen: any, showDebugConsoleMessages: any) => void;
|
|
26
|
-
static interceptKeyboardEvents: (enable: any) => void;
|
|
27
|
-
static logScreenViewPageName: (name: any) => boolean | undefined;
|
|
28
|
-
static logScreenViewContextLoad: (name: any, prevName: any) => boolean | undefined;
|
|
29
|
-
static logScreenLayout: (name: any) => boolean | undefined;
|
|
30
|
-
static logClickEvent: (event: any) => Promise<boolean | undefined>;
|
|
31
|
-
static logTextChangeEvent: (target: any, controlId: any, text: any, ariaLabel: any) => Promise<void>;
|
|
32
|
-
static logCustomEvent: (eventName: any, values: any, level: any) => Promise<boolean | undefined>;
|
|
33
|
-
static listenToBridge: (message: any) => void;
|
|
34
|
-
static checkTime: () => void;
|
|
35
|
-
static logTeal: () => Promise<void>;
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=TLTRN.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TLTRN.d.ts","sourceRoot":"","sources":["../../../jslib/TLTRN.js"],"names":[],"mappings":";AAuBA;IACE,6BACoE;IACpE,uCAAmC;IACnC,+BAA2B;IAC3B,iCAA6B;IAC7B,yBAAqB;IACrB,8BAA0B;IAC1B,kCAA8B;IAC9B,6BAAyB;IACzB,4BAAwB;IAExB;;;;QAIE;;WAEG;;QAKH;;WAEG;;MAQH;IAEF,gFAQE;IAEF,sDAEE;IAEF,iEAME;IAEF,mFAME;IAEF,2DAOE;IAEF,mEAqBE;IAEF,qGAUE;IAEF,iGAME;IAEF,8CAiEE;IAEF,6BA6BE;IAEF,oCAsBE;CACH"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export default ConnectProfiler;
|
|
2
|
-
declare class ConnectProfiler extends React.Component<any, any, any> {
|
|
3
|
-
constructor(props: any);
|
|
4
|
-
startTime: number;
|
|
5
|
-
endTime: number;
|
|
6
|
-
componentDidMount(): void;
|
|
7
|
-
render(): any;
|
|
8
|
-
}
|
|
9
|
-
import React from "react";
|
|
10
|
-
//# sourceMappingURL=ConnectProfiler.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectProfiler.d.ts","sourceRoot":"","sources":["../../../../jslib/components/ConnectProfiler.js"],"names":[],"mappings":";AAcA;IAIE,wBAIC;IAPD,kBAAa;IACb,gBAAW;IAQX,0BAQC;IAED,cAEC;CACF;kBA3B8B,OAAO"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export default KeyboardListener;
|
|
2
|
-
declare class KeyboardListener {
|
|
3
|
-
static TLTRN: null;
|
|
4
|
-
static listener: null;
|
|
5
|
-
static _instance(_TLTRN: any): null;
|
|
6
|
-
constructor(_TLTRN: any);
|
|
7
|
-
enabled: boolean;
|
|
8
|
-
interceptKeyboardEvents(enable: any): void;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=KeyboardListener.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"KeyboardListener.d.ts","sourceRoot":"","sources":["../../../../jslib/utils/KeyboardListener.js"],"names":[],"mappings":";AAYA;IACI,mBAAoB;IACpB,sBAAuB;IAEvB,oCAGC;IAED,yBA0EC;IAvEG,iBAAoB;IAwExB,2CAAyD;CAC5D"}
|