Skip to content

Conversation

@radazzouz
Copy link
Contributor

@radazzouz radazzouz commented Jul 4, 2018

The iOS implementation of #83


  • Adds an event (onAnnotationTapped) for when the annotation is tapped.
  • Adds the ability to disable the default action for tapped annotations via disableDefaultActionForTappedAnnotations

How to test

  • Create a new React Native sample app: https://github.com/PSPDFKit/react-native#ios
  • For step 4, use this branch: yarn add github:PSPDFKit/react-native#rad/add-onAnnotationTapped-ios
  • For step 15, use the following code in your App.js
import React, { Component } from 'react';
import { NativeModules } from 'react-native';
import PSPDFKitView from 'react-native-pspdfkit'

var PSPDFKit = NativeModules.PSPDFKit;
PSPDFKit.setLicenseKey('YOUR_LICENSE_KEY_GOES_HERE');

export default class App extends Component<{}> {
  render() {
    return (
      <PSPDFKitView
        document={'document.pdf'}
        configuration={{
          pageTransition: 'scrollContinuous',
          scrollDirection: 'vertical',
          documentLabelEnabled: true,
        }}
        style={{ flex: 1, color: '#267AD4' }}
        disableDefaultActionForTappedAnnotations={true}
        onAnnotationTapped={this.onAnnotationTapped}
      />
    )
  }
  onAnnotationTapped(event) {
      alert('tapped on Annotation: ' + JSON.stringify(event));
  }
}
  • Launch the app
  • Add a new annotation
  • Exit the annotation mode by closing the annotation toolbar
  • Tap on the added annotation
  • Observe the alert

recording

What to test:

  • Make sure that there are now issues on Android and Windows

@radazzouz radazzouz added the iOS label Jul 4, 2018
@radazzouz radazzouz self-assigned this Jul 4, 2018
@radazzouz radazzouz force-pushed the rad/add-onAnnotationTapped-ios branch from 2c8591b to 09a554d Compare July 4, 2018 19:22
@radazzouz radazzouz force-pushed the rad/add-onAnnotationTapped-ios branch from 09a554d to fe7d3a1 Compare July 9, 2018 15:26
@radazzouz radazzouz changed the title [WIP] Add onAnnotationTapped event for the UI Component Add onAnnotationTapped event for the UI Component Jul 9, 2018
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.

Looks good! 👍

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.

👍 Does not touch windows.

Copy link
Contributor

@simoarpe simoarpe left a comment

Choose a reason for hiding this comment

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

Looks good 👌

@radazzouz radazzouz merged commit 3f3aeae into master Jul 10, 2018
@radazzouz radazzouz deleted the rad/add-onAnnotationTapped-ios branch July 10, 2018 15:09
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