Skip to content

Commit

Permalink
Update NavigationContainer setup documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
xgouchet committed Apr 23, 2021
1 parent 66dce94 commit 5f32cbe
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,21 @@ DdSdkReactNative.initialize(config)
To track changes in navigation as RUM Views, you need to set the `onready` callback of your `NavigationContainer` component, as follow:

```js
import * as React from 'react';
import { DdRumReactNavigationTracking } from 'dd-sdk-reactnative';

//

<NavigationContainer ref={navigationRef} onReady={() => {
DdRumReactNavigationTracking.startTrackingViews(navigationRef.current)
}}>
//
</NavigationContainer>
function App() {
const navigationRef = React.useRef(null);
return (
<View>
<NavigationContainer ref={navigationRef} onReady={() => {
DdRumReactNavigationTracking.startTrackingViews(navigationRef.current)
}}>
//
</NavigationContainer>
</View>
);
}
```
**Note**: Only one `NavigationContainer` can be tracked at the time. If you need to track another container, stop tracking previous one first.

Expand Down

0 comments on commit 5f32cbe

Please sign in to comment.