2.1.1 • Published 3 years ago

react-native-fade v2.1.1

Weekly downloads
582
License
MIT
Repository
github
Last release
3 years ago

react-native-fade

A wrapper component to fade its children in and out based on a boolean.

Fade example gif

Installation

# yarn
yarn add react-native-fade

# npm
npm install react-native-fade --save

Then, import with:

import Fade from 'react-native-fade';

Note: You may also need to install react-native-reanimated.

Usage

Example:

import React, { useState } from 'react';
import { StyleSheet, Text, View, Button } from 'react-native';
import Fade from 'react-native-fade';

export default function App() {
  const [visible, setVisible] = useState(false);
  return (
    <View>
      <Button
        onPress={() => setVisible(!visible)}
        title={visible ? 'Hide text' : 'Show text'}
      />
      <Fade visible={visible} direction="up">
        <Text>I fade in</Text>
      </Fade>
    </View>
  );
}

You can see a full example app inside the /example folder!

Props

PropRequired?TypeDescription
visiblefalsebooleanShow the children of <Fade>.
directionfalsestringCan be "up" or "down". When the child component fades in there's an optional subtle translation that you can apply with "up" or "down".
durationfalsenumberThe amount of time in milliseconds the fade transition should take.
stylefalseReact Native Style or ObjectApplies style a view around the faded child components
2.1.1

3 years ago

2.1.0

3 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

2.0.0-beta.0

4 years ago

1.0.3

5 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago