Socket
Socket
Sign inDemoInstall

@react-native-masked-view/masked-view

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-native-masked-view/masked-view

React Native MaskedView component


Version published
Maintainers
1
Created

What is @react-native-masked-view/masked-view?

@react-native-masked-view/masked-view is a React Native component that allows you to create masked views. This means you can define a mask that determines which parts of a child view are visible, enabling you to create complex visual effects.

What are @react-native-masked-view/masked-view's main functionalities?

Basic Masked View

This example demonstrates a basic masked view where the text 'Masked Text' acts as the mask. The blue background is only visible through the text.

import React from 'react';
import { View, Text } from 'react-native';
import MaskedView from '@react-native-masked-view/masked-view';

const BasicMaskedView = () => (
  <MaskedView
    style={{ flex: 1 }}
    maskElement={
      <View
        style={{
          backgroundColor: 'transparent',
          justifyContent: 'center',
          alignItems: 'center',
        }}
      >
        <Text
          style={{
            fontSize: 60,
            color: 'black',
            fontWeight: 'bold',
          }}
        >
          Masked Text
        </Text>
      </View>
    }
  >
    <View style={{ flex: 1, backgroundColor: 'blue' }} />
  </MaskedView>
);

export default BasicMaskedView;

Gradient Mask

This example shows how to use a gradient as a mask. The red background is gradually revealed through the gradient mask.

import React from 'react';
import { View, Text } from 'react-native';
import MaskedView from '@react-native-masked-view/masked-view';
import LinearGradient from 'react-native-linear-gradient';

const GradientMaskedView = () => (
  <MaskedView
    style={{ flex: 1 }}
    maskElement={
      <LinearGradient
        colors={['transparent', 'black']}
        style={{ flex: 1 }}
      />
    }
  >
    <View style={{ flex: 1, backgroundColor: 'red' }} />
  </MaskedView>
);

export default GradientMaskedView;

Other packages similar to @react-native-masked-view/masked-view

Keywords

FAQs

Package last updated on 20 Feb 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc