@react-native-gpui/masked-view 0.0.0-stage → 0.3.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/LICENSE +21 -0
- package/README.md +40 -2
- package/package.json +34 -4
- package/react-native.config.js +13 -0
- package/src/MaskedView.desktop.js +34 -0
- package/src/RNCMaskedViewNativeComponent.ts +8 -0
- package/src/index.ts +1 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@react-native-gpui/masked-view` are listed here. Each version's section becomes the notes of its GitHub release.
|
|
4
|
+
|
|
5
|
+
## 0.3.0-alpha.1 - 2026-11-27
|
|
6
|
+
|
|
7
|
+
- First release, for `@react-native-masked-view/masked-view` 0.3.x: shows the children through the alpha of the mask element.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Streetwriters
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,41 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @react-native-gpui/masked-view
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Adapter for [`@react-native-masked-view/masked-view`](https://github.com/react-native-masked-view/masked-view) (MIT): shows the children of a view only where a mask element paints.
|
|
4
|
+
|
|
5
|
+
## About
|
|
6
|
+
|
|
7
|
+
This package is the desktop adapter for [`@react-native-masked-view/masked-view`](https://github.com/react-native-masked-view/masked-view) 0.3. Install the original library next to it; its JavaScript API is unchanged and this package provides the desktop side. The upstream library is licensed under the MIT license.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npm install @react-native-masked-view/masked-view @react-native-gpui/masked-view
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The module is autolinked on desktop.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
import MaskedView from '@react-native-masked-view/masked-view';
|
|
21
|
+
|
|
22
|
+
<MaskedView maskElement={<Text style={{ fontSize: 60 }}>Mask</Text>}>
|
|
23
|
+
<View style={{ flex: 1, backgroundColor: '#2563eb' }} />
|
|
24
|
+
</MaskedView>;
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Platforms
|
|
28
|
+
|
|
29
|
+
macOS is tested. Windows and Linux are not tested yet.
|
|
30
|
+
|
|
31
|
+
## Supported
|
|
32
|
+
|
|
33
|
+
The children show only where the mask element paints, scaled by its alpha. The mask takes no pointer events and is hidden from the accessibility tree.
|
|
34
|
+
|
|
35
|
+
## Limitations
|
|
36
|
+
|
|
37
|
+
The view's own background and border are not masked. `androidRenderingMode` is ignored.
|
|
38
|
+
|
|
39
|
+
## License
|
|
40
|
+
|
|
41
|
+
MIT. See [LICENSE](LICENSE). The upstream library, [`@react-native-masked-view/masked-view`](https://github.com/react-native-masked-view/masked-view), is MIT licensed.
|
package/package.json
CHANGED
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-gpui/masked-view",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.3.0-alpha.1",
|
|
4
|
+
"description": "Adapter for @react-native-masked-view/masked-view (MIT): shows children through the alpha of a mask on the desktop renderer",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"src",
|
|
9
|
+
"react-native.config.js",
|
|
10
|
+
"README.md",
|
|
11
|
+
"CHANGELOG.md",
|
|
12
|
+
"LICENSE"
|
|
13
|
+
],
|
|
14
|
+
"codegenConfig": {
|
|
15
|
+
"name": "RNGpuiMaskedViewSpec",
|
|
16
|
+
"type": "components",
|
|
17
|
+
"jsSrcsDir": "src"
|
|
18
|
+
},
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"react-native": "0.87.x",
|
|
21
|
+
"@react-native-masked-view/masked-view": "0.3.x"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/streetwriters/react-native-gpui-modules.git",
|
|
26
|
+
"directory": "modules/masked-view"
|
|
27
|
+
},
|
|
28
|
+
"homepage": "https://github.com/streetwriters/react-native-gpui-modules/tree/main/modules/masked-view#readme",
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://github.com/streetwriters/react-native-gpui-modules/issues"
|
|
31
|
+
},
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public",
|
|
34
|
+
"tag": "latest"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
dependency: {
|
|
3
|
+
platforms: {
|
|
4
|
+
desktop: {
|
|
5
|
+
hostComponents: [{ name: 'RNCMaskedView', maskChildren: true }],
|
|
6
|
+
sourceOverrides: {
|
|
7
|
+
'@react-native-masked-view/masked-view/js/MaskedView.js':
|
|
8
|
+
'./src/MaskedView.desktop.js',
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { View, StyleSheet } from 'react-native';
|
|
3
|
+
import RNCMaskedView from './RNCMaskedViewNativeComponent';
|
|
4
|
+
|
|
5
|
+
export default class MaskedView extends React.Component {
|
|
6
|
+
_hasWarnedInvalidRenderMask = false;
|
|
7
|
+
|
|
8
|
+
render() {
|
|
9
|
+
const { maskElement, children, androidRenderingMode, ...otherViewProps } =
|
|
10
|
+
this.props;
|
|
11
|
+
|
|
12
|
+
if (!React.isValidElement(maskElement)) {
|
|
13
|
+
if (!this._hasWarnedInvalidRenderMask) {
|
|
14
|
+
console.warn(
|
|
15
|
+
'MaskedView: Invalid `maskElement` prop was passed to MaskedView. ' +
|
|
16
|
+
'Expected a React Element. No mask will render.',
|
|
17
|
+
);
|
|
18
|
+
this._hasWarnedInvalidRenderMask = true;
|
|
19
|
+
}
|
|
20
|
+
return React.createElement(View, otherViewProps, children);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return React.createElement(
|
|
24
|
+
RNCMaskedView,
|
|
25
|
+
otherViewProps,
|
|
26
|
+
React.createElement(
|
|
27
|
+
View,
|
|
28
|
+
{ pointerEvents: 'none', style: StyleSheet.absoluteFill },
|
|
29
|
+
maskElement,
|
|
30
|
+
),
|
|
31
|
+
children,
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { HostComponent, ViewProps } from 'react-native';
|
|
2
|
+
import { codegenNativeComponent } from 'react-native';
|
|
3
|
+
|
|
4
|
+
export interface NativeProps extends ViewProps {}
|
|
5
|
+
|
|
6
|
+
export default codegenNativeComponent<NativeProps>('RNCMaskedView', {
|
|
7
|
+
interfaceOnly: true,
|
|
8
|
+
}) as HostComponent<NativeProps>;
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|