Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/react-native-masked-view/masked-view
React Native Masked View Library
https://github.com/react-native-masked-view/masked-view
hacktoberfest masked-view react-native
Last synced: 3 months ago
JSON representation
React Native Masked View Library
- Host: GitHub
- URL: https://github.com/react-native-masked-view/masked-view
- Owner: react-native-masked-view
- License: mit
- Created: 2019-02-07T10:42:47.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-05-20T08:42:04.000Z (6 months ago)
- Last Synced: 2024-07-27T18:29:02.675Z (4 months ago)
- Topics: hacktoberfest, masked-view, react-native
- Language: JavaScript
- Homepage:
- Size: 1.26 MB
- Stars: 948
- Watchers: 10
- Forks: 114
- Open Issues: 51
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# React Native `MaskedView`
[![Build Status][build-badge]][build]
[![Version][version-badge]][package]
[![MIT License][license-badge]][license]
[![Lean Core Badge][lean-core-badge]][lean-core-issue]Provides a React component that renders a masked view.
## Platforms Supported
- [x] iOS
- [x] Android
- [ ] Web## Getting Started
```sh
yarn add @react-native-masked-view/masked-view
```or
```sh
npm install --save @react-native-masked-view/masked-view
```### Using React Native >= 0.60
Linking the package manually is not required anymore with [Autolinking](https://github.com/react-native-masked-view/cli/blob/master/docs/autolinking.md).
Remember to install the pod with:
```sh
npx 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:
```sh
react-native link @react-native-masked-view/masked-view
```## Usage
Import the `MaskedView` component from `@react-native-masked-view/masked-view` and use it like so:
```jsx
import React from 'react';
import { Text, View } from 'react-native';
import MaskedView from '@react-native-masked-view/masked-view';const App = () => {
return (
Basic Mask
}
>
{/* Shows behind the mask, you can put anything here, such as an image */}
);
}export default App
```The following image demonstrates that you can put almost anything behind the mask. The three examples shown are masked ``, ``, and ``.
### Props
- [View props...](https://github.com/facebook/react-native-website/blob/master/docs/view.md#props)
- [`maskElement`](#maskelement)
- [`androidRenderingMode`](#androidrenderingmode)
### Reference
### `maskElement`
| Type | Required |
| ------- | -------- |
| element | Yes |### `androidRenderingMode`
By default `hardware` rendering mode will be used for best performance, however if you need to animate your `maskElement` then you’ll need to switch to `software` to get your mask to update. This prop only affects Android.
| Type | Required | Default |
| ---------------------- | -------- | ---------- |
| `software`, `hardware` | No | `hardware` |[build-badge]: https://github.com/react-native-masked-view/masked-view/workflows/Build/badge.svg
[build]: https://github.com/react-native-masked-view/masked-view/actions
[version-badge]: https://img.shields.io/npm/v/@react-native-masked-view/masked-view.svg?style=flat-square
[package]: https://www.npmjs.com/package/@react-native-masked-view/masked-view
[license-badge]: https://img.shields.io/npm/l/@react-native-masked-view/masked-view.svg?style=flat-square
[license]: https://opensource.org/licenses/MIT
[lean-core-badge]: https://img.shields.io/badge/Lean%20Core-Extracted-brightgreen.svg?style=flat-square
[lean-core-issue]: https://github.com/facebook/react-native/issues/23313