Guides
Custom Toolbar Menu
Starting from ComPDF React Native SDK 2.6.0, the SDK supports custom top toolbar menu items and provides a click event callback mechanism to respond when users tap custom toolbar buttons.
For details on configuring and adding custom toolbar menu items, see Main Toolbar.
Listening for Custom Toolbar Menu Item Clicks
When creating the CPDFReaderView, you can listen for clicks on custom toolbar menu items by setting the onCustomToolbarItemTapped callback. For example:
tsx
<CPDFReaderView
ref={pdfReaderRef}
document={samplePDF}
onCustomToolbarItemTapped={(identifier) => {
// Handle custom toolbar menu item click here
}}
/>1
2
3
4
5
6
7
2
3
4
5
6
7
Note: Only custom toolbar menu items trigger this callback. Clicking on ComPDF’s built-in toolbar items (e.g., search, zoom) will not trigger this event.