@repliqo/sdk-react-native 0.1.1 → 0.1.2
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.
|
@@ -4,5 +4,21 @@ interface TouchTrackerProps {
|
|
|
4
4
|
screenName?: string;
|
|
5
5
|
enabled?: boolean;
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Transparent wrapper that captures touch coordinates for heatmaps
|
|
9
|
+
* WITHOUT interfering with the app's gesture/button handling.
|
|
10
|
+
*
|
|
11
|
+
* Uses `onTouchStart` (a passive event) instead of the Gesture
|
|
12
|
+
* Responder System (`onStartShouldSetResponderCapture`). This means:
|
|
13
|
+
* - Buttons, TouchableOpacity, Pressable all work normally
|
|
14
|
+
* - Navigation gestures (swipe back) are unaffected
|
|
15
|
+
* - ScrollViews scroll as expected
|
|
16
|
+
* - No responder conflicts with modals or bottom sheets
|
|
17
|
+
*
|
|
18
|
+
* Usage:
|
|
19
|
+
* <TouchTracker>
|
|
20
|
+
* <App />
|
|
21
|
+
* </TouchTracker>
|
|
22
|
+
*/
|
|
7
23
|
export declare const TouchTracker: React.FC<TouchTrackerProps>;
|
|
8
24
|
export {};
|
|
@@ -7,11 +7,26 @@ exports.TouchTracker = void 0;
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const react_native_1 = require("react-native");
|
|
9
9
|
const client_1 = require("../core/client");
|
|
10
|
+
/**
|
|
11
|
+
* Transparent wrapper that captures touch coordinates for heatmaps
|
|
12
|
+
* WITHOUT interfering with the app's gesture/button handling.
|
|
13
|
+
*
|
|
14
|
+
* Uses `onTouchStart` (a passive event) instead of the Gesture
|
|
15
|
+
* Responder System (`onStartShouldSetResponderCapture`). This means:
|
|
16
|
+
* - Buttons, TouchableOpacity, Pressable all work normally
|
|
17
|
+
* - Navigation gestures (swipe back) are unaffected
|
|
18
|
+
* - ScrollViews scroll as expected
|
|
19
|
+
* - No responder conflicts with modals or bottom sheets
|
|
20
|
+
*
|
|
21
|
+
* Usage:
|
|
22
|
+
* <TouchTracker>
|
|
23
|
+
* <App />
|
|
24
|
+
* </TouchTracker>
|
|
25
|
+
*/
|
|
10
26
|
const TouchTracker = ({ children, screenName, enabled = true, }) => {
|
|
11
|
-
const
|
|
12
|
-
if (!enabled)
|
|
13
|
-
return
|
|
14
|
-
}
|
|
27
|
+
const handleTouch = react_1.default.useCallback((event) => {
|
|
28
|
+
if (!enabled)
|
|
29
|
+
return;
|
|
15
30
|
try {
|
|
16
31
|
const analytics = client_1.AppAnalytics.getInstance();
|
|
17
32
|
const { pageX, pageY } = event.nativeEvent;
|
|
@@ -20,10 +35,8 @@ const TouchTracker = ({ children, screenName, enabled = true, }) => {
|
|
|
20
35
|
catch {
|
|
21
36
|
// AppAnalytics not initialized, silently ignore
|
|
22
37
|
}
|
|
23
|
-
// Return false so touches pass through to children
|
|
24
|
-
return false;
|
|
25
38
|
}, [enabled, screenName]);
|
|
26
|
-
return (<react_native_1.View style={{ flex: 1 }}
|
|
39
|
+
return (<react_native_1.View style={{ flex: 1 }} onTouchStart={handleTouch} pointerEvents="box-none">
|
|
27
40
|
{children}
|
|
28
41
|
</react_native_1.View>);
|
|
29
42
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@repliqo/sdk-react-native",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Session replay & analytics SDK for React Native. Captures screenshots (including modals/alerts), navigation, screen visits, and custom events.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { View, GestureResponderEvent } from 'react-native';
|
|
2
|
+
import { View, type GestureResponderEvent } from 'react-native';
|
|
3
3
|
import { AppAnalytics } from '../core/client';
|
|
4
4
|
|
|
5
5
|
interface TouchTrackerProps {
|
|
@@ -8,16 +8,30 @@ interface TouchTrackerProps {
|
|
|
8
8
|
enabled?: boolean;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Transparent wrapper that captures touch coordinates for heatmaps
|
|
13
|
+
* WITHOUT interfering with the app's gesture/button handling.
|
|
14
|
+
*
|
|
15
|
+
* Uses `onTouchStart` (a passive event) instead of the Gesture
|
|
16
|
+
* Responder System (`onStartShouldSetResponderCapture`). This means:
|
|
17
|
+
* - Buttons, TouchableOpacity, Pressable all work normally
|
|
18
|
+
* - Navigation gestures (swipe back) are unaffected
|
|
19
|
+
* - ScrollViews scroll as expected
|
|
20
|
+
* - No responder conflicts with modals or bottom sheets
|
|
21
|
+
*
|
|
22
|
+
* Usage:
|
|
23
|
+
* <TouchTracker>
|
|
24
|
+
* <App />
|
|
25
|
+
* </TouchTracker>
|
|
26
|
+
*/
|
|
11
27
|
export const TouchTracker: React.FC<TouchTrackerProps> = ({
|
|
12
28
|
children,
|
|
13
29
|
screenName,
|
|
14
30
|
enabled = true,
|
|
15
31
|
}) => {
|
|
16
|
-
const
|
|
17
|
-
(event: GestureResponderEvent)
|
|
18
|
-
if (!enabled)
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
32
|
+
const handleTouch = React.useCallback(
|
|
33
|
+
(event: GestureResponderEvent) => {
|
|
34
|
+
if (!enabled) return;
|
|
21
35
|
|
|
22
36
|
try {
|
|
23
37
|
const analytics = AppAnalytics.getInstance();
|
|
@@ -26,9 +40,6 @@ export const TouchTracker: React.FC<TouchTrackerProps> = ({
|
|
|
26
40
|
} catch {
|
|
27
41
|
// AppAnalytics not initialized, silently ignore
|
|
28
42
|
}
|
|
29
|
-
|
|
30
|
-
// Return false so touches pass through to children
|
|
31
|
-
return false;
|
|
32
43
|
},
|
|
33
44
|
[enabled, screenName],
|
|
34
45
|
);
|
|
@@ -36,7 +47,8 @@ export const TouchTracker: React.FC<TouchTrackerProps> = ({
|
|
|
36
47
|
return (
|
|
37
48
|
<View
|
|
38
49
|
style={{ flex: 1 }}
|
|
39
|
-
|
|
50
|
+
onTouchStart={handleTouch}
|
|
51
|
+
pointerEvents="box-none"
|
|
40
52
|
>
|
|
41
53
|
{children}
|
|
42
54
|
</View>
|