npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-nytphotoviewer

v1.2.1

Published

React native wrapper for the NYTPhotoViewer iOS library

Downloads

13

Readme

react-native-NYTPhotoViewer

React native wrapper for the NYTPhotoViewer iOS library

Build Status

npm version Build Status NPM

Install

Run npm install react-native-nytphotoviewer --save

iOS

  1. In the XCode's "Project navigator", right click on your project's Libraries folder ➜ Add Files to <...>
  2. Go to node_modulesreact-native-NYTPhotoViewerios ➜ select RCTNYTPhotoViewer.xcodeproj
  3. Add RCTNYTPhotoViewer.a to Build Phases -> Link Binary With Libraries

CocoaPods

  1. Add pod 'react-native-NYTPhotoViewer', :path => '../node_modules/react-native-nytphotoviewer' to your PodFile

NOTE - Forked Dependency

This module currently requires the use of our own forked version of NYTPhotoViewer. Please add the following to your podfile

pod 'NYTPhotoViewer', :git => 'https://github.com/sprightco/NYTPhotoViewer', :branch => 'develop'

Usage (es6 example)

import NYTPhotoViewer from 'react-native-nytphotoviewer';

class MyComponent extends React.Component {
  
  constructor(props) {
    super(props);
    this.onImagePress = this.onImagePress.bind(this);
    this.onPhotoViewerDismissed = this.onPhotoViewerDismissed.bind(this);
  }
  
  onImagePress() {
    NYTPhotoViewer.once(NYTPhotoViewer.DISMISSED, this.onPhotoViewerDismissed);
    NYTPhotoViewer.addPhotos([this.props.urlOfImage]);
      .then(() => {
        return NYTPhotoViewer.showPhotoViewer()
      })
      .then(() => {
        console.log('Photo viewer is now visible and image has loaded');
      });
  }
  
  onPhotoViewerDismissed() {
    console.log('PhotoViewer has been dismissed');
  }

  render() {
    return (
      <View>
        <TouchableHighlight
          onPress={this.onImagePress}
          activeOpacity={0.5}
          underlayColor='transparent'
        >
          <Image
            source={{uri: this.props.urlOfImage}}
          />
        </TouchableHighlight>
      </View>
    );
  }
}

Events

  • addListener(eventType, function()) eventType can be 'NYTPhotoViewer:Dismissed' which is fired when the PhotoViewer is dismissed eventType can be 'NYTPhotoViewer:ActionButtonPress' which is fired when the action button is pressed

  • on(eventType, listener) Short cut for addListener

  • once(eventType, listener) Event listener fires once and then is removed.

  • removeListener(eventType, listener) Removes an event listener

Functions

  • NYTPhotoViewer.showPhotoViewer():Promise Shows the photo viewer. Returns a Promise the is fulfilled when photoViewer is visible.

  • NYTPhotoViewer.hidePhotoViewer():Promise Hides the photo viewer. Returns a Promise the is fulfilled when photoViewer is no longer visible.

  • NYTPhotoViewer.showActionButton() Show the action button in top right of NYTPhotoViewer (action button is visible by default)

  • NYTPhotoViewer.hideActionButton() Hide the action button.

  • NYTPhotoViewer.addPhotos(sources):Promise Adds photo sources to the photo viewer. sources is an array of uris to an image which is loaded by native module. Promise is resolved when photos have been added to the photo viewer.

  • NYTPhotoViewer.clearPhotos():Promise Removes all sources from the photo viewer. Promise is resolved when the sources have been removed.

  • NYTPhotoViewer.indexOfPhoto(source):Promise

  • NYTPhotoViewer.photoAtIndex(index):Promise

  • NYTPhotoViewer.removePhotos(sources):Promise

  • NYTPhotoViewer.displayPhotoAtIndex(index):Promise

  • NYTPhotoViewer.displayPhotoWithSource(source):Promise