plotline-engage 5.1.2 → 5.1.3
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/index.js +15 -3
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -268,11 +268,12 @@ const PlotlineWidget = ({ testID }) => {
|
|
|
268
268
|
return null;
|
|
269
269
|
};
|
|
270
270
|
|
|
271
|
-
const NavigationContainer = forwardRef(({children, ...others}, ref) => {
|
|
271
|
+
const NavigationContainer = forwardRef(({ children, ...others }, ref) => {
|
|
272
272
|
const containerRef = useNavigationContainerRef()
|
|
273
|
+
const navigationRef = ref || containerRef
|
|
273
274
|
|
|
274
275
|
useEffect(() => {
|
|
275
|
-
if (containerRef.current) {
|
|
276
|
+
if (containerRef.current && !others?.linking) {
|
|
276
277
|
const currentRoute = containerRef.current.getCurrentRoute()
|
|
277
278
|
if (currentRoute) {
|
|
278
279
|
Plotline.trackPage(currentRoute.name);
|
|
@@ -287,16 +288,27 @@ const NavigationContainer = forwardRef(({children, ...others}, ref) => {
|
|
|
287
288
|
const routeName = getRouteName(state)
|
|
288
289
|
Plotline.trackPage(routeName);
|
|
289
290
|
}
|
|
291
|
+
const handleReady = () => {
|
|
292
|
+
const currentRoute = navigationRef.current?.getCurrentRoute();
|
|
293
|
+
if (currentRoute && others?.linking) {
|
|
294
|
+
Plotline.trackPage(currentRoute.name);
|
|
295
|
+
initialRouteName = currentRoute.name
|
|
296
|
+
}
|
|
297
|
+
if (others?.onReady) {
|
|
298
|
+
others.onReady();
|
|
299
|
+
}
|
|
300
|
+
};
|
|
290
301
|
|
|
291
302
|
return (
|
|
292
303
|
<RNNavigationContainer
|
|
293
304
|
{...others}
|
|
294
|
-
onStateChange={handleStateChange}
|
|
305
|
+
onStateChange={handleStateChange}
|
|
295
306
|
ref={(node) => {
|
|
296
307
|
containerRef.current = node;
|
|
297
308
|
if (typeof ref === 'function') ref(node);
|
|
298
309
|
else if (ref) ref.current = node;
|
|
299
310
|
}}
|
|
311
|
+
onReady={handleReady}
|
|
300
312
|
>
|
|
301
313
|
{children}
|
|
302
314
|
</RNNavigationContainer>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "plotline-engage",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.3",
|
|
4
4
|
"description": "React Native plugin for Plotline",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"react-native": ">= 0.41.2"
|
|
22
22
|
}
|
|
23
|
-
}
|
|
23
|
+
}
|