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-masked-animated-view

v1.1.1

Published

A React Native component for creating masked animations

Downloads

12

Readme

react-native-masked-animated-view

A React Native component for creating masked animations.

Installation

To install the package, use npm or yarn:

npm install react-native-masked-animated-view @react-native-masked-view/masked-view

or

yarn add react-native-masked-animated-view @react-native-masked-view/masked-view

Additional Setup for iOS

If you're using this library in an iOS project, make sure to navigate to the ios directory and run pod install to install the necessary CocoaPods dependencies:

cd ios
pod install

Usage

Here's a basic example of how to use MaskedAnimatedView in your React Native project.

import React, {useState} from 'react';
import {
  StyleSheet,
  SafeAreaView,
  View,
  Text,
  Image,
  Pressable,
  StatusBar,
} from 'react-native';
import {
  MaskedAnimatedView,
  MAVAnimationState,
} from 'react-native-masked-animated-view';

const maskItem = require('./path/to/your/maskItem.png');

const App = () => {
  const [animationState, setAnimationState] = useState(
    MAVAnimationState.LOADED,
  );

  const renderMaskItem = () => (
    <View style={styles.maskItemContainer}>
      <Text style={styles.enterText}>ENTER</Text>
      <Image source={maskItem} style={styles.maskItemImage} />
    </View>
  );

  const handlePress = () => {
    setAnimationState(
      animationState === MAVAnimationState.LOADING
        ? MAVAnimationState.LOADED
        : MAVAnimationState.LOADING,
    );
  };

  return (
    <SafeAreaView style={styles.container}>
      <StatusBar backgroundColor="black" barStyle="light-content" />
      <Pressable style={styles.button} onPress={handlePress}>
        <MaskedAnimatedView
          animationState={animationState}
          backgroundColor="green"
          maskItem={renderMaskItem()}
          maskElementStyle={{}}>
          <View style={styles.innerView} />
        </MaskedAnimatedView>
      </Pressable>
    </SafeAreaView>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
  button: {
    flex: 1,
  },
  maskItemContainer: {
    alignItems: 'center',
    justifyContent: 'center',
  },
  enterText: {
    fontSize: 20,
    color: 'black',
    fontWeight: 'bold',
  },
  maskItemImage: {
    width: 150,
    height: 150,
  },
  innerView: {
    flex: 1,
    backgroundColor: 'black',
  },
});

export default App;

For more detailed example, please refer to the example directory in the repository.

Props

| Prop Name | Type | Default | Description | |----------------------|----------|-----------------|-----------------------------------------------------------------------------------------------| | children | node | null | The content to be masked by the animated view. | | animationState | enum | MAVAnimationState.LOADING | The state of the animation. Can be MAVAnimationState.LOADING or MAVAnimationState.LOADED. | | maskItem | ReactNode | null | The item to be used as the mask (e.g., an image or a custom component). | | backgroundColor | string | black | The background color of the view. | | maskColor | string | white | The color of the mask element's background. | | maskElementStyle | object | { height: 80, width: 80 } | The style of the mask element. |

Animation States

The animationState prop controls the state of the animation. It can have the following values:

  • LOADING: The animation is in the loading state.
  • LOADED: The animation is in the loaded state.

Development

If you want to contribute or run the example project, follow these steps:

  1. Clone the repository:
git clone https://github.com/orcunorcun/react-native-masked-animated-view.git
cd react-native-masked-animated-view
  1. Install dependencies:
npm install
cd example
npm install
  1. Run the example project:
npm start

License

MIT