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-magic-moving

v1.0.1

Published

A novel transition animation between components

Downloads

6

Readme

MagicMoving

A novel transition animation between components.

1. Examples

Download the repository, cd the examples directory, and run it on simulator.

git clone [email protected]:SmallStoneSK/react-native-magic-moving.git
cd examples
react-native run-ios      # for ios
react-native run-android  # for android

2. Basic Usage

At first, you should install react-native-magic-moving. Like this:

npm install react-native-magic-moving --save

Then, you can refer to the following example. At least, you should pass 4 properties to MagicMoving:

  1. data: the dataSource for rendered list.
  2. cardStyle: it will work on the list's card container.
  3. renderCardContent: custom what you want to show in the card.
  4. renderPopupLayerContent: custom what you want to show in the popup layer.

Note: each item in the data should have a image. Because it is the image source of popup layer banner image.

import React from 'react';
import {Text, Image, StyleSheet} from 'react-native';
import {MagicMoving} from 'react-native-magic-moving';

const mockedData = [
  {
    image: {uri: 'https://hellorfimg.zcool.cn/preview260/525525049.jpg'},
    content: 'card 0'
  },
  {
    image: {uri: 'https://hellorfimg.zcool.cn/preview260/267756197.jpg'},
    content: 'card 1'
  },
  {
    image: {uri: 'https://hellorfimg.zcool.cn/preview260/409679020.jpg'},
    content: 'card 2'
  },
  {
    image: {uri: 'https://hellorfimg.zcool.cn/preview260/682966966.jpg'},
    content: 'card 3'
  }
];

export class Demo extends React.Component {

  _renderCardContent = (item, index) => {
    return <Image style={styles.cardImage} source={item.image}/>;
  };

  _renderPopupLayerContent = (item, index) => {
    return <Text>{item.content}</Text>;
  };

  render() {
    return (
      <MagicMoving
        data={mockedData}
        cardStyle={styles.cardContainer}
        renderCardContent={this._renderCardContent}
        renderPopupLayerContent={this._renderPopupLayerContent}
      />
    );
  }
}

const styles = StyleSheet.create({
  cardContainer: {
    marginTop: 20,
    marginHorizontal: 20
  },
  cardImage: {
    width: 335,
    height: 200
  }
});

In the example above, the content of popup layer is ready before it shows. If you want to read it asynchronously from the network, you can see the demo2 (click here).

In fact, you can do much things as MagicMoving offers 3 methods for you: onPopupLayerWillShow, onPopupLayerDidShow, onPopupLayerDidHide.

3. Properties

|Prop|Default|Type|Description| |:----|:-------|:----|:-----------| |style|-|object|allow custom list| |cardStyle|-|object|allow custom list card| |data|[]|array|data source of list| |openDuration|300|number|duration of showing popup layer animation| |closeDuration|300|number|duration of closing popup layer animation| |renderCardContent|-|function|complete control how to render the content of list card| |renderPopupLayerContent|-|function|complete control how to render the content of popup layer| |renderPopupLayerBanner|-|function|you can custom the popup layer's banner using this function with params(bannerImageStyle)| |onPopupLayerWillShow|-|function|be called before popup layer showing| |onPopupLayerDidShow|-|function|be called after popup layer has shown| |onPopupLayerDidHide|-|function|be called after popup layer has hidden|