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

Update the README to add a section about how to Customize the Toolbar Buttons #256

Merged
merged 2 commits into from
Jul 16, 2019

Conversation

radazzouz
Copy link
Contributor

@radazzouz radazzouz commented Jul 16, 2019

Came up in Z#14836


Details

Updated the README to add a section about how to Customize the Toolbar Buttons.

Acceptance Criteria

  • No API change. Does not impact Android or UWP.
  • When approved, right before merging, rebase with master and increment the package version in package.json, package-lock.json, and samples/Catalog/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).

Copy link
Contributor

@steipete steipete left a comment

Choose a reason for hiding this comment

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

lgtm!

Copy link
Contributor

@nickwinder nickwinder left a comment

Choose a reason for hiding this comment

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

LGTM

[
menuItem,
{ key: menuItem, items: [subItem, subItem]},
...
]
```

#### Customize the Toolbar Buttons

You can customize the toolbar buttons on the Native UI View component by specifying the toolbar buttons using `setLeftBarButtonItems` and `setRightBarButtonItems`, like so:
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick (feel free to ignore):Maybe we could add a sentence on what the second parameter is (the animated flag) and what it can be used for.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd rather keep this paragraph short. The animated and the view mode parameters are documented in the API here:

react-native/index.js

Lines 362 to 381 in 04aee96

/**
* Set the right bar button items for the specified view mode.
* Note: The same button item cannot be added to both the left and right bar button items simultaneously.
*
* @param items The list of bar button items. See the full list of button items here: https://pspdfkit.com/api/ios/Classes/PSPDFViewController.html#/Toolbar%20button%20items
* @param viewMode The optional view mode. Can be 'document', 'thumbnails', 'documentEditor' or `null`. If `null` is passed, bar button items for all view modes are set.
* @param animated The animated flag.
*
* @platform ios
*/
setRightBarButtonItems = function(items, viewMode, animated) {
if (Platform.OS === "ios") {
NativeModules.PSPDFKitViewManager.setRightBarButtonItems(
items,
viewMode,
animated,
findNodeHandle(this.refs.pdfView)
);
}
};

@radazzouz
Copy link
Contributor Author

I will not bump the version numbers on this PR. I'll do it in #255 for both PRs.

@radazzouz radazzouz merged commit 7e9fee2 into master Jul 16, 2019
@radazzouz radazzouz deleted the rad/update-readme-for-toolbar-customization branch July 16, 2019 15:03
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.

5 participants