From 5f32cbeaf047f2653f7e7680dae7ba940ff0927b Mon Sep 17 00:00:00 2001 From: Xavier Gouchet Date: Fri, 23 Apr 2021 17:02:36 +0200 Subject: [PATCH] Update NavigationContainer setup documentation --- README.md | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 9710b0d8c..0da9fe9f6 100644 --- a/README.md +++ b/README.md @@ -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'; -// … - - { - DdRumReactNavigationTracking.startTrackingViews(navigationRef.current) - }}> - // … - +function App() { + const navigationRef = React.useRef(null); + return ( + + { + DdRumReactNavigationTracking.startTrackingViews(navigationRef.current) + }}> + // … + + + ); +} ``` **Note**: Only one `NavigationContainer` can be tracked at the time. If you need to track another container, stop tracking previous one first.