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-comparison-slider

v0.1.44

Published

Comparison Slider as a component for react native.

Downloads

278

Readme

React Native Comparison SLider

  • A simple component to display two image in comparison with a slide-over feature.
  • Help you to compare two images
  • Lightweight, fast, flexible, customizable.
  • Support both iOS and Android devices

Install

npm install --save react-native-comparison-slider

Require React-Native > 0.45.0

Demo

Demo

Example code

PS: For a more detailed example, see: react-native-comparison-slider-example -> to run the example, cd to the example folder and do react-native start lunch the iOS simulator by running react-native run-ios

When you want to use the comparison slider with local images, simply add these lines:

import ComparisonSlider from "react-native-comparison-slider";

<ComparisonSlider
imageWidth={667}
imageHeight={400}
initialPosition={50}
leftImage={require("./img/left.jpeg")}
rightImage={require("./img/right.jpeg")}
/>

These code will use the left.jpeg image as the left image and the right.jpeg as the right image. The slider will be half between the image (50). The imageWidth and imageHeight are the size you want your comparison slider to be.

When you want to use the comparison slider with remote images, simply add these lines:

import ComparisonSlider from "react-native-comparison-slider";

<ComparisonSlider
initialPosition={50}
leftImageURI="https://..."
rightImageURI="https://..."
/>

These code will use the leftImageURI as the left image and the rightImageURI as the right image. The slider will be half between the image (50). The default size for the comparison slider will be the image size of the remote url.You can bypass the size by adding the two props: imageWidth and imageHeight.

Props

| Prop | Description | Default value | |---|---|---| |initialPosition|The initial position of the slider hover the image. Value are from (0 to 100)|50| |imageWidth|Width of the image/comparison slider|If local image: no default value. If remote image image width| |imageHeight|Height of the image/comparison slider|If local image: no default value. If remote image image height| |leftImage|Left image for the comparison slider. Use as require() |No default value| |rightImage|Right image for the comparison slider. Use as require() |No default value |leftImageURI|URL for the left image of the comparison slider. Use as { uri: "http://..." }|No default value| |rightImageURI|URL for the left image of the comparison slider. Use as { uri: "http://..." }|No default value| |onValueChange|Function that get called when the slider value changed. (value) => console.log(value)|No default value| |onSlidingStart|Function that get called when the slider starts to change. () => console.log(value)|No default value| |onSlidingComplete|Function that get called when the slider ends changing. () => console.log(value)|No default value| |thumbnailRender|Function that return a view. The view will be the middle slider|Slider you can see in the demo| |thumbnailWidth|Width of the view that is returned by the thumbnailRender|No default value| |imageStyle|Style property you can pass to apply to image of the comparison slider|No default value| |resizeMode|ResizeMode property to apply to the image of the comparison slider|No default value|

License

MIT License

Copyright (c) 2017 Charles-Olivier Demers

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Other

This package use these two libraries:

  • https://github.com/jhampton/react-native-cropping.git from 2jhampton
  • https://github.com/jeanregisser/react-native-slider from @jeanregisser

@copyright of the image used in the demo:

  • http://www.basketetsacados.com/top-10-des-plus-belles-plages-du-monde