0.0.1 • Published 10 months ago

react-native-revolver v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

React Native Revolver

A pure JavaScript component supporting revolving animation

Installation

npm install --save react-native-revolver
or
yarn add react-native-revolver

Usage

import Revolver from 'react-native-revolver';

const ExampleWithTexts = () => {
  return (
    <Revolver
      data={[
        'Is this the real life?',
        'Is this just fantasy?',
        'Caught in a landside, no escape from reality',
      ]}
    />
  )
}

const ExampleWithElements = () => {
  return (
    <Revolver
      data={[
        <View
          key={1}
          style={{
            width: 100,
            height: 15,
            backgroundColor: 'pink',
          }}
        />,
        <Text key={2}>Is this the real life? Is this just fantasy?</Text>,
        <Text key={3} style={{ color: 'green' }}>
          Caught in a landside, no escape from reality
        </Text>
      ]}
    />
  )
}

Properties

Revolver component inherits ViewProps and the followings are configurable:

PropTypeRequiredDefaultDescription
datastring[] or ReactElement[]trueitems to animate
directionup or downfalseupthe direction of sliding animation
delaynumber (ms)false3000delay between animations
durationnumber (ms)false600duration of the sliding animation
textPropsTextPropsfalseif items are string, this textProps will apply to all items

Contribution

Do you have any idea or want to change something? Just open an issue. Contributions are always welcome.