Detecting If Annotations Have Changed in React Native

PSPDFKit for React Native allows you to detect when one or more annotations have changed via the onAnnotationsChanged event listener. Here’s how to implement an event listener to be notified when one or more annotations have changed:

<PSPDFKitView
	document={DOCUMENT}
	onAnnotationsChanged={(event) => {
		alert('Annotations and forms changed:\n' + JSON.stringify(event));
	}}
	ref="pdfView"
	fragmentTag="PDF1"
	style={{ flex: 1 }}
/>

The onAnnotationsChanged payload is a dictionary containing the following payload:

Key
Value
annotations An array of changed annotations
change The type of change: Potential values can be added, changed, or removed