@oxyhq/bloom 0.58.0 → 0.58.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/lib/commonjs/overlay/index.js +13 -4
- package/lib/commonjs/overlay/index.js.map +1 -1
- package/lib/module/overlay/index.js +14 -5
- package/lib/module/overlay/index.js.map +1 -1
- package/lib/typescript/commonjs/overlay/index.d.ts +2 -2
- package/lib/typescript/commonjs/overlay/index.d.ts.map +1 -1
- package/lib/typescript/module/overlay/index.d.ts +2 -2
- package/lib/typescript/module/overlay/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/overlay-pointer-events.test.tsx +24 -0
- package/src/overlay/index.tsx +26 -14
|
@@ -83,7 +83,7 @@ OverlayRoot.displayName = 'OverlayRoot';
|
|
|
83
83
|
* pointer events (that is its whole job), so anything that must stay pressable
|
|
84
84
|
* goes INSIDE it as `children`, never as a sibling rendered over it.
|
|
85
85
|
*/
|
|
86
|
-
const Backdrop = exports.Backdrop = /*#__PURE__*/(0, _react.memo)(function Backdrop({
|
|
86
|
+
const Backdrop = exports.Backdrop = /*#__PURE__*/(0, _react.memo)(/*#__PURE__*/(0, _react.forwardRef)(function Backdrop({
|
|
87
87
|
onPress,
|
|
88
88
|
disabled = false,
|
|
89
89
|
blurIntensity = BACKDROP_BLUR_INTENSITY,
|
|
@@ -94,9 +94,17 @@ const Backdrop = exports.Backdrop = /*#__PURE__*/(0, _react.memo)(function Backd
|
|
|
94
94
|
children,
|
|
95
95
|
accessibilityLabel = 'Dismiss',
|
|
96
96
|
testID
|
|
97
|
-
}) {
|
|
97
|
+
}, ref) {
|
|
98
98
|
const inert = disabled || !onPress;
|
|
99
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable
|
|
99
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable
|
|
100
|
+
// MUST forward the ref: surfaces animate the backdrop through
|
|
101
|
+
// `Animated.createAnimatedComponent(Backdrop)`, and reanimated applies
|
|
102
|
+
// those updates by reaching the underlying host view. With the ref
|
|
103
|
+
// swallowed the animated style never lands, so a backdrop whose opacity
|
|
104
|
+
// is animated from 0 stays at 0 — fully transparent, with the surface
|
|
105
|
+
// floating over an undimmed app.
|
|
106
|
+
, {
|
|
107
|
+
ref: ref,
|
|
100
108
|
pointerEvents: "auto",
|
|
101
109
|
onPress: inert ? undefined : onPress,
|
|
102
110
|
disabled: inert
|
|
@@ -126,7 +134,8 @@ const Backdrop = exports.Backdrop = /*#__PURE__*/(0, _react.memo)(function Backd
|
|
|
126
134
|
}]
|
|
127
135
|
}), children]
|
|
128
136
|
});
|
|
129
|
-
});
|
|
137
|
+
}));
|
|
138
|
+
Backdrop.displayName = 'Backdrop';
|
|
130
139
|
const styles = _reactNative.StyleSheet.create({
|
|
131
140
|
root: {
|
|
132
141
|
// Web: the portal root is `fixed; inset: 0`, but a plain absolute child of
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_expoBlur","_reactNative","_webViewStyle","_jsxRuntime","BACKDROP_BLUR_INTENSITY","exports","BACKDROP_DIM_OPACITY","OverlayRoot","children","style","testID","jsx","View","pointerEvents","styles","root","displayName","Backdrop","memo","onPress","disabled","blurIntensity","blurTint","dimColor","dimOpacity","accessibilityLabel","inert","jsxs","Pressable","undefined","focusable","accessibilityRole","StyleSheet","absoluteFill","BlurView","intensity","tint","experimentalBlurMethod","backgroundColor","opacity","create","position","Platform","OS","WEB_POSITION_FIXED","top","left","right","bottom"],"sourceRoot":"../../../src","sources":["overlay/index.tsx"],"mappings":";;;;;;;AAyCA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AASA,IAAAG,aAAA,GAAAH,OAAA;AAA8D,IAAAI,WAAA,GAAAJ,OAAA;AApD9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAcA;AACA;AACA;AACA;AACO,MAAMK,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAG,EAAE;AACzC;AACO,MAAME,oBAAoB,GAAAD,OAAA,CAAAC,oBAAA,GAAG,IAAI;AAQxC;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,WAAWA,CAAC;EAAEC,QAAQ;EAAEC,KAAK;EAAEC;AAAyB,CAAC,EAAE;EACzE,oBACE,IAAAP,WAAA,CAAAQ,GAAA,EAACV,YAAA,CAAAW,IAAI;IAACC,aAAa,EAAC,UAAU;IAACJ,KAAK,EAAE,CAACK,MAAM,CAACC,IAAI,EAAEN,KAAK,CAAE;IAACC,MAAM,EAAEA,MAAO;IAAAF,QAAA,EACxEA;EAAQ,CACL,CAAC;AAEX;AAEAD,WAAW,CAACS,WAAW,GAAG,aAAa;AAuBvC;AACA;AACA;AACA;AACA;AACO,MAAMC,QAAQ,GAAAZ,OAAA,CAAAY,QAAA,gBAAG,IAAAC,WAAI,
|
|
1
|
+
{"version":3,"names":["_react","require","_expoBlur","_reactNative","_webViewStyle","_jsxRuntime","BACKDROP_BLUR_INTENSITY","exports","BACKDROP_DIM_OPACITY","OverlayRoot","children","style","testID","jsx","View","pointerEvents","styles","root","displayName","Backdrop","memo","forwardRef","onPress","disabled","blurIntensity","blurTint","dimColor","dimOpacity","accessibilityLabel","ref","inert","jsxs","Pressable","undefined","focusable","accessibilityRole","StyleSheet","absoluteFill","BlurView","intensity","tint","experimentalBlurMethod","backgroundColor","opacity","create","position","Platform","OS","WEB_POSITION_FIXED","top","left","right","bottom"],"sourceRoot":"../../../src","sources":["overlay/index.tsx"],"mappings":";;;;;;;AAyCA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,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,KAAK,KAAK,GAAGC,gCAAkB,GAAG,UAAU;IACjEC,GAAG,EAAE,CAAC;IACNC,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE;EACV;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
* Use `<OverlayRoot>` for the surface's outermost node and `<Backdrop>` for its
|
|
42
42
|
* dimming layer; do not re-implement either with raw `View`s.
|
|
43
43
|
*/
|
|
44
|
-
import { memo } from 'react';
|
|
44
|
+
import { forwardRef, memo } from 'react';
|
|
45
45
|
import { BlurView } from 'expo-blur';
|
|
46
46
|
import { Platform, Pressable, StyleSheet, View } from 'react-native';
|
|
47
47
|
import { WEB_POSITION_FIXED } from "../styles/web-view-style.js";
|
|
@@ -78,7 +78,7 @@ OverlayRoot.displayName = 'OverlayRoot';
|
|
|
78
78
|
* pointer events (that is its whole job), so anything that must stay pressable
|
|
79
79
|
* goes INSIDE it as `children`, never as a sibling rendered over it.
|
|
80
80
|
*/
|
|
81
|
-
export const Backdrop = /*#__PURE__*/memo(function Backdrop({
|
|
81
|
+
export const Backdrop = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function Backdrop({
|
|
82
82
|
onPress,
|
|
83
83
|
disabled = false,
|
|
84
84
|
blurIntensity = BACKDROP_BLUR_INTENSITY,
|
|
@@ -89,9 +89,17 @@ export const Backdrop = /*#__PURE__*/memo(function Backdrop({
|
|
|
89
89
|
children,
|
|
90
90
|
accessibilityLabel = 'Dismiss',
|
|
91
91
|
testID
|
|
92
|
-
}) {
|
|
92
|
+
}, ref) {
|
|
93
93
|
const inert = disabled || !onPress;
|
|
94
|
-
return /*#__PURE__*/_jsxs(Pressable
|
|
94
|
+
return /*#__PURE__*/_jsxs(Pressable
|
|
95
|
+
// MUST forward the ref: surfaces animate the backdrop through
|
|
96
|
+
// `Animated.createAnimatedComponent(Backdrop)`, and reanimated applies
|
|
97
|
+
// those updates by reaching the underlying host view. With the ref
|
|
98
|
+
// swallowed the animated style never lands, so a backdrop whose opacity
|
|
99
|
+
// is animated from 0 stays at 0 — fully transparent, with the surface
|
|
100
|
+
// floating over an undimmed app.
|
|
101
|
+
, {
|
|
102
|
+
ref: ref,
|
|
95
103
|
pointerEvents: "auto",
|
|
96
104
|
onPress: inert ? undefined : onPress,
|
|
97
105
|
disabled: inert
|
|
@@ -121,7 +129,8 @@ export const Backdrop = /*#__PURE__*/memo(function Backdrop({
|
|
|
121
129
|
}]
|
|
122
130
|
}), children]
|
|
123
131
|
});
|
|
124
|
-
});
|
|
132
|
+
}));
|
|
133
|
+
Backdrop.displayName = 'Backdrop';
|
|
125
134
|
const styles = StyleSheet.create({
|
|
126
135
|
root: {
|
|
127
136
|
// Web: the portal root is `fixed; inset: 0`, but a plain absolute child of
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["memo","BlurView","Platform","Pressable","StyleSheet","View","WEB_POSITION_FIXED","jsx","_jsx","jsxs","_jsxs","BACKDROP_BLUR_INTENSITY","BACKDROP_DIM_OPACITY","OverlayRoot","children","style","testID","pointerEvents","styles","root","displayName","Backdrop","onPress","disabled","blurIntensity","blurTint","dimColor","dimOpacity","accessibilityLabel","inert","undefined","focusable","accessibilityRole","absoluteFill","intensity","tint","experimentalBlurMethod","backgroundColor","opacity","create","position","OS","top","left","right","bottom"],"sourceRoot":"../../../src","sources":["overlay/index.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,IAAI,QAAwB,OAAO;
|
|
1
|
+
{"version":3,"names":["forwardRef","memo","BlurView","Platform","Pressable","StyleSheet","View","WEB_POSITION_FIXED","jsx","_jsx","jsxs","_jsxs","BACKDROP_BLUR_INTENSITY","BACKDROP_DIM_OPACITY","OverlayRoot","children","style","testID","pointerEvents","styles","root","displayName","Backdrop","onPress","disabled","blurIntensity","blurTint","dimColor","dimOpacity","accessibilityLabel","ref","inert","undefined","focusable","accessibilityRole","absoluteFill","intensity","tint","experimentalBlurMethod","backgroundColor","opacity","create","position","OS","top","left","right","bottom"],"sourceRoot":"../../../src","sources":["overlay/index.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,UAAU,EAAEC,IAAI,QAAwB,OAAO;AACxD,SAASC,QAAQ,QAAQ,WAAW;AACpC,SACEC,QAAQ,EACRC,SAAS,EACTC,UAAU,EACVC,IAAI,QAGC,cAAc;AAErB,SAASC,kBAAkB,QAAQ,6BAA0B;;AAE7D;AACA;AACA;AACA;AAHA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAIA,OAAO,MAAMC,uBAAuB,GAAG,EAAE;AACzC;AACA,OAAO,MAAMC,oBAAoB,GAAG,IAAI;AAQxC;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAAC;EAAEC,QAAQ;EAAEC,KAAK;EAAEC;AAAyB,CAAC,EAAE;EACzE,oBACER,IAAA,CAACH,IAAI;IAACY,aAAa,EAAC,UAAU;IAACF,KAAK,EAAE,CAACG,MAAM,CAACC,IAAI,EAAEJ,KAAK,CAAE;IAACC,MAAM,EAAEA,MAAO;IAAAF,QAAA,EACxEA;EAAQ,CACL,CAAC;AAEX;AAEAD,WAAW,CAACO,WAAW,GAAG,aAAa;AAuBvC;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,QAAQ,gBAAGrB,IAAI,cAACD,UAAU,CAAsB,S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AAC;AAEHO,QAAQ,CAACD,WAAW,GAAG,UAAU;AAEjC,MAAMF,MAAM,GAAGd,UAAU,CAACoC,MAAM,CAAC;EAC/BrB,IAAI,EAAE;IACJ;IACA;IACA;IACA;IACA;IACAsB,QAAQ,EAAEvC,QAAQ,CAACwC,EAAE,KAAK,KAAK,GAAGpC,kBAAkB,GAAG,UAAU;IACjEqC,GAAG,EAAE,CAAC;IACNC,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE;EACV;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
* dimming layer; do not re-implement either with raw `View`s.
|
|
41
41
|
*/
|
|
42
42
|
import { type ReactNode } from 'react';
|
|
43
|
-
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
43
|
+
import { View, type StyleProp, type ViewStyle } from 'react-native';
|
|
44
44
|
/**
|
|
45
45
|
* One blur radius for every Bloom overlay. Surfaces differ in what they show,
|
|
46
46
|
* not in how the app behind them recedes.
|
|
@@ -88,5 +88,5 @@ export interface BackdropProps {
|
|
|
88
88
|
* pointer events (that is its whole job), so anything that must stay pressable
|
|
89
89
|
* goes INSIDE it as `children`, never as a sibling rendered over it.
|
|
90
90
|
*/
|
|
91
|
-
export declare const Backdrop: import("react").NamedExoticComponent<BackdropProps
|
|
91
|
+
export declare const Backdrop: import("react").NamedExoticComponent<BackdropProps & import("react").RefAttributes<View>>;
|
|
92
92
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/overlay/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/overlay/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;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ement either with raw `View`s.
|
|
41
41
|
*/
|
|
42
42
|
import { type ReactNode } from 'react';
|
|
43
|
-
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
43
|
+
import { View, type StyleProp, type ViewStyle } from 'react-native';
|
|
44
44
|
/**
|
|
45
45
|
* One blur radius for every Bloom overlay. Surfaces differ in what they show,
|
|
46
46
|
* not in how the app behind them recedes.
|
|
@@ -88,5 +88,5 @@ export interface BackdropProps {
|
|
|
88
88
|
* pointer events (that is its whole job), so anything that must stay pressable
|
|
89
89
|
* goes INSIDE it as `children`, never as a sibling rendered over it.
|
|
90
90
|
*/
|
|
91
|
-
export declare const Backdrop: import("react").NamedExoticComponent<BackdropProps
|
|
91
|
+
export declare const Backdrop: import("react").NamedExoticComponent<BackdropProps & import("react").RefAttributes<View>>;
|
|
92
92
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/overlay/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/overlay/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,EAIL,IAAI,EACJ,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAItB;;;GAGG;AACH,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAC1C,6EAA6E;AAC7E,eAAO,MAAM,oBAAoB,OAAO,CAAC;AAEzC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,gBAAgB,2CAMxE;yBANe,WAAW;;;AAU3B,MAAM,WAAW,aAAa;IAC5B,gFAAgF;IAChF,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,iFAAiF;IACjF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6DAA6D;IAC7D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iFAAiF;IACjF,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;IACxC,gCAAgC;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wBAAwB;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2EAA2E;IAC3E,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,sFAAsF;IACtF,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,eAAO,MAAM,QAAQ,2FAuDlB,CAAC"}
|
package/package.json
CHANGED
|
@@ -123,6 +123,30 @@ describe('overlay pointer-events contract (web)', () => {
|
|
|
123
123
|
noBlur.container.remove();
|
|
124
124
|
});
|
|
125
125
|
|
|
126
|
+
// Surfaces animate the backdrop via `Animated.createAnimatedComponent(Backdrop)`,
|
|
127
|
+
// and reanimated writes those updates through the ref. Swallow it and an
|
|
128
|
+
// opacity animated from 0 never moves: the backdrop stays fully transparent
|
|
129
|
+
// while the surface floats over an undimmed app (shipped exactly once).
|
|
130
|
+
it('forwards its ref to a host node so animated styles can land', () => {
|
|
131
|
+
let node: unknown = null;
|
|
132
|
+
const { root, container } = render(
|
|
133
|
+
createElement(Backdrop, {
|
|
134
|
+
onPress: () => {},
|
|
135
|
+
testID: 'backdrop',
|
|
136
|
+
ref: (el: unknown) => {
|
|
137
|
+
node = el;
|
|
138
|
+
},
|
|
139
|
+
} as never),
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
expect(node).not.toBeNull();
|
|
143
|
+
expect(node).toBeInstanceOf(HTMLElement);
|
|
144
|
+
expect((node as HTMLElement).getAttribute('data-testid')).toBe('backdrop');
|
|
145
|
+
|
|
146
|
+
act(() => root.unmount());
|
|
147
|
+
container.remove();
|
|
148
|
+
});
|
|
149
|
+
|
|
126
150
|
it('a disabled Backdrop dims without dismissing', () => {
|
|
127
151
|
const onPress = jest.fn();
|
|
128
152
|
const { root, container } = render(
|
package/src/overlay/index.tsx
CHANGED
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
* Use `<OverlayRoot>` for the surface's outermost node and `<Backdrop>` for its
|
|
40
40
|
* dimming layer; do not re-implement either with raw `View`s.
|
|
41
41
|
*/
|
|
42
|
-
import { memo, type ReactNode } from 'react';
|
|
42
|
+
import { forwardRef, memo, type ReactNode } from 'react';
|
|
43
43
|
import { BlurView } from 'expo-blur';
|
|
44
44
|
import {
|
|
45
45
|
Platform,
|
|
@@ -108,21 +108,31 @@ export interface BackdropProps {
|
|
|
108
108
|
* pointer events (that is its whole job), so anything that must stay pressable
|
|
109
109
|
* goes INSIDE it as `children`, never as a sibling rendered over it.
|
|
110
110
|
*/
|
|
111
|
-
export const Backdrop = memo(function Backdrop(
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
111
|
+
export const Backdrop = memo(forwardRef<View, BackdropProps>(function Backdrop(
|
|
112
|
+
{
|
|
113
|
+
onPress,
|
|
114
|
+
disabled = false,
|
|
115
|
+
blurIntensity = BACKDROP_BLUR_INTENSITY,
|
|
116
|
+
blurTint = 'dark',
|
|
117
|
+
dimColor = '#000',
|
|
118
|
+
dimOpacity = BACKDROP_DIM_OPACITY,
|
|
119
|
+
style,
|
|
120
|
+
children,
|
|
121
|
+
accessibilityLabel = 'Dismiss',
|
|
122
|
+
testID,
|
|
123
|
+
},
|
|
124
|
+
ref,
|
|
125
|
+
) {
|
|
123
126
|
const inert = disabled || !onPress;
|
|
124
127
|
return (
|
|
125
128
|
<Pressable
|
|
129
|
+
// MUST forward the ref: surfaces animate the backdrop through
|
|
130
|
+
// `Animated.createAnimatedComponent(Backdrop)`, and reanimated applies
|
|
131
|
+
// those updates by reaching the underlying host view. With the ref
|
|
132
|
+
// swallowed the animated style never lands, so a backdrop whose opacity
|
|
133
|
+
// is animated from 0 stays at 0 — fully transparent, with the surface
|
|
134
|
+
// floating over an undimmed app.
|
|
135
|
+
ref={ref}
|
|
126
136
|
pointerEvents="auto"
|
|
127
137
|
onPress={inert ? undefined : onPress}
|
|
128
138
|
disabled={inert}
|
|
@@ -153,7 +163,9 @@ export const Backdrop = memo(function Backdrop({
|
|
|
153
163
|
{children}
|
|
154
164
|
</Pressable>
|
|
155
165
|
);
|
|
156
|
-
});
|
|
166
|
+
}));
|
|
167
|
+
|
|
168
|
+
Backdrop.displayName = 'Backdrop';
|
|
157
169
|
|
|
158
170
|
const styles = StyleSheet.create({
|
|
159
171
|
root: {
|