@oxy.so/bloom 22.1.3 → 22.1.5
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/docs/adoption-matrix.mdx +5 -5
- package/docs/list.mdx +9 -0
- package/docs/page-header.mdx +7 -5
- package/docs/task-catalog.json +1 -1
- package/docs/task-catalog.mdx +1 -1
- package/docs/verification.mdx +52 -0
- package/lib/commonjs/list/ListConversation.js +1 -0
- package/lib/commonjs/list/ListConversation.js.map +1 -1
- package/lib/commonjs/list/ListItemBase.js +22 -5
- package/lib/commonjs/list/ListItemBase.js.map +1 -1
- package/lib/commonjs/list/ListMail.js +1 -0
- package/lib/commonjs/list/ListMail.js.map +1 -1
- package/lib/commonjs/list/list-style.js +4 -2
- package/lib/commonjs/list/list-style.js.map +1 -1
- package/lib/commonjs/page-footer/PageFooter.js +1 -0
- package/lib/commonjs/page-footer/PageFooter.js.map +1 -1
- package/lib/commonjs/page-header/EdgeScrim.js +38 -10
- package/lib/commonjs/page-header/EdgeScrim.js.map +1 -1
- package/lib/commonjs/page-header/PageHeader.js +1 -0
- package/lib/commonjs/page-header/PageHeader.js.map +1 -1
- package/lib/module/list/ListConversation.js +1 -0
- package/lib/module/list/ListConversation.js.map +1 -1
- package/lib/module/list/ListItemBase.js +23 -6
- package/lib/module/list/ListItemBase.js.map +1 -1
- package/lib/module/list/ListMail.js +1 -0
- package/lib/module/list/ListMail.js.map +1 -1
- package/lib/module/list/list-style.js +4 -2
- package/lib/module/list/list-style.js.map +1 -1
- package/lib/module/page-footer/PageFooter.js +2 -1
- package/lib/module/page-footer/PageFooter.js.map +1 -1
- package/lib/module/page-header/EdgeScrim.js +37 -9
- package/lib/module/page-header/EdgeScrim.js.map +1 -1
- package/lib/module/page-header/PageHeader.js +2 -1
- package/lib/module/page-header/PageHeader.js.map +1 -1
- package/lib/typescript/commonjs/list/ListCall.d.ts +2 -2
- package/lib/typescript/commonjs/list/ListCall.d.ts.map +1 -1
- package/lib/typescript/commonjs/list/ListConversation.d.ts +2 -2
- package/lib/typescript/commonjs/list/ListConversation.d.ts.map +1 -1
- package/lib/typescript/commonjs/list/ListItemBase.d.ts.map +1 -1
- package/lib/typescript/commonjs/list/ListMail.d.ts +2 -2
- package/lib/typescript/commonjs/list/ListMail.d.ts.map +1 -1
- package/lib/typescript/commonjs/list/ListPerson.d.ts +2 -2
- package/lib/typescript/commonjs/list/ListPerson.d.ts.map +1 -1
- package/lib/typescript/commonjs/list/list-style.d.ts +1 -1
- package/lib/typescript/commonjs/list/list-style.d.ts.map +1 -1
- package/lib/typescript/commonjs/list/types.d.ts +5 -0
- package/lib/typescript/commonjs/list/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/page-footer/PageFooter.d.ts.map +1 -1
- package/lib/typescript/commonjs/page-footer/types.d.ts +1 -1
- package/lib/typescript/commonjs/page-header/EdgeScrim.d.ts +14 -6
- package/lib/typescript/commonjs/page-header/EdgeScrim.d.ts.map +1 -1
- package/lib/typescript/commonjs/page-header/PageHeader.d.ts.map +1 -1
- package/lib/typescript/commonjs/page-header/types.d.ts +1 -1
- package/lib/typescript/commonjs/page-header/types.d.ts.map +1 -1
- package/lib/typescript/module/list/ListCall.d.ts +2 -2
- package/lib/typescript/module/list/ListCall.d.ts.map +1 -1
- package/lib/typescript/module/list/ListConversation.d.ts +2 -2
- package/lib/typescript/module/list/ListConversation.d.ts.map +1 -1
- package/lib/typescript/module/list/ListItemBase.d.ts.map +1 -1
- package/lib/typescript/module/list/ListMail.d.ts +2 -2
- package/lib/typescript/module/list/ListMail.d.ts.map +1 -1
- package/lib/typescript/module/list/ListPerson.d.ts +2 -2
- package/lib/typescript/module/list/ListPerson.d.ts.map +1 -1
- package/lib/typescript/module/list/list-style.d.ts +1 -1
- package/lib/typescript/module/list/list-style.d.ts.map +1 -1
- package/lib/typescript/module/list/types.d.ts +5 -0
- package/lib/typescript/module/list/types.d.ts.map +1 -1
- package/lib/typescript/module/page-footer/PageFooter.d.ts.map +1 -1
- package/lib/typescript/module/page-footer/types.d.ts +1 -1
- package/lib/typescript/module/page-header/EdgeScrim.d.ts +14 -6
- package/lib/typescript/module/page-header/EdgeScrim.d.ts.map +1 -1
- package/lib/typescript/module/page-header/PageHeader.d.ts.map +1 -1
- package/lib/typescript/module/page-header/types.d.ts +1 -1
- package/lib/typescript/module/page-header/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/list/ListCall.tsx +2 -2
- package/src/list/ListConversation.tsx +3 -2
- package/src/list/ListItemBase.tsx +33 -7
- package/src/list/ListMail.tsx +3 -2
- package/src/list/ListPerson.tsx +2 -2
- package/src/list/list-style.ts +4 -2
- package/src/list/types.ts +6 -0
- package/src/page-footer/PageFooter.tsx +2 -1
- package/src/page-footer/types.ts +1 -1
- package/src/page-header/EdgeScrim.tsx +49 -10
- package/src/page-header/PageHeader.tsx +2 -1
- package/src/page-header/types.ts +1 -1
|
@@ -4,7 +4,7 @@ import { ListCall } from './ListCall';
|
|
|
4
4
|
import { ListConversation } from './ListConversation';
|
|
5
5
|
import { ListMail } from './ListMail';
|
|
6
6
|
import { ChipRow } from '../chip';
|
|
7
|
-
import { memo, useEffect } from 'react';
|
|
7
|
+
import { memo, useEffect, useRef } from 'react';
|
|
8
8
|
import { Pressable, StyleSheet, View, type PressableProps } from 'react-native';
|
|
9
9
|
import { Checkbox } from '../checkbox';
|
|
10
10
|
import { openHref } from '../hooks/link-activation';
|
|
@@ -21,7 +21,7 @@ import { SwipeRow, useSwipeAvailable } from '../swipe-row';
|
|
|
21
21
|
import { useTheme } from '../theme/use-theme';
|
|
22
22
|
import { Text } from '../typography';
|
|
23
23
|
import { LIST_CSS, LIST_STYLE_ID, LIST_ROW_INSET, LIST_ROW_MIN_HEIGHT } from './list-style';
|
|
24
|
-
import type { ListAction, ListItemProps,
|
|
24
|
+
import type { ListAction, ListItemProps, ListItemShellProps } from './types';
|
|
25
25
|
|
|
26
26
|
type Bindings = Pick<
|
|
27
27
|
typeof import('../context-menu'),
|
|
@@ -54,6 +54,7 @@ export function createListItem({
|
|
|
54
54
|
content,
|
|
55
55
|
leading,
|
|
56
56
|
trailing,
|
|
57
|
+
trailingMetadata = false,
|
|
57
58
|
footer,
|
|
58
59
|
attachments,
|
|
59
60
|
disabled = false,
|
|
@@ -74,11 +75,12 @@ export function createListItem({
|
|
|
74
75
|
swipeEnabled,
|
|
75
76
|
style,
|
|
76
77
|
testID,
|
|
77
|
-
}:
|
|
78
|
+
}: ListItemShellProps) {
|
|
78
79
|
const label = labelProp ?? (typeof title === 'string' ? title : '');
|
|
79
80
|
const theme = useTheme();
|
|
80
81
|
const surface = useSurfaceFill();
|
|
81
82
|
const touch = useTouchInput();
|
|
83
|
+
const consumedLongPress = useRef(false);
|
|
82
84
|
const swipeAvailable = useSwipeAvailable();
|
|
83
85
|
const common = useCommonMessages();
|
|
84
86
|
useEffect(() => {
|
|
@@ -182,11 +184,28 @@ export function createListItem({
|
|
|
182
184
|
onPress();
|
|
183
185
|
} else if (!IS_WEB && href) openHref(href);
|
|
184
186
|
},
|
|
185
|
-
//
|
|
186
|
-
//
|
|
187
|
+
// Cancel the browser's compatibility click at its touch source. A consumed
|
|
188
|
+
// long press can move the layout before release, retargeting that click to
|
|
189
|
+
// another row whose RNW responder never received the long press.
|
|
190
|
+
...(IS_WEB
|
|
191
|
+
? {
|
|
192
|
+
onTouchStart: () => {
|
|
193
|
+
consumedLongPress.current = false;
|
|
194
|
+
},
|
|
195
|
+
onTouchCancel: () => {
|
|
196
|
+
consumedLongPress.current = false;
|
|
197
|
+
},
|
|
198
|
+
onTouchEnd: (event: import('react-native').GestureResponderEvent) => {
|
|
199
|
+
if (consumedLongPress.current) event.preventDefault();
|
|
200
|
+
consumedLongPress.current = false;
|
|
201
|
+
},
|
|
202
|
+
}
|
|
203
|
+
: {}),
|
|
204
|
+
// Keep this mounted throughout selection for RNW's own responder lifecycle.
|
|
187
205
|
onLongPress: touch
|
|
188
206
|
? () => {
|
|
189
207
|
if (disabled) return;
|
|
208
|
+
if (IS_WEB && (onCheckedChange || onLongPress)) consumedLongPress.current = true;
|
|
190
209
|
if (onCheckedChange) {
|
|
191
210
|
if (!selecting) onCheckedChange(true);
|
|
192
211
|
} else onLongPress?.();
|
|
@@ -289,12 +308,19 @@ export function createListItem({
|
|
|
289
308
|
)}
|
|
290
309
|
</View>
|
|
291
310
|
{trailing ? (
|
|
292
|
-
<View
|
|
311
|
+
<View
|
|
312
|
+
{...(trailingMetadata ? webDataSet({ bloomListMeta: '' }) : {})}
|
|
313
|
+
pointerEvents="box-none"
|
|
314
|
+
>
|
|
293
315
|
{trailing}
|
|
294
316
|
</View>
|
|
295
317
|
) : null}
|
|
296
318
|
{(commands.length || contextMenu) && !touch && !disabled ? (
|
|
297
|
-
<View
|
|
319
|
+
<View
|
|
320
|
+
{...webDataSet({
|
|
321
|
+
bloomListActions: trailing && !trailingMetadata ? 'persistent' : '',
|
|
322
|
+
})}
|
|
323
|
+
>
|
|
298
324
|
<DropdownMenu>
|
|
299
325
|
<DropdownMenuTrigger asChild label={menuLabel}>
|
|
300
326
|
<Button
|
package/src/list/ListMail.tsx
CHANGED
|
@@ -16,7 +16,7 @@ import { useSurfaceFill } from '../styles/surface-levels';
|
|
|
16
16
|
import { useTheme } from '../theme/use-theme';
|
|
17
17
|
import { webDataSet } from '../styles/web-data';
|
|
18
18
|
import { Text } from '../typography';
|
|
19
|
-
import type { ListCommonProps, ListMailData } from './types';
|
|
19
|
+
import type { ListCommonProps, ListItemShellProps, ListMailData } from './types';
|
|
20
20
|
|
|
21
21
|
/** Mail content only; ListItem owns layout, selection, gestures and commands. */
|
|
22
22
|
export function ListMail({
|
|
@@ -24,7 +24,7 @@ export function ListMail({
|
|
|
24
24
|
mail,
|
|
25
25
|
...props
|
|
26
26
|
}: ListCommonProps & {
|
|
27
|
-
Shell: ComponentType<
|
|
27
|
+
Shell: ComponentType<ListItemShellProps>;
|
|
28
28
|
mail: ListMailData;
|
|
29
29
|
}) {
|
|
30
30
|
const {
|
|
@@ -139,6 +139,7 @@ export function ListMail({
|
|
|
139
139
|
</View>
|
|
140
140
|
)
|
|
141
141
|
}
|
|
142
|
+
trailingMetadata={props.trailing === undefined && !onStarredChange}
|
|
142
143
|
trailing={
|
|
143
144
|
props.trailing !== undefined ? (
|
|
144
145
|
props.trailing
|
package/src/list/ListPerson.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import { useMessages } from '../locale/messages';
|
|
|
7
7
|
import { useSurfaceFill } from '../styles/surface-levels';
|
|
8
8
|
import { useTheme } from '../theme/use-theme';
|
|
9
9
|
import { Text } from '../typography';
|
|
10
|
-
import type { ListCommonProps, ListPersonData } from './types';
|
|
10
|
+
import type { ListCommonProps, ListItemShellProps, ListPersonData } from './types';
|
|
11
11
|
|
|
12
12
|
export function ListPerson({
|
|
13
13
|
Shell,
|
|
@@ -15,7 +15,7 @@ export function ListPerson({
|
|
|
15
15
|
person,
|
|
16
16
|
...props
|
|
17
17
|
}: ListCommonProps & {
|
|
18
|
-
Shell: ComponentType<
|
|
18
|
+
Shell: ComponentType<ListItemShellProps>;
|
|
19
19
|
Button: typeof import('../button')['Button'];
|
|
20
20
|
person: ListPersonData;
|
|
21
21
|
}) {
|
package/src/list/list-style.ts
CHANGED
|
@@ -12,13 +12,15 @@ export const LIST_CSS = `
|
|
|
12
12
|
[data-bloom-list-identity]:has(:focus-visible) [data-bloom-list-selection] { opacity:1 !important; }
|
|
13
13
|
[data-bloom-list-identity]:has(:focus-visible) [data-bloom-list-portrait] { opacity:0; }
|
|
14
14
|
[data-bloom-list-actions] { display:none !important; }
|
|
15
|
+
/* Persistent controls never move when the row reveals its command menu. */
|
|
16
|
+
[data-bloom-list-actions="persistent"] { display:flex !important; visibility:hidden; pointer-events:none; }
|
|
15
17
|
[data-bloom-list-row]:has(:focus-visible) [data-bloom-list-actions],
|
|
16
|
-
[data-bloom-list-row]:has([aria-expanded="true"]) [data-bloom-list-actions] { display:flex !important; }
|
|
18
|
+
[data-bloom-list-row]:has([aria-expanded="true"]) [data-bloom-list-actions] { display:flex !important; visibility:visible; pointer-events:auto; }
|
|
17
19
|
[data-bloom-list-row][data-has-actions="true"]:has(:focus-visible) [data-bloom-list-meta],
|
|
18
20
|
[data-bloom-list-row][data-has-actions="true"]:has([aria-expanded="true"]) [data-bloom-list-meta] { display:none !important; }
|
|
19
21
|
@media (hover:hover) {
|
|
20
22
|
[data-bloom-list-row][data-interactive="true"]:hover { background:var(--bloom-list-selected); }
|
|
21
|
-
[data-bloom-list-row]:hover [data-bloom-list-actions] { display:flex !important; }
|
|
23
|
+
[data-bloom-list-row]:hover [data-bloom-list-actions] { display:flex !important; visibility:visible; pointer-events:auto; }
|
|
22
24
|
[data-bloom-list-row][data-has-actions="true"]:hover [data-bloom-list-meta] { display:none !important; }
|
|
23
25
|
[data-bloom-list-identity]:hover [data-bloom-list-selection] { opacity:1 !important; }
|
|
24
26
|
[data-bloom-list-identity]:hover [data-bloom-list-portrait] { opacity:0; }
|
package/src/list/types.ts
CHANGED
|
@@ -156,6 +156,7 @@ export interface ListCommonProps {
|
|
|
156
156
|
/** Custom text body; preserves shared row geometry. */
|
|
157
157
|
content?: import('react').ReactNode;
|
|
158
158
|
leading?: import('react').ReactNode;
|
|
159
|
+
/** Persistent trailing content, including controls; never replaced by the row menu. */
|
|
159
160
|
trailing?: import('react').ReactNode;
|
|
160
161
|
footer?: import('react').ReactNode;
|
|
161
162
|
/** File chips; the shared horizontal attachment rail owns its inset and swipe handoff. */
|
|
@@ -193,6 +194,11 @@ export interface ListCommonProps {
|
|
|
193
194
|
testID?: string;
|
|
194
195
|
}
|
|
195
196
|
|
|
197
|
+
/** @internal Only domain renderers classify their own passive metadata. */
|
|
198
|
+
export interface ListItemShellProps extends ListCommonProps {
|
|
199
|
+
trailingMetadata?: boolean;
|
|
200
|
+
}
|
|
201
|
+
|
|
196
202
|
/** Conversation display data; all interaction and geometry belongs to ListItem. */
|
|
197
203
|
export interface ListConversationData {
|
|
198
204
|
/** The conversation's name — a person, a group or a channel. */
|
|
@@ -12,7 +12,7 @@ import Animated, { useAnimatedStyle } from 'react-native-reanimated';
|
|
|
12
12
|
import { remainingScrollDistance, useScrollMetricsValue } from '../layout/scroll-metrics';
|
|
13
13
|
import { BloomScope } from '../appearance';
|
|
14
14
|
import { useBottomEdgeInset } from '../layout/bottom-edge';
|
|
15
|
-
import { EdgeScrim, SCRIM_TAIL_RATIO } from '../page-header/EdgeScrim';
|
|
15
|
+
import { EdgeScrim, SCRIM_CHROME_FRACTION, SCRIM_TAIL_RATIO } from '../page-header/EdgeScrim';
|
|
16
16
|
import { BREAKPOINTS } from '../styles/breakpoints';
|
|
17
17
|
import { adoptStyleSheet } from '../styles/adopt-style-sheet';
|
|
18
18
|
import { dataHook } from '../styles/data-hook';
|
|
@@ -147,6 +147,7 @@ function PageFooterComponent({
|
|
|
147
147
|
>
|
|
148
148
|
<EdgeScrim
|
|
149
149
|
edge="bottom"
|
|
150
|
+
opaqueFraction={SCRIM_CHROME_FRACTION}
|
|
150
151
|
color={scrimColor ?? fill}
|
|
151
152
|
testID={testID ? `${testID}-scrim-gradient` : undefined}
|
|
152
153
|
/>
|
package/src/page-footer/types.ts
CHANGED
|
@@ -23,7 +23,7 @@ export interface PageFooterProps {
|
|
|
23
23
|
*/
|
|
24
24
|
safeArea?: boolean;
|
|
25
25
|
/**
|
|
26
|
-
* Mirrored PageHeader gradient
|
|
26
|
+
* Mirrored PageHeader gradient: opaque behind measured chrome, fading above it. Default always.
|
|
27
27
|
* auto follows ScrollMetricsProvider: hidden at the bottom or for short /
|
|
28
28
|
* unmeasured content, fading in over scrollThreshold of remaining content.
|
|
29
29
|
*/
|
|
@@ -30,12 +30,13 @@ import { withAlpha } from '../theme/color-utils';
|
|
|
30
30
|
*
|
|
31
31
|
* ── THE STOPS ───────────────────────────────────────────────────────────────
|
|
32
32
|
*
|
|
33
|
-
* Four of them
|
|
33
|
+
* Four of them describe the fading portion, after any opaque chrome region.
|
|
34
|
+
* They are shaped as an ease-out rather than a straight line. A LINEAR
|
|
34
35
|
* ramp of opacity is perceptually not linear: it holds too much colour through
|
|
35
36
|
* the middle and then falls off visibly in the last fifth, which puts a soft
|
|
36
37
|
* but findable band across the content. Weighting the fall earlier spends the
|
|
37
|
-
*
|
|
38
|
-
*
|
|
38
|
+
* fading portion's height and arrives at zero gently. Header/footer chrome
|
|
39
|
+
* stays opaque before that portion so scrolling text cannot cross its labels.
|
|
39
40
|
*
|
|
40
41
|
* `TAIL_RATIO` extends the ramp BELOW the header's own box. The header is as
|
|
41
42
|
* tall as its islands plus its padding; the fade needs room after that, or it
|
|
@@ -75,12 +76,13 @@ import { withAlpha } from '../theme/color-utils';
|
|
|
75
76
|
|
|
76
77
|
/** How far past the header's own height the fade continues, as a ratio of it. */
|
|
77
78
|
export const SCRIM_TAIL_RATIO = 0.55;
|
|
79
|
+
/** Measured chrome occupies this fraction of its chrome + external tail box. */
|
|
80
|
+
export const SCRIM_CHROME_FRACTION = 1 / (1 + SCRIM_TAIL_RATIO);
|
|
78
81
|
|
|
79
82
|
/**
|
|
80
83
|
* Offset down the ramp -> how much of the page colour survives there.
|
|
81
84
|
*
|
|
82
|
-
*
|
|
83
|
-
* way down, nothing at the bottom.
|
|
85
|
+
* Applied to the fading portion only; any opaque chrome region precedes it.
|
|
84
86
|
*/
|
|
85
87
|
export const SCRIM_STOPS = [
|
|
86
88
|
{ offset: 0, opacity: 1 },
|
|
@@ -105,9 +107,34 @@ export interface EdgeScrimProps {
|
|
|
105
107
|
edge?: 'top' | 'bottom';
|
|
106
108
|
/** Smooth legibility curve by default; linear has only the opaque and transparent endpoints. */
|
|
107
109
|
falloff?: 'smooth' | 'linear';
|
|
110
|
+
/**
|
|
111
|
+
* Fraction of the gradient box kept opaque from its anchored edge, in [0, 1].
|
|
112
|
+
* Defaults to 0 for a full-box fade. Header/footer supply their measured
|
|
113
|
+
* chrome's share of the box; the curve then occupies only the external tail.
|
|
114
|
+
*/
|
|
115
|
+
opaqueFraction?: number;
|
|
108
116
|
testID?: string;
|
|
109
117
|
}
|
|
110
118
|
|
|
119
|
+
/** Both renderers use the same normalized positions, including the solid region. */
|
|
120
|
+
function scrimStops(falloff: 'smooth' | 'linear', opaqueFraction: number) {
|
|
121
|
+
const fraction = Number.isFinite(opaqueFraction) ? Math.max(0, Math.min(1, opaqueFraction)) : 0;
|
|
122
|
+
const stops = falloff === 'linear' ? LINEAR_STOPS : SCRIM_STOPS;
|
|
123
|
+
if (fraction === 0) return stops;
|
|
124
|
+
if (fraction === 1)
|
|
125
|
+
return [
|
|
126
|
+
{ offset: 0, opacity: 1 },
|
|
127
|
+
{ offset: 1, opacity: 1 },
|
|
128
|
+
];
|
|
129
|
+
return [
|
|
130
|
+
{ offset: 0, opacity: 1 },
|
|
131
|
+
...stops.map((stop) => ({
|
|
132
|
+
offset: fraction + (1 - fraction) * stop.offset,
|
|
133
|
+
opacity: stop.opacity,
|
|
134
|
+
})),
|
|
135
|
+
];
|
|
136
|
+
}
|
|
137
|
+
|
|
111
138
|
/**
|
|
112
139
|
* The ramp as a CSS gradient, for Android's own `experimental_backgroundImage`.
|
|
113
140
|
*
|
|
@@ -122,9 +149,11 @@ export function edgeScrimGradient(
|
|
|
122
149
|
color: string,
|
|
123
150
|
edge: 'top' | 'bottom',
|
|
124
151
|
falloff: 'smooth' | 'linear' = 'smooth',
|
|
152
|
+
opaqueFraction = 0,
|
|
125
153
|
): string {
|
|
126
|
-
const stops = (falloff
|
|
127
|
-
|
|
154
|
+
const stops = scrimStops(falloff, opaqueFraction)
|
|
155
|
+
// Keep fractional positions: rounding down can expose the last chrome pixels.
|
|
156
|
+
.map((stop) => `${withAlpha(color, stop.opacity)} ${stop.offset * 100}%`)
|
|
128
157
|
.join(', ');
|
|
129
158
|
return `linear-gradient(to ${edge === 'bottom' ? 'top' : 'bottom'}, ${stops})`;
|
|
130
159
|
}
|
|
@@ -133,6 +162,7 @@ const EdgeScrimComponent: React.FC<EdgeScrimProps> = ({
|
|
|
133
162
|
color,
|
|
134
163
|
edge = 'top',
|
|
135
164
|
falloff = 'smooth',
|
|
165
|
+
opaqueFraction = 0,
|
|
136
166
|
testID,
|
|
137
167
|
}) => {
|
|
138
168
|
if (Platform.OS === 'android') {
|
|
@@ -141,18 +171,27 @@ const EdgeScrimComponent: React.FC<EdgeScrimProps> = ({
|
|
|
141
171
|
testID={testID}
|
|
142
172
|
style={[
|
|
143
173
|
StyleSheet.absoluteFill,
|
|
144
|
-
{ experimental_backgroundImage: edgeScrimGradient(color, edge, falloff) },
|
|
174
|
+
{ experimental_backgroundImage: edgeScrimGradient(color, edge, falloff, opaqueFraction) },
|
|
145
175
|
]}
|
|
146
176
|
/>
|
|
147
177
|
);
|
|
148
178
|
}
|
|
149
|
-
return
|
|
179
|
+
return (
|
|
180
|
+
<SvgEdgeScrim
|
|
181
|
+
color={color}
|
|
182
|
+
edge={edge}
|
|
183
|
+
falloff={falloff}
|
|
184
|
+
opaqueFraction={opaqueFraction}
|
|
185
|
+
testID={testID}
|
|
186
|
+
/>
|
|
187
|
+
);
|
|
150
188
|
};
|
|
151
189
|
|
|
152
190
|
const SvgEdgeScrim: React.FC<EdgeScrimProps> = ({
|
|
153
191
|
color,
|
|
154
192
|
edge = 'top',
|
|
155
193
|
falloff = 'smooth',
|
|
194
|
+
opaqueFraction = 0,
|
|
156
195
|
testID,
|
|
157
196
|
}) => {
|
|
158
197
|
const id = `${useSvgIdPrefix('bloom-page-header-scrim')}gradient`;
|
|
@@ -167,7 +206,7 @@ const SvgEdgeScrim: React.FC<EdgeScrimProps> = ({
|
|
|
167
206
|
x2="0"
|
|
168
207
|
y2={fromBottom ? '0' : '1'}
|
|
169
208
|
>
|
|
170
|
-
{(falloff
|
|
209
|
+
{scrimStops(falloff, opaqueFraction).map((stop) => (
|
|
171
210
|
<Stop
|
|
172
211
|
key={stop.offset}
|
|
173
212
|
offset={String(stop.offset)}
|
|
@@ -59,7 +59,7 @@ import { useSurfaceFillRecipe } from '../styles/surface-levels';
|
|
|
59
59
|
import { Title, Subtitle } from '../typography';
|
|
60
60
|
import { Surface } from '../surface/Surface';
|
|
61
61
|
import { PageHeaderIdentity } from './PageHeaderIdentity';
|
|
62
|
-
import { EdgeScrim, SCRIM_TAIL_RATIO } from './EdgeScrim';
|
|
62
|
+
import { EdgeScrim, SCRIM_CHROME_FRACTION, SCRIM_TAIL_RATIO } from './EdgeScrim';
|
|
63
63
|
import type { PageHeaderProps } from './types';
|
|
64
64
|
import { useCommonMessages } from '../locale/common-messages';
|
|
65
65
|
import { useCssSafeAreaInsets } from '../hooks/use-css-safe-area-insets';
|
|
@@ -886,6 +886,7 @@ function PageHeaderComponent({
|
|
|
886
886
|
// falling back to the page. Explicit scrimColor remains an override.
|
|
887
887
|
color={scrimColor ?? (imageScrim ? '#000000' : surfaceFill)}
|
|
888
888
|
falloff={scrimFalloff}
|
|
889
|
+
opaqueFraction={tone !== 'onImage' && scrimFalloff === 'smooth' ? SCRIM_CHROME_FRACTION : 0}
|
|
889
890
|
testID={testID ? `${testID}-scrim-gradient` : undefined}
|
|
890
891
|
/>
|
|
891
892
|
</Animated.View>
|
package/src/page-header/types.ts
CHANGED
|
@@ -170,7 +170,7 @@ export interface PageHeaderProps {
|
|
|
170
170
|
transparent?: boolean;
|
|
171
171
|
/** `presentation="floating"` only. Default `auto`. */
|
|
172
172
|
scrim?: PageHeaderScrim;
|
|
173
|
-
/**
|
|
173
|
+
/** Default smooth protects measured chrome and fades outside it; linear/onImage fade across the full box. */
|
|
174
174
|
scrimFalloff?: 'smooth' | 'linear';
|
|
175
175
|
/**
|
|
176
176
|
* The colour the edge effect fades FROM. Defaults to `theme.colors.background`
|