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 set toolbar promise. #208

Merged
merged 3 commits into from
Apr 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-pspdfkit",
"version": "1.23.4",
"version": "1.23.5",
"description": "A React Native module for the PSPDFKit library.",
"keywords": [
"react native",
Expand Down
4 changes: 3 additions & 1 deletion samples/Catalog/Catalog.windows.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,9 @@ class PdfViewToolbarCustomizationScreen extends Component<{}> {
</View>
<View style={styles.button}>
<Button onPress={() =>
this.refs.pdfView.setToolbarItems([{type: "ink"}])} title="Set Toolbar Items"/>
this.refs.pdfView.setToolbarItems([{type: "ink"}]).then(() => {
alert("Toolbar Items set.");
})} title="Set Toolbar Items"/>
</View>
</View>
<Image
Expand Down
2 changes: 1 addition & 1 deletion samples/Catalog/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Catalog",
"version": "1.23.4",
"version": "1.23.5",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,14 @@ internal void GetToolbarItems(int requestId)

internal async Task SetToolbarItems(int requestId, string toolbarItemsJson)
{
try
{
var toolbarItems =
PSPDFKit.UI.ToolbarComponents.Factory.FromJsonArray(JsonArray.Parse(toolbarItemsJson));
await Pdfview.Controller.SetToolbarItemsAsync(toolbarItems.ToList());
}
catch (Exception e)
{
this.GetReactContext().GetNativeModule<UIManagerModule>().EventDispatcher.DispatchEvent(
new PdfViewDataReturnedEvent(this.GetTag(), requestId, e.Message)
);
}
await RunOperationAndFireEvent(requestId,
async () =>
{
var toolbarItems =
PSPDFKit.UI.ToolbarComponents.Factory.FromJsonArray(JsonArray.Parse(toolbarItemsJson));
await Pdfview.Controller.SetToolbarItemsAsync(toolbarItems.ToList());
}
);
}

internal async Task CreateAnnotation(int requestId, string annotationJsonString)
Expand Down