Navigation — embedding the chat
App-wide chat session (calls / push from any screen)
If the chat tab mounts lazily but you want the socket (presence, incoming calls) alive from app start, mount a ChatProvider + CallProvider near the root, pass your container ref, and register ActiveCallScreen in that root stack. Fieldr's version is ChatSessionHost.tsx. Minimal form:
tsxsrc/navigation/RootNavigator.tsx
// src/navigation/RootNavigator.tsximport {ActiveCallScreen, CallProvider, ChatProvider} from '@realtimexsco/live-chat-react-native'; <NavigationContainer ref={navigationRef}> <Stack.Navigator> {/* …your screens… */} <Stack.Screen name="ActiveCallScreen" component={ActiveCallScreen} options={{gestureEnabled: false}} /> </Stack.Navigator> <ChatProvider config={chatConfig} withSafeArea={false} withGestureRoot={false} withToast={false}> <CallProvider navigationRef={navigationRef}>{null}</CallProvider> </ChatProvider></NavigationContainer>Mount one CallProvider at a time — render the root one only while no ChatNavigator is mounted.
Post-login navigation.reset(...) calls must keep an open ActiveCallScreen route: a call answered from a killed app is often in progress before your app has finished signing in (CallProvider reopens the screen if a reset drops it).