Skip to content

Commit 07e3267

Browse files
author
PSPDFKit
committed
Release 2.19.1
1 parent b928be3 commit 07e3267

File tree

9 files changed

+107
-123
lines changed

9 files changed

+107
-123
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
## 2.19.0 - 01 Jul 2025
1+
## 2.19.1 - 24 Jul 2025
2+
3+
- Fixes an issue where `PSPDFKitView` component props were not reliably applied on Android. (J#HYB-836)
4+
5+
## 2.19.0 - 02 Jul 2025
26

37
- Adds the `androidRemoveStatusBarOffset` property to the `PDFConfiguration` object on Android. (J#HYB-802)
48
- Adds the `iOSFileConflictResolution` option to `PDFConfiguration` to manage file conflict resolution on iOS. (J#HYB-825)

android/src/main/java/com/pspdfkit/react/ReactPdfViewManager.java

Lines changed: 77 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,11 @@
3434
import com.pspdfkit.annotations.Annotation;
3535
import com.pspdfkit.preferences.PSPDFKitPreferences;
3636
import com.pspdfkit.react.annotations.ReactAnnotationPresetConfiguration;
37+
import com.pspdfkit.react.AnnotationConfigurationAdaptor;
38+
import com.pspdfkit.react.ConfigurationAdapter;
3739
import com.pspdfkit.react.events.PdfViewDataReturnedEvent;
3840
import com.pspdfkit.react.menu.ReactGroupingRule;
41+
import com.pspdfkit.react.ToolbarMenuItemsAdapter;
3942
import com.pspdfkit.views.PdfView;
4043
import com.pspdfkit.configuration.activity.PdfActivityConfiguration;
4144
import org.json.JSONObject;
@@ -148,109 +151,30 @@ public Map<String, Integer> getCommandsMap() {
148151
return commandMap;
149152
}
150153

151-
@ReactProp(name = "documentWithOrderedProps")
152-
public void setDocumentWithOrderedProps(PdfView view, @Nullable ReadableMap orderedProps) {
153-
if (orderedProps == null) return;
154+
@ReactProp(name = "documentAndConfiguration")
155+
public void setDocumentAndConfiguration(PdfView view, @Nullable ReadableMap documentAndConfiguration) {
156+
if (documentAndConfiguration == null) return;
154157

155-
// Process in exact order
156-
if (orderedProps.hasKey("configuration") && !orderedProps.isNull("configuration")) {
157-
ReadableMap configuration = orderedProps.getMap("configuration");
158+
// Process configuration first
159+
if (documentAndConfiguration.hasKey("configuration") && !documentAndConfiguration.isNull("configuration")) {
160+
ReadableMap configuration = documentAndConfiguration.getMap("configuration");
158161
setConfiguration(view, configuration);
159162
}
160163

161-
if (orderedProps.hasKey("annotationPresets") && !orderedProps.isNull("annotationPresets")) {
162-
ReadableMap annotationPresets = orderedProps.getMap("annotationPresets");
163-
List<ReactAnnotationPresetConfiguration> annotationsConfiguration = AnnotationConfigurationAdaptor.convertAnnotationConfigurations(
164-
view.getContext(), annotationPresets
165-
);
166-
view.setAnnotationConfiguration(annotationsConfiguration);
167-
}
168-
169-
if (orderedProps.hasKey("fragmentTag") && !orderedProps.isNull("fragmentTag")) {
170-
String fragmentTag = orderedProps.getString("fragmentTag");
171-
view.setFragmentTag(fragmentTag);
172-
}
173-
174-
if (orderedProps.hasKey("menuItemGrouping") && !orderedProps.isNull("menuItemGrouping")) {
175-
ReadableArray menuItemGrouping = orderedProps.getArray("menuItemGrouping");
176-
ReactGroupingRule groupingRule = new ReactGroupingRule(view.getContext(), menuItemGrouping);
177-
view.setMenuItemGroupingRule(groupingRule);
178-
}
179-
180-
// Load document
181-
if (orderedProps.hasKey("document") && !orderedProps.isNull("document")) {
182-
String document = orderedProps.getString("document");
164+
// Then load document
165+
if (documentAndConfiguration.hasKey("document") && !documentAndConfiguration.isNull("document")) {
166+
String document = documentAndConfiguration.getString("document");
183167
// Always set the document, even if it's the same path, to ensure it loads
184168
view.setDocument(document, this.reactApplicationContext);
185169
}
186-
187-
// Process post-document props
188-
if (orderedProps.hasKey("pageIndex") && !orderedProps.isNull("pageIndex")) {
189-
int pageIndex = orderedProps.getInt("pageIndex");
190-
view.setPageIndex(pageIndex);
191-
}
192-
193-
if (orderedProps.hasKey("toolbar") && !orderedProps.isNull("toolbar")) {
194-
ReadableMap toolbar = orderedProps.getMap("toolbar");
195-
setToolbar(view, toolbar);
196-
}
197-
198-
if (orderedProps.hasKey("toolbarMenuItems") && !orderedProps.isNull("toolbarMenuItems")) {
199-
ReadableArray toolbarMenuItems = orderedProps.getArray("toolbarMenuItems");
200-
setToolbarMenuItems(view, toolbarMenuItems);
201-
}
202-
203-
if (orderedProps.hasKey("annotationContextualMenu") && !orderedProps.isNull("annotationContextualMenu")) {
204-
ReadableMap annotationContextualMenu = orderedProps.getMap("annotationContextualMenu");
205-
setAnnotationContextualMenu(view, annotationContextualMenu);
206-
}
207170
}
208171

209-
210-
211-
@ReactProp(name = "disableDefaultActionForTappedAnnotations")
212-
public void setDisableDefaultActionForTappedAnnotations(PdfView view, boolean disableDefaultActionForTappedAnnotations) {
213-
view.setDisableDefaultActionForTappedAnnotations(disableDefaultActionForTappedAnnotations);
214-
}
215-
216-
@ReactProp(name = "disableAutomaticSaving")
217-
public void setDisableAutomaticSaving(PdfView view, boolean disableAutomaticSaving) {
218-
view.setDisableAutomaticSaving(disableAutomaticSaving);
219-
}
220-
221-
@ReactProp(name = "annotationAuthorName")
222-
public void setAnnotationAuthorName(PdfView view, String annotationAuthorName) {
223-
PSPDFKitPreferences.get(view.getContext()).setAnnotationCreator(annotationAuthorName);
224-
}
225-
226-
@ReactProp(name = "imageSaveMode")
227-
public void setImageSaveMode(PdfView view, String imageSaveMode) {
228-
view.setImageSaveMode(imageSaveMode);
229-
}
230-
231-
232-
233-
@ReactProp(name = "showNavigationButtonInToolbar")
234-
public void setShowNavigationButtonInToolbar(@NonNull final PdfView view, final boolean showNavigationButtonInToolbar) {
235-
view.setShowNavigationButtonInToolbar(showNavigationButtonInToolbar);
236-
}
237-
238-
@ReactProp(name= "hideDefaultToolbar")
239-
public void setHideDefaultToolbar(@NonNull final PdfView view, final boolean hideDefaultToolbar) {
240-
view.setHideDefaultToolbar(hideDefaultToolbar);
241-
}
242-
243-
@ReactProp(name = "availableFontNames")
244-
public void setAvailableFontNames(@NonNull final PdfView view, @Nullable final ReadableArray availableFontNames) {
245-
view.setAvailableFontNames(availableFontNames);
246-
}
247-
248-
@ReactProp(name = "selectedFontName")
249-
public void setSelectedFontName(@NonNull final PdfView view, @Nullable final String selectedFontName) {
250-
view.setSelectedFontName(selectedFontName);
172+
@ReactProp(name = "fragmentTag")
173+
public void setFragmentTag(PdfView view, @NonNull String fragmentTag) {
174+
view.setFragmentTag(fragmentTag);
251175
}
252176

253-
// Helper methods for setDocumentWithOrderedProps (not @ReactProp methods)
177+
// Helper method for setDocumentAndConfiguration (not @ReactProp method)
254178
private void setConfiguration(PdfView view, @NonNull ReadableMap configuration) {
255179
ConfigurationAdapter configurationAdapter = new ConfigurationAdapter(view.getContext(), configuration);
256180
PdfActivityConfiguration configurationBuild = configurationAdapter.build();
@@ -276,7 +200,21 @@ private void setConfiguration(PdfView view, @NonNull ReadableMap configuration)
276200
}
277201
}
278202

279-
private void setToolbar(@NonNull final PdfView view, @NonNull ReadableMap toolbar) {
203+
@ReactProp(name = "annotationPresets")
204+
public void setAnnotationPresets(PdfView view, @NonNull ReadableMap annotationPresets) {
205+
List<ReactAnnotationPresetConfiguration> annotationsConfiguration = AnnotationConfigurationAdaptor.convertAnnotationConfigurations(
206+
view.getContext(), annotationPresets
207+
);
208+
view.setAnnotationConfiguration(annotationsConfiguration);
209+
}
210+
211+
@ReactProp(name = "pageIndex")
212+
public void setPageIndex(PdfView view, int pageIndex) {
213+
view.setPageIndex(pageIndex);
214+
}
215+
216+
@ReactProp(name = "toolbar")
217+
public void setToolbar(@NonNull final PdfView view, @NonNull ReadableMap toolbar) {
280218
if (toolbar.hasKey("toolbarMenuItems")) {
281219
ReadableMap toolbarMenuItems = toolbar.getMap("toolbarMenuItems");
282220
ArrayList buttons = toolbarMenuItems.getArray("buttons").toArrayList();
@@ -306,12 +244,14 @@ private void setToolbar(@NonNull final PdfView view, @NonNull ReadableMap toolba
306244
}
307245
}
308246

309-
private void setMenuItemGrouping(PdfView view, @NonNull ReadableArray menuItemGrouping) {
247+
@ReactProp(name = "menuItemGrouping")
248+
public void setMenuItemGrouping(PdfView view, @NonNull ReadableArray menuItemGrouping) {
310249
ReactGroupingRule groupingRule = new ReactGroupingRule(view.getContext(), menuItemGrouping);
311250
view.setMenuItemGroupingRule(groupingRule);
312251
}
313252

314-
private void setToolbarMenuItems(@NonNull final PdfView view, @Nullable final ReadableArray toolbarItems) {
253+
@ReactProp(name = "toolbarMenuItems")
254+
public void setToolbarMenuItems(@NonNull final PdfView view, @Nullable final ReadableArray toolbarItems) {
315255
if (toolbarItems != null) {
316256
PdfActivityConfiguration currentConfiguration = view.getConfiguration();
317257
ToolbarMenuItemsAdapter newConfigurations = new ToolbarMenuItemsAdapter(currentConfiguration, toolbarItems, view.getInitialConfiguration());
@@ -324,12 +264,53 @@ private void setToolbarMenuItems(@NonNull final PdfView view, @Nullable final Re
324264
}
325265
}
326266

327-
private void setAnnotationContextualMenu(@NonNull final PdfView view, @NonNull ReadableMap annotationContextualMenuItems) {
267+
@ReactProp(name = "annotationContextualMenu")
268+
public void setAnnotationContextualMenu(@NonNull final PdfView view, @NonNull ReadableMap annotationContextualMenuItems) {
328269
if (annotationContextualMenuItems != null) {
329270
view.setAnnotationToolbarMenuButtonItems(annotationContextualMenuItems);
330271
}
331272
}
332273

274+
@ReactProp(name = "disableDefaultActionForTappedAnnotations")
275+
public void setDisableDefaultActionForTappedAnnotations(PdfView view, boolean disableDefaultActionForTappedAnnotations) {
276+
view.setDisableDefaultActionForTappedAnnotations(disableDefaultActionForTappedAnnotations);
277+
}
278+
279+
@ReactProp(name = "disableAutomaticSaving")
280+
public void setDisableAutomaticSaving(PdfView view, boolean disableAutomaticSaving) {
281+
view.setDisableAutomaticSaving(disableAutomaticSaving);
282+
}
283+
284+
@ReactProp(name = "annotationAuthorName")
285+
public void setAnnotationAuthorName(PdfView view, String annotationAuthorName) {
286+
PSPDFKitPreferences.get(view.getContext()).setAnnotationCreator(annotationAuthorName);
287+
}
288+
289+
@ReactProp(name = "imageSaveMode")
290+
public void setImageSaveMode(PdfView view, String imageSaveMode) {
291+
view.setImageSaveMode(imageSaveMode);
292+
}
293+
294+
@ReactProp(name = "showNavigationButtonInToolbar")
295+
public void setShowNavigationButtonInToolbar(@NonNull final PdfView view, final boolean showNavigationButtonInToolbar) {
296+
view.setShowNavigationButtonInToolbar(showNavigationButtonInToolbar);
297+
}
298+
299+
@ReactProp(name= "hideDefaultToolbar")
300+
public void setHideDefaultToolbar(@NonNull final PdfView view, final boolean hideDefaultToolbar) {
301+
view.setHideDefaultToolbar(hideDefaultToolbar);
302+
}
303+
304+
@ReactProp(name = "availableFontNames")
305+
public void setAvailableFontNames(@NonNull final PdfView view, @Nullable final ReadableArray availableFontNames) {
306+
view.setAvailableFontNames(availableFontNames);
307+
}
308+
309+
@ReactProp(name = "selectedFontName")
310+
public void setSelectedFontName(@NonNull final PdfView view, @Nullable final String selectedFontName) {
311+
view.setSelectedFontName(selectedFontName);
312+
}
313+
333314
@ReactProp(name = "measurementValueConfigurations")
334315
public void setMeasurementValueConfigurations(@NonNull final PdfView view, @Nullable final ReadableArray measurementValueConfigs) {
335316
if (measurementValueConfigs != null) {

index.js

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -68,38 +68,25 @@ class PSPDFKitView extends React.Component {
6868
: null;
6969

7070
if (Platform.OS === 'android') {
71-
// Android: Use combined props approach for proper ordering
71+
// Android: Only group document and configuration for proper ordering
7272
const {
7373
document,
74-
configuration,
75-
annotationPresets,
76-
fragmentTag,
77-
menuItemGrouping,
78-
pageIndex,
79-
toolbar,
80-
toolbarMenuItems,
81-
annotationContextualMenu,
82-
// ... other props that need ordering
74+
configuration,
75+
// Explicitly exclude document and configuration from otherProps
8376
...otherProps
8477
} = this.props;
8578

86-
// Always create combined prop, even if some are undefined
87-
const orderedProps = {
88-
configuration: configuration || null,
89-
annotationPresets: annotationPresets || null,
90-
fragmentTag: fragmentTag || "PSPDFKitView.FragmentTag",
91-
menuItemGrouping: menuItemGrouping || null,
92-
document: document || null,
93-
pageIndex: pageIndex || null,
94-
toolbar: toolbar || null,
95-
toolbarMenuItems: toolbarMenuItems || null,
96-
annotationContextualMenu: annotationContextualMenu || null,
79+
// Only create combined prop for document and configuration
80+
const documentAndConfiguration = {
81+
document: document !== undefined ? document : null,
82+
configuration: configuration !== undefined ? configuration : null,
9783
};
9884

9985
return (
10086
<RCTPSPDFKitView
10187
ref={this._componentRef}
102-
documentWithOrderedProps={orderedProps} // Android only
88+
documentAndConfiguration={documentAndConfiguration} // Android only
89+
fragmentTag="NutrientView.FragmentTag"
10390
{...otherProps}
10491
onCloseButtonPressed={onCloseButtonPressedHandler}
10592
onStateChanged={this._onStateChanged}

lib/document/Bookmark.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22
Object.defineProperty(exports, "__esModule", { value: true });
33
exports.Bookmark = void 0;
44
/**
5+
* A Bookmark is a named location in a document.
56
* @interface Bookmark
7+
* @memberof Bookmark
8+
* @property {string} [name] - The bookmark name. This is optional.
9+
* @property {string} displayName - The bookmark display name.
10+
* @property {string} identifier - A string uniquely identifying the bookmark.
11+
* @property {number} pageIndex - The page index on which the bookmark is located.
612
*/
713
var Bookmark = /** @class */ (function () {
814
function Bookmark() {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-pspdfkit",
3-
"version": "2.19.0",
3+
"version": "2.19.1",
44
"description": "Nutrient React Native SDK",
55
"keywords": [
66
"react native",

samples/Catalog/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "catalog",
3-
"version": "2.19.0",
3+
"version": "2.19.1",
44
"private": true,
55
"scripts": {
66
"android": "npx react-native run-android",

samples/Catalog/yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4848,7 +4848,7 @@ react-native-is-edge-to-edge@^1.1.7:
48484848
integrity sha512-EH6i7E8epJGIcu7KpfXYXiV2JFIYITtq+rVS8uEb+92naMRBdxhTuS8Wn2Q7j9sqyO0B+Xbaaf9VdipIAmGW4w==
48494849

48504850
"react-native-pspdfkit@file:../..":
4851-
version "2.19.0"
4851+
version "2.19.1"
48524852

48534853
react-native-safe-area-context@^5.3.0:
48544854
version "5.3.0"

src/document/Bookmark.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
/**
2+
* A Bookmark is a named location in a document.
23
* @interface Bookmark
4+
* @memberof Bookmark
5+
* @property {string} [name] - The bookmark name. This is optional.
6+
* @property {string} displayName - The bookmark display name.
7+
* @property {string} identifier - A string uniquely identifying the bookmark.
8+
* @property {number} pageIndex - The page index on which the bookmark is located.
39
*/
410
export class Bookmark {
511
/**

0 commit comments

Comments
 (0)