@abeman/react-native-nitro-blur 0.1.2 → 0.1.3
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/package.json +3 -1
- package/lib/commonjs/NitroBlur.nitro.js +0 -6
- package/lib/commonjs/NitroBlur.nitro.js.map +0 -1
- package/lib/commonjs/NitroBlurTarget.nitro.js +0 -6
- package/lib/commonjs/NitroBlurTarget.nitro.js.map +0 -1
- package/lib/commonjs/index.js +0 -119
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/package.json +0 -1
package/package.json
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abeman/react-native-nitro-blur",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Blur view",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
|
+
"react-native": "./src/index.tsx",
|
|
7
|
+
"source": "./src/index.tsx",
|
|
6
8
|
"types": "./lib/typescript/src/index.d.ts",
|
|
7
9
|
"exports": {
|
|
8
10
|
".": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../src","sources":["NitroBlur.nitro.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../src","sources":["NitroBlurTarget.nitro.ts"],"mappings":"","ignoreList":[]}
|
package/lib/commonjs/index.js
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.BlurView = exports.BlurTargetView = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
var _reactNativeNitroModules = require("react-native-nitro-modules");
|
|
10
|
-
var _NitroBlurConfig = _interopRequireDefault(require("../nitrogen/generated/shared/json/NitroBlurConfig.json"));
|
|
11
|
-
var _NitroBlurTargetConfig = _interopRequireDefault(require("../nitrogen/generated/shared/json/NitroBlurTargetConfig.json"));
|
|
12
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
const NativeBlurView = (0, _reactNativeNitroModules.getHostComponent)('NitroBlur', () => _NitroBlurConfig.default);
|
|
15
|
-
const NativeBlurTargetView = (0, _reactNativeNitroModules.getHostComponent)('NitroBlurTarget', () => _NitroBlurTargetConfig.default);
|
|
16
|
-
|
|
17
|
-
// ----- BlurViewProps -----
|
|
18
|
-
|
|
19
|
-
// ----- BlurView -----
|
|
20
|
-
|
|
21
|
-
class BlurView extends _react.default.Component {
|
|
22
|
-
constructor(props) {
|
|
23
|
-
super(props);
|
|
24
|
-
this.state = {
|
|
25
|
-
blurTargetId: undefined
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
componentDidMount() {
|
|
29
|
-
this._updateBlurTargetId();
|
|
30
|
-
this._maybeWarnAboutBlurMethod();
|
|
31
|
-
if (this.props.experimentalBlurMethod != null) {
|
|
32
|
-
console.warn('The `experimentalBlurMethod` prop has been deprecated. Please use the `blurMethod` prop instead.');
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
componentDidUpdate(prevProps) {
|
|
36
|
-
if (prevProps.blurTarget?.current !== this.props.blurTarget?.current) {
|
|
37
|
-
this._updateBlurTargetId();
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
_maybeWarnAboutBlurMethod() {
|
|
41
|
-
const blurMethod = this._getBlurMethod();
|
|
42
|
-
if (_reactNative.Platform.OS === 'android' && (blurMethod === 'dimezisBlurView' || blurMethod === 'dimezisBlurViewSdk31Plus') && !this.props.blurTarget) {
|
|
43
|
-
// The fallback happens on the native side
|
|
44
|
-
console.warn(`You have selected the "${blurMethod}" blur method, but the \`blurTarget\` prop has not been configured. The blur view will fallback to "none" blur method to avoid errors.`);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
_updateBlurTargetId = () => {
|
|
48
|
-
const blurTarget = this.props.blurTarget?.current;
|
|
49
|
-
const blurTargetId = blurTarget ? (0, _reactNative.findNodeHandle)(blurTarget) : undefined;
|
|
50
|
-
this.setState(() => ({
|
|
51
|
-
blurTargetId
|
|
52
|
-
}));
|
|
53
|
-
};
|
|
54
|
-
_getBlurMethod() {
|
|
55
|
-
const providedMethod = this.props.blurMethod ?? this.props.experimentalBlurMethod;
|
|
56
|
-
return providedMethod ?? 'none';
|
|
57
|
-
}
|
|
58
|
-
render() {
|
|
59
|
-
const {
|
|
60
|
-
tint = 'default',
|
|
61
|
-
intensity = 30,
|
|
62
|
-
blurReductionFactor = 4,
|
|
63
|
-
style,
|
|
64
|
-
children,
|
|
65
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
66
|
-
blurTarget,
|
|
67
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
68
|
-
blurMethod,
|
|
69
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
70
|
-
experimentalBlurMethod,
|
|
71
|
-
...props
|
|
72
|
-
} = this.props;
|
|
73
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
74
|
-
...props,
|
|
75
|
-
style: [styles.container, style],
|
|
76
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(NativeBlurView, {
|
|
77
|
-
blurTargetId: this.state.blurTargetId ?? 0,
|
|
78
|
-
tint: tint,
|
|
79
|
-
intensity: intensity,
|
|
80
|
-
blurReductionFactor: blurReductionFactor,
|
|
81
|
-
blurMethod: this._getBlurMethod(),
|
|
82
|
-
style: _reactNative.StyleSheet.absoluteFill
|
|
83
|
-
}), children]
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
exports.BlurView = BlurView;
|
|
88
|
-
const styles = _reactNative.StyleSheet.create({
|
|
89
|
-
container: {
|
|
90
|
-
backgroundColor: 'transparent'
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
// ----- BlurTargetView -----
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* A container view that can be used as a blur target on Android.
|
|
98
|
-
* Wrap the content you want to blur with this view, then pass
|
|
99
|
-
* a ref to it via the `blurTarget` prop of `BlurView`.
|
|
100
|
-
*
|
|
101
|
-
* On iOS, this is just a regular View since UIVisualEffectView
|
|
102
|
-
* naturally blurs whatever is behind it.
|
|
103
|
-
*/
|
|
104
|
-
const BlurTargetView = exports.BlurTargetView = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
105
|
-
if (_reactNative.Platform.OS === 'android') {
|
|
106
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(NativeBlurTargetView, {
|
|
107
|
-
...props,
|
|
108
|
-
ref: ref
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
112
|
-
...props,
|
|
113
|
-
ref: ref,
|
|
114
|
-
collapsable: false
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
// ----- Exports -----
|
|
119
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_reactNativeNitroModules","_NitroBlurConfig","_NitroBlurTargetConfig","_jsxRuntime","e","__esModule","default","NativeBlurView","getHostComponent","NitroBlurConfig","NativeBlurTargetView","NitroBlurTargetConfig","BlurView","React","Component","constructor","props","state","blurTargetId","undefined","componentDidMount","_updateBlurTargetId","_maybeWarnAboutBlurMethod","experimentalBlurMethod","console","warn","componentDidUpdate","prevProps","blurTarget","current","blurMethod","_getBlurMethod","Platform","OS","findNodeHandle","setState","providedMethod","render","tint","intensity","blurReductionFactor","style","children","jsxs","View","styles","container","jsx","StyleSheet","absoluteFill","exports","create","backgroundColor","BlurTargetView","forwardRef","ref","collapsable"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAOA,IAAAE,wBAAA,GAAAF,OAAA;AAYA,IAAAG,gBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,sBAAA,GAAAL,sBAAA,CAAAC,OAAA;AAAiG,IAAAK,WAAA,GAAAL,OAAA;AAAA,SAAAD,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEjG,MAAMG,cAAc,GAAG,IAAAC,yCAAgB,EACrC,WAAW,EACX,MAAMC,wBACR,CAAC;AAED,MAAMC,oBAAoB,GAAG,IAAAF,yCAAgB,EAG3C,iBAAiB,EAAE,MAAMG,8BAAqB,CAAC;;AAEjD;;AAyDA;;AAMO,MAAMC,QAAQ,SAASC,cAAK,CAACC,SAAS,CAA+B;EAC1EC,WAAWA,CAACC,KAAoB,EAAE;IAChC,KAAK,CAACA,KAAK,CAAC;IACZ,IAAI,CAACC,KAAK,GAAG;MACXC,YAAY,EAAEC;IAChB,CAAC;EACH;EAEAC,iBAAiBA,CAAA,EAAS;IACxB,IAAI,CAACC,mBAAmB,CAAC,CAAC;IAC1B,IAAI,CAACC,yBAAyB,CAAC,CAAC;IAEhC,IAAI,IAAI,CAACN,KAAK,CAACO,sBAAsB,IAAI,IAAI,EAAE;MAC7CC,OAAO,CAACC,IAAI,CACV,kGACF,CAAC;IACH;EACF;EAEAC,kBAAkBA,CAACC,SAAkC,EAAQ;IAC3D,IAAIA,SAAS,CAACC,UAAU,EAAEC,OAAO,KAAK,IAAI,CAACb,KAAK,CAACY,UAAU,EAAEC,OAAO,EAAE;MACpE,IAAI,CAACR,mBAAmB,CAAC,CAAC;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