0.1.11 • Published 3 years ago

@react-native-community/masked-view v0.1.11

Weekly downloads
260,353
License
MIT
Repository
github
Last release
3 years ago

React Native MaskedView

Build Status Version MIT License Lean Core Badge

React Native MaskedView for iOS and Android.

Platforms Supported

  • iOS
  • Android

Note: React Native MaskedView is not currently supported by Expo unless you "eject".

Getting Started

$ yarn add @react-native-community/masked-view

or

$ npm install --save @react-native-community/masked-view

Using React Native >= 0.60

Linking the package manually is not required anymore with Autolinking.

  • iOS Platform:

    $ cd ios && pod install

Using React Native < 0.60

You then need to link the native parts of the library for the platforms you are using. The easiest way to link the library is using the CLI tool by running this command from the root of your project:

$ react-native link @react-native-community/masked-view

Usage

Import the MaskedView component from @react-native-community/masked-view and use it like so:

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

export default class App extends React.Component {
  render() {
    return (
      <MaskedView
        style={{ flex: 1, flexDirection: 'row', height: '100%' }}
        maskElement={
          <View
            style={{
              // Transparent background because mask is based off alpha channel.
              backgroundColor: 'transparent',
              flex: 1,
              justifyContent: 'center',
              alignItems: 'center'
            }}
          >
            <Text
              style={{
                fontSize: 60,
                color: 'black',
                fontWeight: 'bold'
              }}
            >
              Basic Mask
            </Text>
          </View>
        }
      >
        {/* Shows behind the mask, you can put anything here, such as an image */}
        <View style={{ flex: 1, height: '100%', backgroundColor: '#324376' }} />
        <View style={{ flex: 1, height: '100%', backgroundColor: '#F5DD90' }} />
        <View style={{ flex: 1, height: '100%', backgroundColor: '#F76C5E' }} />
        <View style={{ flex: 1, height: '100%', backgroundColor: '#e1e1e1' }} />
      </MaskedView>
    );
  }
}

The following image demonstrates that you can put almost anything behind the mask. The three examples shown are masked <View>, <Text>, and <Image>.

Props

Reference

Props

maskElement

TypeRequired
elementYes
@neur0base/app-sdkreact-native-sdafpeakcomponentspeak-custom-componentsassociacao-digital-completeassociacao-digital-widgetslashbracket-custom-expo-bare-templatereact-native-payment_testrijmaat-testing-uireact-native-payment1react-native-paymentpackagereact-native-payment_integrationtw-reactnativetemplatereact-native-twitter-clonehipposdkfirebase-expo-templatebestbet55@snooper/coregenesyschatpluginsommario-appcustomsreactnativecode-avenue-design-systemstestdemo007testdemo008react-native-template-workflowblindajecomic-packagesharpsports-mobile-linkreact-native-template-herbertdesousareact-native-diario-republica-modulern-diario-republica-modulei-invest-wealthsezzle-apploggin-appgenesyschatsdkvtex.loginreact-native-queue-online-sdk@bravemaster619/interview-uipublishtestformeinreactnativewebtestcomponent@toansajxuko/wowpay-react-native-sdkwowpay_react_nativeolx-mallreact-native-twilio-video-callkitreact-native-twilio-video-testreact-native-video-call-v1iusify-module-codigos_ptiusify-module-diario-republicaiusify-module-iuslexmira-test-3tinh-mirareact-native-isw-starterhotqa-sdkreact-native-wocode-frameworkairasia1222momo-component-kitsexpo-template-stack-navigatorexpo-template-bottom-navigatorairmoddictionarymacmillaninterpro-calendarcore-native-boilerplategkashpaysdk1ki-smart-base-rnraodaor-appraodaor-app-poetryraodaor-app1wowpay-reactnative-sdkcorbeappzen-modulecorbeta@infinitebrahmanuniverse/nolb-_react-nreact-native-template-expo-darknlightordering-ui-react-native@everything-registry/sub-chunk-765@armiasystems/react-native-armia-chat-sdk@akalli/create-akalli-app@consento/expo-export@ctrl-mota/expo-templatecollegekonnectconcise-conversecompany-auth-appcompany-react-native-common@bigbinary/neeto-commons-rn@bluebase/plugin-react-navigation@cake-fxd/rn-case@cake-fxd/rn-elementspuzzl-contractor-onboardingpuzzl-react-native-onboardingpuzzl-rn-onboardingpuzzl-w2-onboardingrahulghagtest2rahulghagtest3rahulghagtest1rapi-miniappproduct-home-mini-appproduct-conta-extrato-mini-appproduct-conta-pagamento-mini-appproduct-conta-saldo-mini-appproduct-conta-transferencia-mini-appproduct-user-profile-mini-app
0.1.11

3 years ago

0.1.10

4 years ago

0.1.9

4 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago