Skip to content

Commit 9f9b2c1

Browse files
[Android] enableReadingModeQuickMenu prop (#668)
* added prop disableReadingModeQuickMenu (android only) + ios blank implementation due to hygen generated prop * Updating JS files * Updating package version * update api.md * Update API.md * change to enable for consistent with native android * change disabled to enabled for all mentions consistent with native api * Update API.md * Update DocumentViewViewManager.java * Delete example/yarn.lock not intended * Update App.js missed test line * fix logic as can't extract toolmanager as is * default true * Delete ios/RNTPTDocumentView.m unneed ios blank implementation * Delete ios/RNTPTDocumentViewManager.m same as last commit * Delete ios/RNTPTDocumentView.h ^ * Revert "Delete ios/RNTPTDocumentView.m" This reverts commit f0c13f7. * Revert "Delete ios/RNTPTDocumentViewManager.m" This reverts commit 9703d81. * Revert "Delete ios/RNTPTDocumentView.h" This reverts commit 9d8834d. * remove blank ios * Update RNTPTDocumentView.h random space + cleaning PR * edit mEnableQuickMenu * name for consistency * missed variable change --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 83ae002 commit 9f9b2c1

File tree

6 files changed

+27
-2
lines changed

6 files changed

+27
-2
lines changed

API.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3971,4 +3971,15 @@ fieldHightlightColor | object | the form field highlight color, in the format `{
39713971

39723972
```js
39733973
this._viewer.setFormFieldHighlightColor({red: 0, green: 0, blue: 255, alpha: 128}); // blue color
3974-
```
3974+
```
3975+
3976+
#### enableReadingModeQuickMenu
3977+
bool, optional, defaults to true (Android Only)
3978+
3979+
Defines whether the viewer disables long press quick menu in read-only. If false, the UI will not allow the user to long press to open the quick menu.
3980+
3981+
```js
3982+
<DocumentView
3983+
enableReadingModeQuickMenu={false}
3984+
/>
3985+
```

android/src/main/java/com/pdftron/reactnative/viewmanagers/DocumentViewViewManager.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,11 @@ public void setMaxSignatureCount(DocumentView documentView, int maxSignatureCoun
538538
}
539539

540540
// Hygen Generated Props
541+
@ReactProp(name = "enableReadingModeQuickMenu")
542+
public void setEnableReadingModeQuickMenu(DocumentView documentView, boolean enabled) {
543+
documentView.setEnableReadingModeQuickMenu(enabled);
544+
}
545+
541546
@ReactProp(name = "forceAppTheme")
542547
public void setForceAppTheme(DocumentView documentView, @NonNull String forcedAppThemeItems) {
543548
documentView.setForceAppTheme(forcedAppThemeItems);

android/src/main/java/com/pdftron/reactnative/views/DocumentView.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ public class DocumentView extends com.pdftron.pdf.controls.DocumentView2 {
150150
private boolean mUseStylusAsPen = true;
151151
private boolean mSignWithStamps;
152152

153+
private boolean mEnableReadingModeQuickMenu = true;
154+
153155
public boolean isBookmarkListVisible = true;
154156
public boolean isOutlineListVisible = true;
155157
public boolean isAnnotationListVisible = true;
@@ -770,6 +772,10 @@ public void setCurrentToolbar(String toolbarTag) {
770772
}
771773

772774
// Hygen Generated Props
775+
public void setEnableReadingModeQuickMenu(boolean enabled) {
776+
mEnableReadingModeQuickMenu = enabled;
777+
}
778+
773779
public void setForceAppTheme(String forcedAppThemeItems) {
774780
if (THEME_DARK.equals(forcedAppThemeItems)) {
775781
PdfViewCtrlSettingsManager.setColorMode(getContext(), PdfViewCtrlSettingsManager.KEY_PREF_COLOR_MODE_NIGHT);
@@ -3098,6 +3104,7 @@ public void onTabDocumentLoaded(String tag) {
30983104

30993105
getToolManager().setStylusAsPen(mUseStylusAsPen);
31003106
getToolManager().setSignSignatureFieldsWithStamps(mSignWithStamps);
3107+
getToolManager().setReflowTextSelectionMenuEnabled(mEnableReadingModeQuickMenu);
31013108

31023109
getToolManager().getUndoRedoManger().addUndoRedoStateChangeListener(mUndoRedoStateChangedListener);
31033110

lib/src/DocumentView/DocumentView.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ const propTypes = {
156156
overrideToolbarButtonBehavior: arrayOf(Config.Buttons),
157157
onToolbarButtonPress: func(),
158158
// Hygen Generated Props
159+
enableReadingModeQuickMenu: PropTypes.bool,
159160
forceAppTheme: oneOf(Config.ThemeOptions),
160161
signatureColors: PropTypes.arrayOf(PropTypes.exact({
161162
red: PropTypes.number.isRequired,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "react-native-pdftron",
33
"title": "React Native Pdftron",
4-
"version": "3.0.3-26",
4+
"version": "3.0.3-27",
55
"description": "React Native Pdftron",
66
"main": "./lib/index.js",
77
"typings": "index.ts",

src/DocumentView/DocumentView.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ const propTypes = {
165165
onToolbarButtonPress: func<(event: {id: string}) => void>(),
166166

167167
// Hygen Generated Props
168+
enableReadingModeQuickMenu: PropTypes.bool,
168169
forceAppTheme: oneOf<Config.ThemeOptions>(Config.ThemeOptions),
169170
signatureColors: PropTypes.arrayOf(PropTypes.exact({
170171
red: PropTypes.number.isRequired,

0 commit comments

Comments
 (0)