@react-native-firebase/appand@react-native-firebase/analyticsinstalled per Analytics usage (native config completed, New Architecture required from v26).- A navigation library if you want automatic screen-name wiring: React Navigation or
wix/react-native-navigation. ManuallogScreenViewcalls work without either. - Disable automatic native screen reporting in
firebase.jsonwhen you want only your manualscreen_viewevents (see Disable screenview tracking).
Example Expo Router screen: https://github.com/invertase/react-native-firebase/blob/main/test-expo/app/analytics.tsx
Standard React Native applications run inside a single Activity/ViewController, so native Firebase SDKs do not see JavaScript navigation screen changes automatically. Call logScreenView with ScreenViewParameters (screen_name, screen_class) whenever the visible route changes. It logs a screen_view event, so logEvent(getAnalytics(), 'screen_view', { screen_name, screen_class }) is equivalent. When screen_class is not set, Analytics sets a default value based on the UIViewController or Activity in focus, which is the same native class for every JavaScript screen. The firebase-js-sdk setCurrentScreen function is not exported by React Native Firebase; use logScreenView instead.
import { getAnalytics, logScreenView } from '@react-native-firebase/analytics';
async function trackAnalyticsScreen(screenName, screenClass) {
await logScreenView(getAnalytics(), {
screen_name: screenName,
screen_class: screenClass,
});
}
await trackAnalyticsScreen('ProductDetails', 'ProductDetails');The React Navigation library allows for various navigation techniques such as
Stack, Tab, Native or even custom navigation. The NavigationContainer component which the library exposes provides
access to the current navigation state when a screen changes, allowing you to use the logScreenView
method the Analytics library provides:
// codeblock-ignore: imports @react-navigation/native, a third-party package that is not a dependency of React Native Firebase
import React from 'react';
import { Text } from 'react-native';
import { getAnalytics, logScreenView } from '@react-native-firebase/analytics';
import { NavigationContainer } from '@react-navigation/native';
const App = () => {
const routeNameRef = React.useRef();
const navigationRef = React.useRef();
return (
<NavigationContainer
ref={navigationRef}
onReady={() => {
routeNameRef.current = navigationRef.current.getCurrentRoute().name;
}}
onStateChange={async () => {
const previousRouteName = routeNameRef.current;
const currentRouteName = navigationRef.current.getCurrentRoute().name;
if (previousRouteName !== currentRouteName) {
await logScreenView(getAnalytics(), {
screen_name: currentRouteName,
screen_class: currentRouteName,
});
}
routeNameRef.current = currentRouteName;
}}
>
<Text>Replace with your root navigator</Text>
</NavigationContainer>
);
};
export default App;For a full working example, view the Screen tracking for analytics documentation on the React Navigation website.
The wix/react-native-navigation provides 100% native platform navigation
for React Native apps. To manually track screens, you need to setup a componentDidAppear event listener and manually call the
logScreenView method the Analytics library provides:
// codeblock-ignore: imports react-native-navigation, a third-party package that is not a dependency of React Native Firebase
import { getAnalytics, logScreenView } from '@react-native-firebase/analytics';
import { Navigation } from 'react-native-navigation';
Navigation.events().registerComponentDidAppearListener(async ({ componentName, componentType }) => {
if (componentType === 'Component') {
await logScreenView(getAnalytics(), {
screen_name: componentName,
screen_class: componentName,
});
}
});To learn more, view the events documentation on the React Native Navigation website.

Core / App