React Native Tracker API Reference
High level overview of all the APIs available in the React Native Tracker.
Tracked Components
These Components are automatically wrapped in an appropriate LocationWrapper and automate event Tracking whenever possible.
- TrackedActivityIndicator
- TrackedButton
- TrackedFlatList
- TrackedKeyboardAvoidingView
- TrackedModal
- TrackedPressable
- TrackedSafeAreaView
- TrackedScrollView
- TrackedSectionList
- TrackedSwitch
- TrackedText
- TrackedTextInput
- TrackedTouchableHighlight
- TrackedTouchableNativeFeedback
- TrackedTouchableOpacity
- TrackedTouchableWithoutFeedback
- TrackedView
- TrackedVirtualizedList
Location Wrappers
These Components wrap their children in a Context.Provider. This allows the ReactNativeTracker to reconstruct their Location in the UI.
tip
The combination of Location Wrappers and Low-level Event Trackers is how we build Tracked Components.
Take a loot at this how to build your own Custom Tracked Components guide for more info.
Higher-level
- ContentContextWrapper
- ExpandableContextWrapper
- InputContextWrapper
- LinkContextWrapper
- MediaPlayerContextWrapper
- NavigationContextWrapper
- OverlayContextWrapper
- PressableContextWrapper
- RootLocationContextWrapper
Low-level
Hooks
A range of hooks that we use for most of the tracking. All hooks are stable and perform deep comparisons on their deps.
Event trackers
These hooks can be used to obtain ready-to-trigger callbacks for all Events.
danger
Be careful when using LocationWrappers and Event Tracking hooks in the same Component. Calling a hook-generated event tracking callback in the JSX of the same Component will not produce a valid Location Stack.
Take a loot at this how to build your own Custom Tracked Components guide for more info.
- useApplicationLoadedEventTracker
- useFailureEventTracker
- useHiddenEventTracker
- useInputChangeEventTracker
- useMediaLoadEventTracker
- useMediaPauseEventTracker
- useMediaStartEventTracker
- useMediaStopEventTracker
- usePressEventTracker
- useSuccessEventTracker
- useVisibilityTracker
- useVisibleEventTracker
Consumers
React Context consumers meant to retrieve either an entire Context or part of it.
The hooks the SDK uses internally for event instrumentation are also available publicly.
Lifecycle
- useOnMount
- useOnMountOnce
- useOnUnmount
- useOnUnmountOnce
- useTrackOnMount
- useTrackOnMountOnce
- useTrackOnUnmount
- useTrackOnUnmountOnce
State
Common
Context Providers
React Context Providers are used to propagate Tracker instances and Location Contexts to all Tracked components.
Higher-level
Lower-level
Factories
Helpers
Tracker Defaults
- makeReactNativeTrackerDefaultPluginsList
- makeReactNativeTrackerDefaultQueue
- makeReactNativeTrackerDefaultTransport
Location Contexts - Higher-level
- makeContentContext
- makeExpandableContext
- makeInputContext
- makeLinkContext
- makeMediaPlayerContext
- makeNavigationContext
- makeOverlayContext
- makePressableContext
- makeRootLocationContext
Location Contexts - Lower-level
Low-level Event Trackers
caution
Using low-level event trackers directly requires extra attention to the LocationStack and its composition.
It's easy to instrument a callback and forget to wrap the triggering Component in a LocationContext.
Take a loot at this how to build your own Custom Tracked Components guide for more info.