Skip to content

Commit fc7e131

Browse files
tweaks for README.md
1 parent 201d182 commit fc7e131

File tree

1 file changed

+9
-7
lines changed
  • plugins/node/instrumentation-react-native-navigation

1 file changed

+9
-7
lines changed

plugins/node/instrumentation-react-native-navigation/README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ This package is designed to streamline your workflow by requiring minimal setup.
2323

2424
### Expo Router / React Native Navigation
2525

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.
2727

2828
```javascript
2929
import {FC, useMemo} from 'react';
@@ -64,7 +64,7 @@ const App: FC = () => {
6464
export default App;
6565
```
6666

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).
6868

6969
```javascript
7070
import {FC, useMemo} from 'react';
@@ -105,7 +105,7 @@ const App: FC = () => {
105105
export default App;
106106
```
107107

108-
### Wix React Native Navigation
108+
### React Native Navigation from Wix
109109

110110
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.
111111

@@ -134,11 +134,13 @@ Navigation.events().registerAppLaunchedListener(async () => {
134134
});
135135

136136
const HomeScreen: FC = () => {
137-
const navigationRef = 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+
const navigationRef = useRef(Navigation.events());
138139

139-
const provider = 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)
140141
// If your choice is not to pass any custom tracer provider, the <NavigationTracker /> component will use the global one.
141142
// In both cases you have to make sure a tracer provider is registered BEFORE you attempt to record the first span.
143+
const provider = useProvider();
142144

143145
const config = useMemo(() => ({
144146
tracerOptions: {
@@ -200,9 +202,9 @@ For instance, when the application starts and the user navigates to a new sectio
200202
201203
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).
202204
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.
204206
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.
206208
207209
### Note
208210

0 commit comments

Comments
 (0)