You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: plugins/node/instrumentation-react-native-navigation/README.md
+9-7Lines changed: 9 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ This package is designed to streamline your workflow by requiring minimal setup.
23
23
24
24
### Expo Router / React Native Navigation
25
25
26
-
If you are using `expo-router` or `react-native/navigation` you need to wrap your entire application with the `NavigationTracker` component.
26
+
If you are using `expo-router` or `@react-navigation/native` you need to wrap your entire application with the `NavigationTracker` component.
27
27
28
28
```javascript
29
29
import {FC, useMemo} from'react';
@@ -64,7 +64,7 @@ const App: FC = () => {
64
64
exportdefaultApp;
65
65
```
66
66
67
-
If you are using the `useNavigationContainerRef()` from the `@react-navigation/native` package please make sure you wrap what it returns into the proper shape of a reference (i.e `{ current: { <useNavigationContainerRef value> } }`), otherwise it won't work as expected and you will see the mentioned console.warn message insted (in case `debug` mode is enabled).
67
+
If you are using the `useNavigationContainerRef()` from the `@react-navigation/native` package please make sure you wrap what it returns into the proper shape of a reference (i.e `{ current: <useNavigationContainerRef value> }`), otherwise it won't work as expected and you will see the mentioned console.warn message instead (in case `debug` mode is enabled).
68
68
69
69
```javascript
70
70
import {FC, useMemo} from'react';
@@ -105,7 +105,7 @@ const App: FC = () => {
105
105
exportdefaultApp;
106
106
```
107
107
108
-
### Wix React Native Navigation
108
+
### React Native Navigation from Wix
109
109
110
110
If you are using `wix/react-native-navigation` you are also able to track navigation changes by importing and implement the `NativeNavigationTracker` component. The purpose in here is to wrap the entire application with the exposed component.
constnavigationRef=useRef(Navigation.events()); // this is the important part. Make sure you pass a reference with the return of Navigation.events();
137
+
// important: make sure you pass a reference with the return of Navigation.events();
138
+
constnavigationRef=useRef(Navigation.events());
138
139
139
-
constprovider=useProvider(); // again, the provider should be passed down into the `NativeNavigationTracker` with the selected exporter and processor configured (this hook is not part of the package, it is just used here as a reference)
140
+
// again, the provider should be passed down into the `NativeNavigationTracker` with the selected exporter and processor configured (this hook is not part of the package, it is just used here as a reference)
140
141
// If your choice is not to pass any custom tracer provider, the <NavigationTracker /> component will use the global one.
141
142
// In both cases you have to make sure a tracer provider is registered BEFORE you attempt to record the first span.
143
+
constprovider=useProvider();
142
144
143
145
constconfig=useMemo(() => ({
144
146
tracerOptions: {
@@ -200,9 +202,9 @@ For instance, when the application starts and the user navigates to a new sectio
200
202
201
203
If you dig into the attributes, `view.launch` refers to the moment the app is launched. It will be `true` only the first time the app mounts. Changing the status between background/foreground won't modify this attribute. For this case the `view.state.end` is used, and it can contain two possible values for Android: `active` and `background`, and a third one can be found for iOS: `inactive` (for more information about this you can visit the official [React Native - App States](https://reactnative.dev/docs/appstate#app-states) documentation).
202
204
203
-
Both components (<NavigationTracker /> and <NativeNavigationTracker />) are built on top of third-party libraries and function according to the respective APIs exposed by those libraries.
205
+
Both components (`<NavigationTracker />` and `<NativeNavigationTracker />`) are built on top of third-party libraries and function according to the respective APIs exposed by those libraries.
204
206
205
-
As mentioned before, <NavigationTracker /> relies on `@react-native/navigation` and `expo-router`, implementing the `state` listener to detect changes during navigation. `<NativeNavigationTracker />` leverages the capabilities of `wix/react-native-navigation`, internally implementing the `registerComponentDidAppearListener` and `registerComponentDidDisappearListener` methods provided by the library.
207
+
As mentioned before, `<NavigationTracker />` relies on `@react-navigation/native` and `expo-router`, implementing the `state` listener to detect changes during navigation. `<NativeNavigationTracker />` leverages the capabilities of `wix/react-native-navigation`, internally implementing the `registerComponentDidAppearListener` and `registerComponentDidDisappearListener` methods provided by the library.
0 commit comments