This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/react-native/events-and-notifications/viewer.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. React Native PDF viewer events | Nutrient React Native SDK

Nutrient React Native SDK provides a NotificationCenter class, which can be used to subscribe to viewer events. This includes events specifically related to a document.

Registering for viewer events in the notification center

The example below shows how to register for an event listener to be notified when a document has loaded:

override componentDidMount() {
this.pdfRef.current?.getNotificationCenter().subscribe(NotificationCenter.DocumentEvent.LOADED, (event: any) => {
Alert.alert('Nutrient', JSON.stringify(event));
});
}

Unregistering from viewer events in the notification center

The example below shows how to unregister from document-loaded listener events:

override componentWillUnmount () {
this.pdfRef.current?.getNotificationCenter().unsubscribe(NotificationCenter.DocumentEvent.LOADED);
}

If you registered for multiple events and want to unregister from all of them, use the following API:

override componentWillUnmount () {
this.pdfRef.current?.getNotificationCenter().unsubscribeAllEvents();
}

For a list of all the viewer-related events you can register for, see DocumentEvent and TextEvent. For more details and sample code, see the EventListeners.tsx example(opens in a new tab) from the Catalog example project.