Skip to content
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

Fix issue where disableAutomaticSaving did not work when useParentNavigationBar was enabled. #389

Merged
merged 2 commits into from
Feb 9, 2021

Conversation

radazzouz
Copy link
Contributor

@radazzouz radazzouz commented Feb 9, 2021

Details

When disabling autosave via the disableAutomaticSaving prop, we also need to disable the autosaveEnabled configuration option. This caused an issue where autosave still occurred even after setting disableAutomaticSaving to true.

See Z-22960

How to Reproduce on the main branch:

  • Modify the ManualSave example and set useParentNavigationBar to true:
ManualSave
class ManualSave extends Component {
  render() {
    return (
      <View style={{ flex: 1 }}>
        <PSPDFKitView
          ref="pdfView"
          document={"PDFs/Annual Report.pdf"}
          disableAutomaticSaving={true}
          configuration={{
            backgroundColor: processColor("lightgrey"),
            showThumbnailBar: "scrollable",
+           useParentNavigationBar: true,
          }}
          style={{ flex: 1, color: pspdfkitColor }}
        />
        <View
          style={{
            flexDirection: "row",
            height: 60,
            alignItems: "center",
            padding: 10,
          }}
        >
          <View>
            <Button
              onPress={() => {
                // Manual Save
                this.refs.pdfView
                  .saveCurrentDocument()
                  .then((result) => {
                    if (result) {
                      alert("Successfully saved current document.");
                    } else {
                      alert("Failed to save current document.");
                    }
                  })
                  .catch((error) => {
                    alert(JSON.stringify(error));
                  });
              }}
              title="Save"
            />
          </View>
        </View>
      </View>
    );
  }
}
  • Launch the Catalog and open the "Manual Save" example.
  • Add any annotation.
  • Go back to the examples list.
  • Reopen the "Manual Save" example.

Expected:

The newly added annotation should not have been saved.

Actual:

The newly added annotation is saved despite the fact that disableAutomaticSaving was set to true.

Kapture 2021-02-09 at 11 46 53

Acceptance Criteria

  • Fix the issue.
  • When approved, right before merging, rebase with master and increment the package version in package.json, package-lock.json, samples/Catalog/package.json, and samples/NativeCatalog/package.json (see example commit: 1bf805f).
  • Create a new release (and tag) with the new package version (see https://github.com/PSPDFKit/react-native/releases).

…osave via the `disableAutomaticSaving` prop
Copy link
Contributor

@steviki steviki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense! 👍

@radazzouz radazzouz changed the title Disable the autosaveEnabled configuration option when disabling autosave via the disableAutomaticSaving prop Fix issue where disableAutomaticSaving did not work when useParentNavigationBar was enabled. Feb 9, 2021
@radazzouz radazzouz merged commit 33e2560 into master Feb 9, 2021
@radazzouz radazzouz deleted the rad/fix-disableAutomaticSaving-ios branch February 9, 2021 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants