-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add form editing configuration #365
Conversation
} | ||
|
||
@NonNull | ||
private PdfActivityConfiguration updateReactPropsInConfiguration(@NonNull PdfActivityConfiguration configuration) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reasoning behind this method is that iOS defines the enableFormEditing
property as well as the configuration. Since the order of react props application is not guaranteed, we need to make sure that the property value is not overriden by the configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On iOS, the last used option overrides the previous one. For example, if the user sets a value in the configuration, and they later override it in the prop, we will use the most recent one.
index.js
Outdated
/** | ||
* Controls whether or not the document's forms are editable. Defaults to forms being editable (true). | ||
*/ | ||
enableFormEditing: PropTypes.bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This leads to confusing API on Android where this property has higher importance than the configuration.enableFormEditing
(see my comment above https://github.com/PSPDFKit/react-native/pull/365/files#r413992917). Is this really needed for iOS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the view prop is no longer required.
index.js
Outdated
/** | ||
* Controls whether or not the document's forms are editable. Defaults to forms being editable (true). | ||
*/ | ||
enableFormEditing: PropTypes.bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disabling this on iOS not only disables form editing, but also form viewing. Meaning that all forms (including their set value or contents) are essentially hidden.
Is this the desired behavior and does this match the Android behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! I'll update the iOS implementation if needed to match the Android behaviour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Android this only disables form editing. Widget annotations are still rendered.
The only way I know of to disable form rendering is when the acroforms license is missing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the Android implementation makes more sense, and also matches what I would expect from enableFormEditing
.
@radazzouz On iOS we could use editableAnnotationTypes
to exclude widgets to get the same behavior I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you both for the info. I just pushed the changes in 4da5755.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One question about the desired behavior, but apart from that, the iOS part looks good to me!
…diting and keep rendering forms
This reverts commit c1e18c5.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Details
Adds
enableFormEditing: boolean
to AndroidConfigurationAdapter
class. This maps to PSPDFKit'sPdfActivityConfiguration.Builder#enable/disableFormEditing()
.Acceptance Criteria
package.json
,package-lock.json
,samples/Catalog/package.json
, andsamples/NativeCatalog/package.json
(see example commit: 1bf805f).