Coder Social home page Coder Social logo

iq-scm / react-native-reanimated-zoom Goto Github PK

View Code? Open in Web Editor NEW

This project forked from intergalacticspacehighway/react-native-reanimated-zoom

0.0 0.0 0.0 522 KB

Component for zooming react native views. ๐Ÿ”Ž

License: MIT License

Shell 1.18% JavaScript 5.19% Ruby 3.09% C++ 13.20% Objective-C 0.73% Java 31.09% TypeScript 26.32% Objective-C++ 12.34% Swift 0.21% Makefile 2.91% Starlark 3.72%

react-native-reanimated-zoom's Introduction

react-native-reanimated-zoom ๐Ÿ”Ž

Component for zooming react native views. ๐Ÿง

demo.mp4

Features

  • Simple API.
  • Performant. No state triggered re-renders. โšก๏ธ
  • Can be used with Image/Video or any kind of View.
  • Works with FlatList/ScrollView.
  • Consistent on Android and iOS.
RPReplay_Final1655573956.MP4

Installation

# npm
npm install react-native-reanimated-zoom
# yarn
yarn add react-native-reanimated-zoom

Peer dependencies

Make sure you have installed react-native-gesture-handler > 2 and react-native-reanimated > 2.

Usage

Simple zoom view

import { Zoom } from 'react-native-reanimated-zoom';

export default function App() {
  return (
    <Zoom>
      <Image
        source={{
          uri: 'your image uri',
        }}
        style={{ width: 300, height: 400 }}
      />
    </Zoom>
  );
}

With FlatList or ScrollView

import { FlatList } from 'react-native';
import { Zoom, createZoomListComponent } from 'react-native-reanimated-zoom';

const ZoomFlatList = createZoomListComponent(FlatList);

const ListExample = () => {
  const renderItem = React.useCallback(
    ({ item }) => {
      return (
        <Zoom>
          <Image
            source={{
              uri: item,
            }}
            style={{
              width: 400,
              height: 400,
            }}
          />
        </Zoom>
      );
    },
    [dimension]
  );

  return (
    <ZoomFlatList
      data={data}
      pagingEnabled
      horizontal
      keyExtractor={(item) => item}
      renderItem={renderItem}
    />
  );
};

Props

  • minimumZoomScale - Determines minimum scale value the component should zoom out. Defaults to 1.
  • maximumZoomScale - Determines maximum scale value the component should zoom in. Defaults to 8.
  • onZoomBegin - Callback. Gets called when view is zoomed in.
  • onZoomEnd - Callback. Gets called when view zoom is restored.

Examples

  • You can find examples of a simple zoom view and zoomable items in list here

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

Known issues

Credits

Built with react-native-builder-bob โค๏ธ

react-native-reanimated-zoom's People

Contributors

intergalacticspacehighway avatar sregg avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.