Screen Loading

Minimum Required SDK Version

Screen Loading measures how long each screen takes to become interactive (TTID) and, optionally, fully loaded (TTFL). It supports an automatic flow that hooks into your navigator and a manual flow for custom or data-driven screens.

Enabling the feature

Make sure the SDK is initialized and use the below API to enable screen loading for your React Native app

import { APM } from '@luciq/react-native';

APM.setScreenLoadingEnabled(true);

Automatic (React Navigation v6)

Tracks every navigation transition without per-screen code.

Create a NavigationContainerRef and wire both the listener and onStateChange:

import { NavigationContainer, useNavigationContainerRef } from '@react-navigation/native';
import Luciq from '@luciq/react-native';

export default function App() {
  const navigationRef = useNavigationContainerRef();

  useEffect(() => {
    Luciq.setNavigationListener(navigationRef);
  }, [navigationRef]);

  return (
    <NavigationContainer ref={navigationRef} onStateChange={Luciq.onStateChange}>
      {/* ... */}
    </NavigationContainer>
  );
}
  • setNavigationListener starts the span on navigation dispatch.

  • onStateChange ends the span when the new route is committed.

Excluding Routes

To opt specific screens out of automatic measurement:

Manual Approach (Component wrapper LuciqCaptureScreenLoading)

Use this when you do not use a supported navigator, render screens conditionally, or need a precise "screen is ready" signal that includes async data.

  • The span starts at component construction and ends after first layout (TTID).

  • Pass record={false} to skip measurement on a specific render. Nested wrappers are auto-ignored.

Extend the active trace until data is ready (TTFL)

APM.endScreenLoading() requires an active UI trace from either the automatic or manual approach running on the current screen. Call it once when the content is meaningfully visible to the user.


Disabling/Enabling Screen Loading

Last updated