@bloxwap/hig 0.6.0 → 0.8.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/README.md +2 -2
- package/chart/README.md +13 -2
- package/chart/dist/altimeter-burst.d.ts +4 -0
- package/chart/dist/altimeter-burst.js +43 -0
- package/chart/dist/altimeter-chart.d.ts +52 -0
- package/chart/dist/altimeter-chart.js +275 -0
- package/chart/dist/altimeter-model.d.ts +43 -0
- package/chart/dist/altimeter-model.js +148 -0
- package/chart/dist/altimeter-targets.d.ts +33 -0
- package/chart/dist/altimeter-targets.js +88 -0
- package/chart/dist/bitcoin-price.d.ts +8 -0
- package/chart/dist/bitcoin-price.js +41 -0
- package/chart/dist/champions-league.d.ts +19 -0
- package/chart/dist/champions-league.js +104 -0
- package/chart/dist/index.d.ts +6 -0
- package/chart/dist/index.js +5 -0
- package/chart/dist/outcome-chart.d.ts +37 -0
- package/chart/dist/outcome-chart.js +212 -0
- package/chart/dist/outcome-model.d.ts +43 -0
- package/chart/dist/outcome-model.js +71 -0
- package/chart/dist/plus-grid.d.ts +6 -0
- package/chart/dist/plus-grid.js +29 -0
- package/contracts/README.md +1 -1
- package/contracts/dist/avatar.d.ts +68 -0
- package/contracts/dist/avatar.js +93 -0
- package/contracts/dist/confetti.d.ts +174 -0
- package/contracts/dist/confetti.js +138 -0
- package/contracts/dist/decimal.d.ts +7 -0
- package/contracts/dist/decimal.js +35 -0
- package/contracts/dist/index.d.ts +45 -2
- package/contracts/dist/index.js +145 -4
- package/contracts/dist/invariants.d.ts +17 -0
- package/contracts/dist/invariants.js +24 -0
- package/contracts/dist/messages.d.ts +62 -2
- package/contracts/dist/messages.js +22 -2
- package/contracts/dist/number-flow.d.ts +90 -0
- package/contracts/dist/number-flow.js +150 -0
- package/contracts/dist/qr.d.ts +151 -0
- package/contracts/dist/qr.js +581 -0
- package/contracts/dist/toast.d.ts +168 -0
- package/contracts/dist/toast.js +171 -0
- package/feedback/README.md +1 -1
- package/feedback/dist/contract.js +1 -1
- package/feedback/dist/react.js +2 -4
- package/native/README.md +6 -1
- package/native/dist/account-block.d.ts +62 -7
- package/native/dist/account-block.js +54 -11
- package/native/dist/animated-number-model.d.ts +47 -1
- package/native/dist/animated-number-model.js +248 -21
- package/native/dist/animated-number.d.ts +41 -1
- package/native/dist/animated-number.js +165 -17
- package/native/dist/announce.d.ts +2 -0
- package/native/dist/announce.js +10 -0
- package/native/dist/asset-balance-row.d.ts +19 -1
- package/native/dist/asset-balance-row.js +24 -8
- package/native/dist/assets-block.d.ts +115 -0
- package/native/dist/assets-block.js +87 -0
- package/native/dist/async-result.d.ts +2 -0
- package/native/dist/async-result.js +11 -0
- package/native/dist/avatar-frame.d.ts +29 -0
- package/native/dist/avatar-frame.js +56 -0
- package/native/dist/avatar.d.ts +21 -0
- package/native/dist/avatar.js +31 -0
- package/native/dist/bar-mark.d.ts +16 -2
- package/native/dist/bar-mark.js +23 -7
- package/native/dist/bar-pnl.js +7 -5
- package/native/dist/blocks.d.ts +13 -14
- package/native/dist/blocks.js +10 -6
- package/native/dist/brand.js +2 -1
- package/native/dist/button.d.ts +7 -2
- package/native/dist/button.js +16 -4
- package/native/dist/checkbox.js +2 -1
- package/native/dist/confetti.d.ts +33 -0
- package/native/dist/confetti.js +143 -0
- package/native/dist/confirm-block.d.ts +98 -0
- package/native/dist/confirm-block.js +48 -0
- package/native/dist/data.d.ts +1 -1
- package/native/dist/data.js +8 -4
- package/native/dist/explainer-block.d.ts +91 -0
- package/native/dist/explainer-block.js +34 -0
- package/native/dist/field.d.ts +19 -5
- package/native/dist/field.js +56 -9
- package/native/dist/figure.d.ts +23 -0
- package/native/dist/figure.js +10 -0
- package/native/dist/gesture-sheet-model.d.ts +50 -0
- package/native/dist/gesture-sheet-model.js +105 -0
- package/native/dist/gesture-sheet-next.d.ts +82 -0
- package/native/dist/gesture-sheet-next.js +315 -0
- package/native/dist/gesture-sheet.d.ts +5 -1
- package/native/dist/gesture-sheet.js +13 -6
- package/native/dist/icons.d.ts +9 -6
- package/native/dist/icons.js +25 -24
- package/native/dist/language-block.d.ts +14 -1
- package/native/dist/language-block.js +11 -4
- package/native/dist/list-group.d.ts +44 -8
- package/native/dist/list-group.js +84 -13
- package/native/dist/manage-position-block.d.ts +35 -2
- package/native/dist/manage-position-block.js +41 -11
- package/native/dist/market-row.d.ts +46 -0
- package/native/dist/market-row.js +41 -0
- package/native/dist/navigation.js +5 -3
- package/native/dist/notifications-block.d.ts +30 -2
- package/native/dist/notifications-block.js +16 -8
- package/native/dist/number-format.d.ts +6 -0
- package/native/dist/number-format.js +9 -0
- package/native/dist/pickers.d.ts +32 -2
- package/native/dist/pickers.js +17 -9
- package/native/dist/position-block.d.ts +66 -10
- package/native/dist/position-block.js +45 -11
- package/native/dist/preset-group.d.ts +31 -0
- package/native/dist/preset-group.js +39 -0
- package/native/dist/preset-picker-block.d.ts +107 -0
- package/native/dist/preset-picker-block.js +43 -0
- package/native/dist/profile-block.d.ts +38 -5
- package/native/dist/profile-block.js +31 -6
- package/native/dist/provider.d.ts +14 -5
- package/native/dist/provider.js +32 -6
- package/native/dist/qr-code.d.ts +33 -0
- package/native/dist/qr-code.js +29 -0
- package/native/dist/radio-group.d.ts +23 -5
- package/native/dist/radio-group.js +40 -12
- package/native/dist/recipes.d.ts +6 -0
- package/native/dist/recipes.js +6 -0
- package/native/dist/reward-block.d.ts +55 -13
- package/native/dist/reward-block.js +37 -14
- package/native/dist/screen-header.d.ts +59 -0
- package/native/dist/screen-header.js +37 -0
- package/native/dist/select.js +4 -2
- package/native/dist/selection.d.ts +3 -2
- package/native/dist/selection.js +1 -0
- package/native/dist/setting-header.d.ts +2 -8
- package/native/dist/setting-header.js +2 -11
- package/native/dist/setting-switch.d.ts +15 -2
- package/native/dist/setting-switch.js +11 -4
- package/native/dist/signals-block.d.ts +26 -2
- package/native/dist/signals-block.js +14 -4
- package/native/dist/slider.js +5 -1
- package/native/dist/sound-haptics-block.d.ts +29 -2
- package/native/dist/sound-haptics-block.js +19 -8
- package/native/dist/status.d.ts +47 -14
- package/native/dist/status.js +39 -22
- package/native/dist/sticky-header.d.ts +28 -0
- package/native/dist/sticky-header.js +29 -0
- package/native/dist/surface.d.ts +3 -1
- package/native/dist/surface.js +2 -1
- package/native/dist/swap-amount-card.d.ts +57 -0
- package/native/dist/swap-amount-card.js +31 -0
- package/native/dist/swap-panel-block.d.ts +11 -4
- package/native/dist/swap-panel-block.js +67 -38
- package/native/dist/swap-parts.d.ts +5 -10
- package/native/dist/swap-parts.js +22 -24
- package/native/dist/swap-shared.d.ts +8 -2
- package/native/dist/swap-shared.js +10 -6
- package/native/dist/swap-views.js +6 -4
- package/native/dist/switch-row.d.ts +3 -2
- package/native/dist/switch-row.js +5 -3
- package/native/dist/switch.d.ts +4 -2
- package/native/dist/switch.js +3 -3
- package/native/dist/target-block.d.ts +40 -7
- package/native/dist/target-block.js +31 -11
- package/native/dist/toast.d.ts +47 -0
- package/native/dist/toast.js +386 -0
- package/native/dist/token-action-block.d.ts +26 -9
- package/native/dist/token-action-block.js +21 -8
- package/native/dist/trade-history-detail-block.d.ts +26 -1
- package/native/dist/trade-history-detail-block.js +17 -9
- package/native/dist/trade-history-list-block.d.ts +71 -5
- package/native/dist/trade-history-list-block.js +55 -17
- package/native/dist/wallet-address-core.d.ts +25 -0
- package/native/dist/wallet-address-core.js +34 -0
- package/native/dist/wallet-address.d.ts +6 -10
- package/native/dist/wallet-address.js +16 -20
- package/native-fonts/README.md +1 -1
- package/og-fonts/README.md +1 -1
- package/package.json +131 -2
- package/react/README.md +3 -1
- package/react/dist/animated-number-flow.d.ts +72 -0
- package/react/dist/animated-number-flow.js +316 -0
- package/react/dist/animated-number-model.d.ts +24 -0
- package/react/dist/animated-number-model.js +106 -3
- package/react/dist/animated-number.d.ts +49 -1
- package/react/dist/animated-number.js +146 -11
- package/react/dist/asset-balance-row.d.ts +19 -1
- package/react/dist/asset-balance-row.js +17 -3
- package/react/dist/async-result.d.ts +2 -0
- package/react/dist/async-result.js +11 -0
- package/react/dist/avatar.d.ts +25 -0
- package/react/dist/avatar.js +50 -0
- package/react/dist/bar-mark.d.ts +5 -2
- package/react/dist/bar-mark.js +5 -3
- package/react/dist/blocks/account-block.d.ts +57 -7
- package/react/dist/blocks/account-block.js +51 -11
- package/react/dist/blocks/assets-block.d.ts +106 -0
- package/react/dist/blocks/assets-block.js +135 -0
- package/react/dist/blocks/confirm-block.d.ts +91 -0
- package/react/dist/blocks/confirm-block.js +31 -0
- package/react/dist/blocks/explainer-block.d.ts +80 -0
- package/react/dist/blocks/explainer-block.js +20 -0
- package/react/dist/blocks/install-command.js +3 -1
- package/react/dist/blocks/language-block.d.ts +9 -1
- package/react/dist/blocks/language-block.js +8 -6
- package/react/dist/blocks/manage-position-block.d.ts +30 -2
- package/react/dist/blocks/manage-position-block.js +23 -4
- package/react/dist/blocks/market-row.d.ts +20 -9
- package/react/dist/blocks/market-row.js +17 -4
- package/react/dist/blocks/notifications-block.d.ts +27 -2
- package/react/dist/blocks/notifications-block.js +11 -2
- package/react/dist/blocks/pickers.d.ts +30 -1
- package/react/dist/blocks/pickers.js +32 -10
- package/react/dist/blocks/position-block.d.ts +34 -11
- package/react/dist/blocks/position-block.js +16 -5
- package/react/dist/blocks/preset-picker-block.d.ts +85 -0
- package/react/dist/blocks/preset-picker-block.js +19 -0
- package/react/dist/blocks/profile-block.d.ts +33 -6
- package/react/dist/blocks/profile-block.js +31 -6
- package/react/dist/blocks/reward-block.d.ts +65 -21
- package/react/dist/blocks/reward-block.js +24 -11
- package/react/dist/blocks/screen-header.d.ts +34 -2
- package/react/dist/blocks/screen-header.js +17 -6
- package/react/dist/blocks/setting-switch.d.ts +14 -1
- package/react/dist/blocks/setting-switch.js +11 -4
- package/react/dist/blocks/signals-block.d.ts +23 -2
- package/react/dist/blocks/signals-block.js +6 -5
- package/react/dist/blocks/sound-haptics-block.d.ts +27 -3
- package/react/dist/blocks/sound-haptics-block.js +11 -7
- package/react/dist/blocks/sticky-header.d.ts +19 -0
- package/react/dist/blocks/sticky-header.js +103 -0
- package/react/dist/blocks/swap/amount-card.js +2 -1
- package/react/dist/blocks/swap/settings.js +4 -3
- package/react/dist/blocks/swap/shared.d.ts +29 -23
- package/react/dist/blocks/swap/shared.js +36 -32
- package/react/dist/blocks/swap-panel-block.d.ts +12 -3
- package/react/dist/blocks/swap-panel-block.js +72 -37
- package/react/dist/blocks/target-block.d.ts +35 -7
- package/react/dist/blocks/target-block.js +26 -12
- package/react/dist/blocks/token-action-block.d.ts +21 -8
- package/react/dist/blocks/token-action-block.js +9 -6
- package/react/dist/blocks/trade-history-detail-block.d.ts +23 -1
- package/react/dist/blocks/trade-history-detail-block.js +5 -4
- package/react/dist/blocks/trade-history-list-block.d.ts +31 -5
- package/react/dist/blocks/trade-history-list-block.js +20 -10
- package/react/dist/blocks.d.ts +12 -8
- package/react/dist/blocks.js +6 -2
- package/react/dist/brand.js +2 -1
- package/react/dist/button.d.ts +9 -3
- package/react/dist/button.js +12 -5
- package/react/dist/confetti.d.ts +27 -0
- package/react/dist/confetti.js +240 -0
- package/react/dist/data.js +11 -4
- package/react/dist/field.d.ts +20 -5
- package/react/dist/field.js +30 -8
- package/react/dist/figure.d.ts +23 -0
- package/react/dist/figure.js +12 -0
- package/react/dist/gesture-sheet.d.ts +15 -1
- package/react/dist/gesture-sheet.js +53 -8
- package/react/dist/list-group.d.ts +41 -8
- package/react/dist/list-group.js +49 -13
- package/react/dist/navigation.js +11 -3
- package/react/dist/overlay.d.ts +28 -3
- package/react/dist/overlay.js +29 -3
- package/react/dist/preset-group.d.ts +30 -0
- package/react/dist/preset-group.js +13 -0
- package/react/dist/provider.d.ts +42 -5
- package/react/dist/provider.js +84 -10
- package/react/dist/qr-code.d.ts +32 -0
- package/react/dist/qr-code.js +28 -0
- package/react/dist/select.js +10 -3
- package/react/dist/selection.d.ts +18 -4
- package/react/dist/selection.js +20 -10
- package/react/dist/slider.js +5 -1
- package/react/dist/status.d.ts +14 -10
- package/react/dist/status.js +17 -9
- package/react/dist/styles.css +380 -150
- package/react/dist/surface.d.ts +5 -1
- package/react/dist/surface.js +1 -1
- package/react/dist/toast.d.ts +19 -12
- package/react/dist/toast.js +29 -7
- package/react/dist/wallet-address-core.d.ts +27 -0
- package/react/dist/wallet-address-core.js +29 -0
- package/react/dist/wallet-address.d.ts +6 -12
- package/react/dist/wallet-address.js +5 -16
- package/tokens/README.md +2 -2
- package/tokens/dist/index.d.ts +16 -0
- package/tokens/dist/index.js +16 -0
- package/tokens/dist/manifest.json +8 -0
- package/tokens/dist/tokens.css +6 -0
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useCallback, useContext, useEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react';
|
|
3
|
+
import { AccessibilityInfo, AppState, StyleSheet, View, useWindowDimensions } from 'react-native';
|
|
4
|
+
import Reanimated, { cancelAnimation, Easing, ReduceMotion, runOnJS, useAnimatedReaction, useAnimatedStyle, useSharedValue, withSpring, withTiming } from 'react-native-reanimated';
|
|
5
|
+
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
|
|
6
|
+
import { SafeAreaInsetsContext } from 'react-native-safe-area-context';
|
|
7
|
+
import * as en from '@bloxwap/hig/contracts/messages';
|
|
8
|
+
import { notificationDelta } from '@bloxwap/hig/contracts/announcements';
|
|
9
|
+
import { TOAST_DURATION, TOAST_EXIT, TOAST_GAP, TOAST_HOLD, TOAST_MOTION, TOAST_NARROW, TOAST_NARROW_OFFSET, TOAST_OFFSET, TOAST_REDUCED_FADE, TOAST_SPRING, TOAST_VISIBLE, TOAST_WIDTH, toastClockPause, toastClockRun, toastDrag, toastDuration, toastEdge, toastEnterFrom, toastExitTo, toastGrab, toastLeave, toastOrder, toastRemove, toastSlot, toastSwipeAxis, toastSwipeDirections, toastSwipeDismisses, toastSwipeOut, toastUpsert } from '@bloxwap/hig/contracts/toast';
|
|
10
|
+
import { useColors, useHIG } from './provider.js';
|
|
11
|
+
import { ToastNotice } from './status.js';
|
|
12
|
+
import { speak } from './announce.js';
|
|
13
|
+
// One store for the app, so `toast()` works from anywhere, not only from components. Mounted hosts subscribe; the last one mounted draws.
|
|
14
|
+
let entries = [], sequence = 0;
|
|
15
|
+
const listeners = new Set(), hosts = [];
|
|
16
|
+
const emit = () => { for (const listener of [...listeners])
|
|
17
|
+
listener(); };
|
|
18
|
+
const subscribe = (listener) => { listeners.add(listener); return () => { listeners.delete(listener); }; };
|
|
19
|
+
const snapshot = () => entries;
|
|
20
|
+
function attach(host) {
|
|
21
|
+
hosts.push(host);
|
|
22
|
+
emit();
|
|
23
|
+
return () => {
|
|
24
|
+
hosts.splice(hosts.indexOf(host), 1);
|
|
25
|
+
// Notices on their way out have nobody left to finish them.
|
|
26
|
+
if (hosts.length === 0)
|
|
27
|
+
entries = entries.filter(entry => !entry.leaving);
|
|
28
|
+
emit();
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/** Starts one notice's exit and tells its owner why: its time ran out (`expired`), or it was dismissed. The host removes it when the exit has played. */
|
|
32
|
+
function leave(key, expired) {
|
|
33
|
+
const entry = entries.find(candidate => candidate.key === key);
|
|
34
|
+
if (!entry || entry.leaving)
|
|
35
|
+
return;
|
|
36
|
+
entries = toastLeave(entries, entry.id);
|
|
37
|
+
emit();
|
|
38
|
+
if (expired)
|
|
39
|
+
entry.value.onAutoClose?.();
|
|
40
|
+
else
|
|
41
|
+
entry.value.onDismiss?.();
|
|
42
|
+
}
|
|
43
|
+
function forget(key) { const next = toastRemove(entries, key); if (next !== entries) {
|
|
44
|
+
entries = next;
|
|
45
|
+
emit();
|
|
46
|
+
} }
|
|
47
|
+
function raise(message, options = {}) {
|
|
48
|
+
const { severity = 'info', description, action, dismissName, duration, id, onDismiss, onAutoClose } = options;
|
|
49
|
+
// As in Sonner, an empty string is not an id: the notice gets the next one.
|
|
50
|
+
const key = ++sequence, resolved = typeof id === 'number' || (typeof id === 'string' && id.length > 0) ? id : key;
|
|
51
|
+
entries = toastUpsert(entries, { key, id: resolved, duration: toastDuration(duration), value: { message, description, severity, action, dismissName, onDismiss, onAutoClose } });
|
|
52
|
+
emit();
|
|
53
|
+
return resolved;
|
|
54
|
+
}
|
|
55
|
+
/** Dismisses one notice by id, or every notice when the id is omitted. */
|
|
56
|
+
export function dismissToast(id) {
|
|
57
|
+
const next = toastLeave(entries, id);
|
|
58
|
+
if (next === entries)
|
|
59
|
+
return;
|
|
60
|
+
const dismissed = next.filter((entry, index) => entry.leaving && !entries[index].leaving);
|
|
61
|
+
// Without a mounted Toaster nothing can play the exit, so they go at once.
|
|
62
|
+
entries = hosts.length > 0 ? next : next.filter(entry => !entry.leaving);
|
|
63
|
+
emit();
|
|
64
|
+
for (const entry of dismissed)
|
|
65
|
+
entry.value.onDismiss?.();
|
|
66
|
+
}
|
|
67
|
+
const as = (severity) => (message, options) => raise(message, { ...options, severity });
|
|
68
|
+
/**
|
|
69
|
+
* Raises a transient HIG capsule on the mounted `Toaster` and returns its id. Callable from anywhere. `toast.success`,
|
|
70
|
+
* `toast.error`, `toast.warning` and `toast.info` set the severity; `toast.dismiss` is `dismissToast`. The same call,
|
|
71
|
+
* options and names work in `@bloxwap/hig/react/toast`.
|
|
72
|
+
*/
|
|
73
|
+
export const toast = Object.assign(raise, { success: as('success'), error: as('error'), warning: as('warning'), info: as('info'), dismiss: dismissToast });
|
|
74
|
+
// The provider decides reduced motion (it already follows the OS setting), so these timings never defer to the system on their own.
|
|
75
|
+
const MOVE = { duration: TOAST_MOTION.duration, easing: Easing.bezier(...TOAST_MOTION.curve), reduceMotion: ReduceMotion.Never };
|
|
76
|
+
const EXIT = { duration: TOAST_EXIT.duration, easing: Easing.bezier(...TOAST_EXIT.curve), reduceMotion: ReduceMotion.Never };
|
|
77
|
+
const FADE = { duration: TOAST_REDUCED_FADE, easing: Easing.bezier(...TOAST_EXIT.curve), reduceMotion: ReduceMotion.Never };
|
|
78
|
+
const NO_INSETS = { top: 0, right: 0, bottom: 0, left: 0 };
|
|
79
|
+
// A card renders again when its place in the stack changes how it takes touches; what it shows has not changed then, so the capsule is skipped.
|
|
80
|
+
const Capsule = memo(ToastNotice);
|
|
81
|
+
/**
|
|
82
|
+
* One notice in the stack. React renders it when the store changes; everything that moves it runs on the UI thread. Its
|
|
83
|
+
* slot comes from the shared stack, so a notice arriving, leaving or changing height restacks every card in one frame
|
|
84
|
+
* without a render, and only transforms and opacity change while it moves.
|
|
85
|
+
*/
|
|
86
|
+
const Card = memo(function Card({ entry, front, hidden, interactive, lift, gap, visible, reduce, left, right, up, down, narrow, testID, stack, expanded, held, report, hold }) {
|
|
87
|
+
const id = entry.key, { leaving, value } = entry, colors = useColors();
|
|
88
|
+
const y = useSharedValue(0), scaleX = useSharedValue(1), scaleY = useSharedValue(1), opacity = useSharedValue(0), content = useSharedValue(1), dragX = useSharedValue(0), dragY = useSharedValue(0);
|
|
89
|
+
// 0: laid out but not placed yet. 1: in the stack. 2: leaving, so nothing may pull it back.
|
|
90
|
+
const phase = useSharedValue(0), gone = useSharedValue(false);
|
|
91
|
+
const rest = useSharedValue({ y: 0, height: 0, index: -1 }), size = useSharedValue({ width: 0, height: 0 });
|
|
92
|
+
// The axis a drag is locked to (0 none, 1 horizontal, 2 vertical) and the translation that counts as rest, so the notice does not jump by the recognition distance.
|
|
93
|
+
const axis = useSharedValue(0), origin = useSharedValue(0);
|
|
94
|
+
useAnimatedReaction(() => {
|
|
95
|
+
'worklet';
|
|
96
|
+
const { keys, heights } = stack.value, index = keys.indexOf(id);
|
|
97
|
+
const slot = toastSlot(index, heights, expanded.value || held.value, gap, visible, lift);
|
|
98
|
+
return { index, height: index < 0 ? 0 : heights[index], y: slot.y, scaleX: slot.scaleX, scaleY: slot.scaleY, opacity: slot.opacity, content: slot.content };
|
|
99
|
+
}, (next, previous) => {
|
|
100
|
+
'worklet';
|
|
101
|
+
if (next.index < 0 || phase.value === 2)
|
|
102
|
+
return;
|
|
103
|
+
rest.value = { y: next.y, height: next.height, index: next.index };
|
|
104
|
+
// What it was drawn at, when it was already in the stack: only what differs from that moves, so a restack that leaves a notice where it is costs it nothing.
|
|
105
|
+
const was = phase.value === 1 && previous !== null && previous.index >= 0 ? previous : null;
|
|
106
|
+
if (phase.value === 0) {
|
|
107
|
+
phase.value = 1;
|
|
108
|
+
// The front slides in from its own height away; a notice that appears further back fades in where it rests.
|
|
109
|
+
y.value = next.index === 0 && !reduce ? toastEnterFrom(next.y, next.height, lift) : next.y;
|
|
110
|
+
scaleX.value = next.scaleX;
|
|
111
|
+
scaleY.value = next.scaleY;
|
|
112
|
+
content.value = next.content;
|
|
113
|
+
opacity.value = 0;
|
|
114
|
+
}
|
|
115
|
+
if (was === null || next.y !== was.y)
|
|
116
|
+
y.value = reduce ? next.y : withTiming(next.y, MOVE);
|
|
117
|
+
if (was === null || next.scaleX !== was.scaleX)
|
|
118
|
+
scaleX.value = reduce ? next.scaleX : withTiming(next.scaleX, MOVE);
|
|
119
|
+
if (was === null || next.scaleY !== was.scaleY)
|
|
120
|
+
scaleY.value = reduce ? next.scaleY : withTiming(next.scaleY, MOVE);
|
|
121
|
+
const fade = reduce ? FADE : MOVE;
|
|
122
|
+
if (was === null || next.opacity !== was.opacity)
|
|
123
|
+
opacity.value = withTiming(next.opacity, fade);
|
|
124
|
+
if (was === null || next.content !== was.content)
|
|
125
|
+
content.value = withTiming(next.content, fade);
|
|
126
|
+
}, [id, gap, visible, lift, reduce]);
|
|
127
|
+
// The exit, unless a swipe has already sent the notice on its way.
|
|
128
|
+
useAnimatedReaction(() => {
|
|
129
|
+
'worklet';
|
|
130
|
+
return gone.value;
|
|
131
|
+
}, (now, before) => {
|
|
132
|
+
'worklet';
|
|
133
|
+
if (!now || now === before || phase.value === 2)
|
|
134
|
+
return;
|
|
135
|
+
const placed = phase.value === 1;
|
|
136
|
+
phase.value = 2;
|
|
137
|
+
if (!placed)
|
|
138
|
+
return;
|
|
139
|
+
opacity.value = withTiming(0, reduce ? FADE : EXIT);
|
|
140
|
+
if (!reduce)
|
|
141
|
+
y.value = withTiming(toastExitTo(rest.value.y, rest.value.height, lift, rest.value.index === 0 || expanded.value || held.value), EXIT);
|
|
142
|
+
}, [lift, reduce]);
|
|
143
|
+
// The store drops the notice once the exit has had time to play. The exit itself never waits for this thread.
|
|
144
|
+
useEffect(() => { if (!leaving)
|
|
145
|
+
return; gone.value = true; const timer = setTimeout(() => forget(id), TOAST_EXIT.duration + 50); return () => clearTimeout(timer); }, [leaving, id, gone]);
|
|
146
|
+
const dismiss = useCallback(() => leave(id, false), [id]);
|
|
147
|
+
const pan = useMemo(() => Gesture.Pan().enabled(interactive).activeOffsetX([-8, 8]).activeOffsetY([-8, 8])
|
|
148
|
+
// A finger on the notice holds every notice's time, whether or not it goes on to swipe.
|
|
149
|
+
.onBegin(() => {
|
|
150
|
+
'worklet';
|
|
151
|
+
runOnJS(hold)(id, true);
|
|
152
|
+
})
|
|
153
|
+
.onStart(event => {
|
|
154
|
+
'worklet';
|
|
155
|
+
const horizontal = toastSwipeAxis(event.translationX, event.translationY) === 'x';
|
|
156
|
+
axis.value = horizontal ? 1 : 2;
|
|
157
|
+
// A notice caught while it springs back carries on from where it is.
|
|
158
|
+
if (horizontal) {
|
|
159
|
+
cancelAnimation(dragX);
|
|
160
|
+
origin.value = event.translationX - toastGrab(dragX.value, left, right);
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
cancelAnimation(dragY);
|
|
164
|
+
origin.value = event.translationY - toastGrab(dragY.value, up, down);
|
|
165
|
+
}
|
|
166
|
+
})
|
|
167
|
+
.onChange(event => {
|
|
168
|
+
'worklet';
|
|
169
|
+
if (phase.value === 2)
|
|
170
|
+
return;
|
|
171
|
+
if (axis.value === 1)
|
|
172
|
+
dragX.value = toastDrag(event.translationX - origin.value, left, right);
|
|
173
|
+
else if (axis.value === 2)
|
|
174
|
+
dragY.value = toastDrag(event.translationY - origin.value, up, down);
|
|
175
|
+
})
|
|
176
|
+
.onEnd((event, success) => {
|
|
177
|
+
'worklet';
|
|
178
|
+
const horizontal = axis.value === 1;
|
|
179
|
+
axis.value = 0;
|
|
180
|
+
if (phase.value === 2)
|
|
181
|
+
return;
|
|
182
|
+
const amount = horizontal ? dragX.value : dragY.value, velocity = horizontal ? event.velocityX : event.velocityY;
|
|
183
|
+
// A gesture the system took away (a call, the notice pushed behind a new one) is not a decision to dismiss: it goes back to rest.
|
|
184
|
+
if (success !== false && toastSwipeDismisses(amount, velocity, horizontal ? left : up, horizontal ? right : down)) {
|
|
185
|
+
phase.value = 2;
|
|
186
|
+
const out = toastSwipeOut(amount, velocity, horizontal ? size.value.width : size.value.height), timing = { duration: out.duration, easing: EXIT.easing, reduceMotion: ReduceMotion.Never };
|
|
187
|
+
if (!reduce) {
|
|
188
|
+
if (horizontal)
|
|
189
|
+
dragX.value = withTiming(out.to, timing);
|
|
190
|
+
else
|
|
191
|
+
dragY.value = withTiming(out.to, timing);
|
|
192
|
+
}
|
|
193
|
+
opacity.value = withTiming(0, reduce ? FADE : timing);
|
|
194
|
+
runOnJS(dismiss)();
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
// Not far or fast enough: back to rest on a spring that carries the release velocity.
|
|
198
|
+
const spring = { ...TOAST_SPRING, velocity, reduceMotion: reduce ? ReduceMotion.Always : ReduceMotion.Never };
|
|
199
|
+
if (horizontal)
|
|
200
|
+
dragX.value = withSpring(0, spring);
|
|
201
|
+
else
|
|
202
|
+
dragY.value = withSpring(0, spring);
|
|
203
|
+
})
|
|
204
|
+
.onFinalize(() => {
|
|
205
|
+
'worklet';
|
|
206
|
+
axis.value = 0;
|
|
207
|
+
runOnJS(hold)(id, false);
|
|
208
|
+
}), [id, interactive, left, right, up, down, reduce, hold, dismiss]);
|
|
209
|
+
const cardStyle = useAnimatedStyle(() => {
|
|
210
|
+
'worklet';
|
|
211
|
+
return { opacity: opacity.value, transform: [{ translateX: dragX.value }, { translateY: y.value + dragY.value }, { scaleX: scaleX.value }, { scaleY: scaleY.value }] };
|
|
212
|
+
});
|
|
213
|
+
const contentStyle = useAnimatedStyle(() => {
|
|
214
|
+
'worklet';
|
|
215
|
+
return { opacity: content.value };
|
|
216
|
+
});
|
|
217
|
+
const onLayout = useCallback((event) => { const { width, height } = event.nativeEvent.layout; size.value = { width, height }; report(id, height); }, [id, report, size]);
|
|
218
|
+
const name = testID === undefined ? undefined : `${testID}-toast`;
|
|
219
|
+
// A notice behind a collapsed stack, or past the visible ones, shows no content: it takes no touches and assistive technology skips it.
|
|
220
|
+
return _jsx(GestureDetector, { gesture: pan, children: _jsx(Reanimated.View, { testID: name, onLayout: onLayout, pointerEvents: interactive ? 'auto' : 'none', accessibilityElementsHidden: hidden || (!front && !interactive), importantForAccessibility: hidden || (!front && !interactive) ? 'no-hide-descendants' : 'auto', style: [styles.card, lift === 1 ? styles.top : styles.bottom, narrow ? styles.narrow : styles.wide, { backgroundColor: colors.nested }, cardStyle], children: _jsx(Reanimated.View, { style: contentStyle, children: _jsx(Capsule, { message: value.message, description: value.description, severity: value.severity, action: value.action, dismissName: value.dismissName, onDismiss: dismiss, hug: true, style: styles.bare }) }) }) });
|
|
221
|
+
});
|
|
222
|
+
/**
|
|
223
|
+
* The host for transient HIG notices on native. Mount it once, last inside the root view, within HIGProvider,
|
|
224
|
+
* GestureHandlerRootView and SafeAreaProvider; `toast()` then works from anywhere. It draws the same capsule as `Toast`,
|
|
225
|
+
* stacked the way Sonner stacks on web: the newest in front, up to three visible, each leaving after its time, by its
|
|
226
|
+
* close control or by a swipe. A touch holds every notice's time and so does the app going to the background.
|
|
227
|
+
*
|
|
228
|
+
* Reanimated moves the notices and Gesture Handler reads the finger, both on the UI thread; only transforms and opacity
|
|
229
|
+
* change while anything moves. With no notice showing it renders nothing.
|
|
230
|
+
*/
|
|
231
|
+
export function Toaster({ position = 'bottom-center', expand = false, visibleToasts = TOAST_VISIBLE, gap = TOAST_GAP, offset, duration = TOAST_DURATION, swipeDirections, testID }) {
|
|
232
|
+
const env = useHIG(), insets = useContext(SafeAreaInsetsContext) ?? NO_INSETS, { width } = useWindowDimensions();
|
|
233
|
+
const token = useRef({}).current;
|
|
234
|
+
const list = useSyncExternalStore(subscribe, snapshot, snapshot), active = useSyncExternalStore(subscribe, () => hosts[hosts.length - 1] === token, () => false);
|
|
235
|
+
useEffect(() => attach(token), [token]);
|
|
236
|
+
// A screen reader cannot reach content the collapsed stack hides, so the stack stays expanded while one runs.
|
|
237
|
+
const [reader, setReader] = useState(false);
|
|
238
|
+
useEffect(() => { let alive = true; void AccessibilityInfo.isScreenReaderEnabled().then(value => { if (alive && value)
|
|
239
|
+
setReader(true); }).catch(() => { }); const subscription = AccessibilityInfo.addEventListener('screenReaderChanged', setReader); return () => { alive = false; subscription.remove(); }; }, []);
|
|
240
|
+
const open = expand || reader, visible = visibleToasts >= 1 ? Math.floor(visibleToasts) : 1;
|
|
241
|
+
const order = useMemo(() => active ? toastOrder(list) : [], [active, list]);
|
|
242
|
+
const stack = useSharedValue({ keys: [], heights: [] }), expanded = useSharedValue(open), held = useSharedValue(false);
|
|
243
|
+
useEffect(() => { expanded.value = open; }, [open, expanded]);
|
|
244
|
+
const heights = useRef(new Map()).current, published = useRef({ keys: [], heights: [] });
|
|
245
|
+
const clocks = useRef(new Map()).current;
|
|
246
|
+
const holds = useRef(new Set()).current, awake = useRef(AppState.currentState !== 'background' && AppState.currentState !== 'inactive');
|
|
247
|
+
// The notices the last commit drew. One that leaves stays for its exit only if it is among them: a notice waiting behind the stack has nothing on screen to take away, so no card is mounted to play its exit.
|
|
248
|
+
const drawn = useRef(new Set());
|
|
249
|
+
const rank = new Map(order.map((entry, index) => [entry.key, index]));
|
|
250
|
+
// One notice past the visible ones stays mounted and transparent, so the notice the stack pushes out fades where it is and the one it uncovers is ready.
|
|
251
|
+
const mounted = active ? list.filter(entry => entry.leaving ? drawn.current.has(entry.key) && heights.has(entry.key) : rank.get(entry.key) <= visible) : [];
|
|
252
|
+
const latest = useRef({ order, visible, duration, mounted });
|
|
253
|
+
latest.current = { order, visible, duration, mounted };
|
|
254
|
+
// The stack the UI thread lays out: live notices that have been measured, front first. A new notice joins when its height is known, so nothing moves for it before it can be placed.
|
|
255
|
+
const publish = useCallback(() => {
|
|
256
|
+
const keys = [], sizes = [];
|
|
257
|
+
for (const entry of latest.current.order) {
|
|
258
|
+
const height = heights.get(entry.key);
|
|
259
|
+
if (height === undefined)
|
|
260
|
+
continue;
|
|
261
|
+
keys.push(entry.key);
|
|
262
|
+
sizes.push(height);
|
|
263
|
+
}
|
|
264
|
+
const last = published.current;
|
|
265
|
+
if (last.keys.length === keys.length && keys.every((key, index) => key === last.keys[index] && sizes[index] === last.heights[index]))
|
|
266
|
+
return;
|
|
267
|
+
published.current = { keys, heights: sizes };
|
|
268
|
+
stack.value = { keys, heights: sizes };
|
|
269
|
+
}, [heights, stack]);
|
|
270
|
+
// A notice's time runs only while it is one of the visible notices, nothing is held and the app is in front. Raising it again under the same id starts its time over.
|
|
271
|
+
const sync = useCallback(() => {
|
|
272
|
+
const now = Date.now(), paused = holds.size > 0 || !awake.current, live = new Set();
|
|
273
|
+
latest.current.order.forEach((entry, index) => {
|
|
274
|
+
const total = entry.duration ?? toastDuration(latest.current.duration) ?? TOAST_DURATION;
|
|
275
|
+
if (total === Infinity)
|
|
276
|
+
return;
|
|
277
|
+
let record = clocks.get(entry.key);
|
|
278
|
+
if (!record || record.revision !== entry.revision) {
|
|
279
|
+
if (record?.timer != null)
|
|
280
|
+
clearTimeout(record.timer);
|
|
281
|
+
record = { clock: { remaining: total, startedAt: null }, revision: entry.revision, timer: null };
|
|
282
|
+
clocks.set(entry.key, record);
|
|
283
|
+
}
|
|
284
|
+
live.add(entry.key);
|
|
285
|
+
const runs = !paused && index < latest.current.visible && heights.has(entry.key);
|
|
286
|
+
if (runs && record.clock.startedAt === null) {
|
|
287
|
+
record.clock = toastClockRun(record.clock, now);
|
|
288
|
+
record.timer = setTimeout(() => leave(entry.key, true), record.clock.remaining);
|
|
289
|
+
}
|
|
290
|
+
else if (!runs && record.clock.startedAt !== null) {
|
|
291
|
+
record.clock = toastClockPause(record.clock, now);
|
|
292
|
+
if (record.timer != null)
|
|
293
|
+
clearTimeout(record.timer);
|
|
294
|
+
record.timer = null;
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
for (const [key, record] of clocks)
|
|
298
|
+
if (!live.has(key)) {
|
|
299
|
+
if (record.timer != null)
|
|
300
|
+
clearTimeout(record.timer);
|
|
301
|
+
clocks.delete(key);
|
|
302
|
+
}
|
|
303
|
+
}, [clocks, heights, holds]);
|
|
304
|
+
const report = useCallback((key, height) => { if (heights.get(key) === height)
|
|
305
|
+
return; heights.set(key, height); publish(); sync(); }, [heights, publish, sync]);
|
|
306
|
+
// Time stops the moment a finger lands. The stack expands only if it stays, so a tap or a quick swipe does not stir it.
|
|
307
|
+
const peek = useRef(null);
|
|
308
|
+
const settle = useCallback(() => {
|
|
309
|
+
if (holds.size === 0) {
|
|
310
|
+
if (peek.current !== null) {
|
|
311
|
+
clearTimeout(peek.current);
|
|
312
|
+
peek.current = null;
|
|
313
|
+
}
|
|
314
|
+
held.value = false;
|
|
315
|
+
}
|
|
316
|
+
else if (peek.current === null)
|
|
317
|
+
peek.current = setTimeout(() => { held.value = holds.size > 0; }, TOAST_HOLD);
|
|
318
|
+
sync();
|
|
319
|
+
}, [holds, held, sync]);
|
|
320
|
+
// The notices that take touches. A finger reported on any other arrived late, from a notice that has since been pushed out of reach, and is ignored.
|
|
321
|
+
const reach = useRef(new Set());
|
|
322
|
+
const hold = useCallback((key, down) => { if (!down)
|
|
323
|
+
holds.delete(key);
|
|
324
|
+
else if (reach.current.has(key))
|
|
325
|
+
holds.add(key); settle(); }, [holds, settle]);
|
|
326
|
+
useEffect(() => {
|
|
327
|
+
const known = new Set(list.map(entry => entry.key));
|
|
328
|
+
for (const key of [...heights.keys()])
|
|
329
|
+
if (!known.has(key))
|
|
330
|
+
heights.delete(key);
|
|
331
|
+
// Only a notice that takes touches can be holding the time. One that is gone, leaving, or pushed out of reach may never report the finger lifting, and would hold every notice for good.
|
|
332
|
+
const touchable = new Set();
|
|
333
|
+
latest.current.order.forEach((entry, index) => { if (index < visible && (index === 0 || open))
|
|
334
|
+
touchable.add(entry.key); });
|
|
335
|
+
reach.current = touchable;
|
|
336
|
+
for (const key of [...holds])
|
|
337
|
+
if (!touchable.has(key))
|
|
338
|
+
holds.delete(key);
|
|
339
|
+
drawn.current = new Set(latest.current.mounted.map(entry => entry.key));
|
|
340
|
+
// A notice dismissed while it is not drawn, or before it was laid out, has no exit to play.
|
|
341
|
+
if (active)
|
|
342
|
+
for (const entry of list)
|
|
343
|
+
if (entry.leaving && !drawn.current.has(entry.key))
|
|
344
|
+
forget(entry.key);
|
|
345
|
+
publish();
|
|
346
|
+
settle();
|
|
347
|
+
}, [active, list, visible, duration, open, heights, holds, publish, settle]);
|
|
348
|
+
useEffect(() => { const subscription = AppState.addEventListener('change', state => { awake.current = state === 'active'; sync(); }); return () => subscription.remove(); }, [sync]);
|
|
349
|
+
useEffect(() => () => { for (const record of clocks.values())
|
|
350
|
+
if (record.timer != null)
|
|
351
|
+
clearTimeout(record.timer); clocks.clear(); if (peek.current !== null)
|
|
352
|
+
clearTimeout(peek.current); }, [clocks]);
|
|
353
|
+
// One announcement per burst: an error if there is one, otherwise the newest, which is the one drawn in front. A notice that is redrawn unchanged is not read again.
|
|
354
|
+
const spoken = useRef(new Map());
|
|
355
|
+
useEffect(() => {
|
|
356
|
+
if (!active)
|
|
357
|
+
return;
|
|
358
|
+
const delta = notificationDelta(spoken.current, [...order].reverse().map(entry => ({ id: String(entry.key), message: [entry.value.message, entry.value.description].filter(Boolean).join('. '), severity: entry.value.severity })));
|
|
359
|
+
spoken.current = delta.next;
|
|
360
|
+
if (delta.message)
|
|
361
|
+
speak(delta.message, delta.severity);
|
|
362
|
+
}, [active, order]);
|
|
363
|
+
const edge = toastEdge(position);
|
|
364
|
+
const directions = useMemo(() => swipeDirections ?? toastSwipeDirections(position), [swipeDirections, position]);
|
|
365
|
+
if (mounted.length === 0)
|
|
366
|
+
return null;
|
|
367
|
+
const narrow = width < TOAST_NARROW, fallback = narrow ? TOAST_NARROW_OFFSET : TOAST_OFFSET;
|
|
368
|
+
const distance = (side) => (typeof offset === 'object' ? offset[side] : offset) ?? fallback;
|
|
369
|
+
const label = env.messages.notifications ?? en.notifications;
|
|
370
|
+
// `left` and `right` are physical, as in Sonner. The layer always lays out left to right, so start and end on the rail are the physical left and right whatever the provider or the OS says (React Native swaps `left` and `right` themselves under an RTL OS). The capsule sets the provider's direction on its own row.
|
|
371
|
+
return _jsx(View, { testID: testID, pointerEvents: 'box-none', style: [StyleSheet.absoluteFill, styles.layer], children: _jsx(View, { pointerEvents: 'box-none', accessibilityLabel: label, style: [styles.rail, { top: insets.top + distance('top'), bottom: insets.bottom + distance('bottom'), start: insets.left + distance('left'), end: insets.right + distance('right'), alignItems: edge.x === 'center' ? 'center' : edge.x === 'left' ? 'flex-start' : 'flex-end' }], children: mounted.map(entry => {
|
|
372
|
+
const index = rank.get(entry.key) ?? -1, hidden = index < 0 || index >= visible;
|
|
373
|
+
return _jsx(Card, { entry: entry, front: index === 0, hidden: hidden, interactive: !hidden && !entry.leaving && (index === 0 || open), lift: edge.lift, gap: gap, visible: visible, reduce: env.reducedMotion, left: directions.includes('left'), right: directions.includes('right'), up: directions.includes('top'), down: directions.includes('bottom'), narrow: narrow, testID: testID, stack: stack, expanded: expanded, held: held, report: report, hold: hold }, entry.key);
|
|
374
|
+
}) }) });
|
|
375
|
+
}
|
|
376
|
+
const styles = StyleSheet.create({
|
|
377
|
+
layer: { direction: 'ltr' },
|
|
378
|
+
rail: { position: 'absolute' },
|
|
379
|
+
// The capsule's own fill, radius and shadow sit on the moving view, so the content inside can fade without the capsule going with it.
|
|
380
|
+
card: { position: 'absolute', borderRadius: 22, boxShadow: '0 4px 16px #0006' },
|
|
381
|
+
top: { top: 0 },
|
|
382
|
+
bottom: { bottom: 0 },
|
|
383
|
+
narrow: { maxWidth: '100%' },
|
|
384
|
+
wide: { maxWidth: TOAST_WIDTH },
|
|
385
|
+
bare: { backgroundColor: 'transparent', boxShadow: undefined },
|
|
386
|
+
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { type ScrollViewProps } from 'react-native';
|
|
2
3
|
import type { HIGMessages } from '@bloxwap/hig/contracts/messages';
|
|
3
4
|
import { type BarMarkElement } from './bar-mark.js';
|
|
4
|
-
export type { BarMarkElement } from './bar-mark.js';
|
|
5
|
+
export type { BarMarkElement, BarMarkFigure } from './bar-mark.js';
|
|
5
6
|
/** The actions HIG names itself. */
|
|
6
7
|
export type TokenActionId = 'send' | 'receive' | 'stake' | 'unstake';
|
|
7
8
|
export interface TokenAction {
|
|
@@ -16,14 +17,20 @@ export interface TokenAction {
|
|
|
16
17
|
export interface TokenActionBlockProps {
|
|
17
18
|
/** Heading, usually the ticker: HYPE. */
|
|
18
19
|
symbol: string;
|
|
19
|
-
/** Title of the assets bar: Hyperliquid. */
|
|
20
|
-
name
|
|
20
|
+
/** Title of the assets bar: Hyperliquid. Needed only with `assets`; the symbol stands in without it. */
|
|
21
|
+
name?: string;
|
|
21
22
|
/** Total holding in dollars, on the trailing edge of the assets bar. Defaults to the sum of the asset values; null reads as unknown. */
|
|
22
23
|
value?: number | null;
|
|
23
|
-
/**
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
|
|
24
|
+
/** The holding in token units, for a token with no dollar value: with `value` left out or null it is drawn in place of the dollar total. */
|
|
25
|
+
units?: number | null;
|
|
26
|
+
/** Host text after the units, such as ` BLOX`. */
|
|
27
|
+
unitsSuffix?: string;
|
|
28
|
+
/** Format of the units; default `{maximumFractionDigits:6}`. */
|
|
29
|
+
unitsOptions?: Intl.NumberFormatOptions;
|
|
30
|
+
/** Where the token is held: Staked, Core, Paper. Leave it out to draw no assets bar. */
|
|
31
|
+
assets?: readonly BarMarkElement[];
|
|
32
|
+
/** The chains the token sits on. Leave it out to draw no chains bar. */
|
|
33
|
+
chains?: readonly BarMarkElement[];
|
|
27
34
|
/** Title of the chains bar. Defaults to the built-in "Chains". */
|
|
28
35
|
chainsTitle?: string;
|
|
29
36
|
actions: readonly TokenAction[];
|
|
@@ -31,9 +38,19 @@ export interface TokenActionBlockProps {
|
|
|
31
38
|
onBack?: () => void;
|
|
32
39
|
/** A control on the trailing edge of the header, usually an IconButton. */
|
|
33
40
|
headerAction?: React.ReactNode;
|
|
41
|
+
/** A line under the actions, for example why some are missing. `noteTone` tints it as in SwapPanelBlock. */
|
|
42
|
+
note?: React.ReactNode;
|
|
43
|
+
noteTone?: 'muted' | 'warning' | 'negative';
|
|
44
|
+
/** Keeps the header pinned while the rest scrolls: the block becomes its own scroll view with the header as its sticky first child, transparent at rest and filled once content scrolls under it. Place it in a bounded container, such as a sheet body. */
|
|
45
|
+
stickyHeader?: boolean;
|
|
46
|
+
/** With `stickyHeader`: the header's fill once content is under it. Defaults to the background role; in a sheet pass the sheet's fill. */
|
|
47
|
+
stickyHeaderBackground?: string;
|
|
48
|
+
/** The scroll view used with `stickyHeader`, such as a sheet library's own. Defaults to React Native's ScrollView. */
|
|
49
|
+
scrollComponent?: React.ComponentType<ScrollViewProps>;
|
|
50
|
+
/** `nativeID` of the title, so a sheet around the block can name itself with `accessibilityLabelledBy` (Android). */
|
|
51
|
+
headingId?: string;
|
|
34
52
|
testID?: string;
|
|
35
53
|
}
|
|
36
54
|
/** An action's text: its own `label`, else the built-in name of its id, else the id. */
|
|
37
55
|
export declare const tokenActionLabel: (action: TokenAction, messages: Partial<HIGMessages>) => string;
|
|
38
|
-
|
|
39
|
-
export declare function TokenActionBlock({ symbol, name, value, assets, chains, chainsTitle, actions, onBack, headerAction, testID }: TokenActionBlockProps): React.JSX.Element;
|
|
56
|
+
export declare function TokenActionBlock({ symbol, name, value, units, unitsSuffix, unitsOptions, assets, chains, chainsTitle, actions, onBack, headerAction, note, noteTone, stickyHeader, stickyHeaderBackground, scrollComponent, headingId, testID }: TokenActionBlockProps): React.JSX.Element;
|
|
@@ -1,20 +1,33 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { View } from 'react-native';
|
|
3
|
-
import {
|
|
3
|
+
import { StickyHeaderLayout } from './sticky-header.js';
|
|
4
|
+
import { formatNumber } from './number-format.js';
|
|
5
|
+
import { withAlpha } from '@bloxwap/hig/tokens';
|
|
4
6
|
import * as en from '@bloxwap/hig/contracts/messages';
|
|
5
|
-
import { useColors, useHIG, useMessages } from './provider.js';
|
|
7
|
+
import { useColors, useHIG, useMessages, useNumberLocale } from './provider.js';
|
|
6
8
|
import { Text } from './surface.js';
|
|
7
9
|
import { Button, IconButton } from './button.js';
|
|
8
10
|
import { ChevronIcon } from './icons.js';
|
|
9
11
|
import { AnimatedNumberReadout } from './animated-number.js';
|
|
10
|
-
import {
|
|
12
|
+
import { figureProps } from './figure.js';
|
|
13
|
+
import { BarMark, BarMarkFigureContext } from './bar-mark.js';
|
|
11
14
|
const usd = { style: 'currency', currency: 'USD' };
|
|
15
|
+
const unitsFormat = { maximumFractionDigits: 6 };
|
|
12
16
|
const held = (value) => Number.isFinite(value) && value > 0;
|
|
13
17
|
/** An action's text: its own `label`, else the built-in name of its id, else the id. */
|
|
14
18
|
export const tokenActionLabel = (action, messages) => action.label ?? (action.id === 'send' ? messages.swapActionSend ?? en.swapActionSend : action.id === 'receive' ? messages.receive ?? en.receive : action.id === 'stake' ? messages.stake ?? en.stake : action.id === 'unstake' ? messages.unstake ?? en.unstake : action.id);
|
|
15
19
|
/** One token as a screen: a header, where it is held, which chains it sits on, then what the user can do with it. */
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
/** Legend figures inside the block move place by place, like its total. */
|
|
21
|
+
const animatedFigure = (figure, { testID }) => _jsx(AnimatedNumberReadout, { ...figureProps(figure), tone: 'faint', testID: testID, style: { fontSize: 14, lineHeight: 21 } });
|
|
22
|
+
export function TokenActionBlock({ symbol, name, value, units, unitsSuffix, unitsOptions = unitsFormat, assets, chains, chainsTitle, actions, onBack, headerAction, note, noteTone = 'muted', stickyHeader, stickyHeaderBackground, scrollComponent, headingId, testID }) {
|
|
23
|
+
const colors = useColors(), t = useMessages(), { direction } = useHIG(), locale = useNumberLocale();
|
|
24
|
+
const total = value !== undefined ? value : (assets ?? []).reduce((sum, asset) => sum + (held(asset.value) ? asset.value : 0), 0);
|
|
25
|
+
// With no dollar value the units are the headline, as an AccountBlock row headlines them.
|
|
26
|
+
const headline = units !== undefined && value == null ? _jsx(AnimatedNumberReadout, { value: units, options: unitsOptions, suffix: unitsSuffix, tone: 'muted', testID: 'token-units', style: { fontSize: 14, lineHeight: 21 } }, 'units') : _jsx(AnimatedNumberReadout, { value: total, options: usd, tone: 'muted', testID: 'token-value', style: { fontSize: 14, lineHeight: 21 } }, 'value');
|
|
27
|
+
const tone = noteTone === 'warning' ? colors.warning : noteTone === 'negative' ? colors.negative : null;
|
|
28
|
+
const header = _jsxs(View, { testID: 'token-header', style: { flexDirection: 'row', alignItems: 'center', minHeight: 44 }, children: [_jsx(View, { style: { minWidth: 44, alignItems: 'flex-start' }, children: onBack ? _jsx(IconButton, { intent: 'ghost', label: t.back, suppressFeedback: true, testID: 'token-back', onPress: onBack, children: _jsx(View, { style: { transform: [{ rotate: direction === 'rtl' ? '-90deg' : '90deg' }] }, children: _jsx(ChevronIcon, { color: colors.text }) }) }) : null }), _jsx(Text, { testID: 'token-title', nativeID: headingId, accessibilityRole: 'header', numberOfLines: 1, style: { flex: 1, textAlign: 'center', fontSize: 17, lineHeight: 24, fontWeight: '600', color: colors.text }, children: symbol }), _jsx(View, { style: { minWidth: 44, alignItems: 'flex-end' }, children: headerAction })] });
|
|
29
|
+
const body = _jsxs(_Fragment, { children: [assets || chains ? _jsx(BarMarkFigureContext.Provider, { value: animatedFigure, children: _jsxs(View, { testID: 'token-bars', style: { gap: 20, marginTop: 16, paddingHorizontal: 4 }, children: [assets ? _jsx(BarMark, { testID: 'token-assets', surface: false, title: name ?? symbol, elements: assets, description: headline }) : null, chains ? _jsx(BarMark, { testID: 'token-chains', surface: false, title: chainsTitle ?? t.swapChains, elements: chains, description: formatNumber(chains.filter(chain => held(chain.value)).length, locale) }) : null] }) }) : null, actions.length > 0 ? _jsx(View, { testID: 'token-actions', style: { gap: 8, marginTop: 16 }, children: actions.map(action => _jsx(Button, { testID: `token-action-${action.id}`, fullWidth: true, intent: action.intent ?? 'secondary', disabled: action.disabled, onPress: action.onSelect, children: tokenActionLabel(action, t) }, action.id)) }) : null, note != null && note !== false ? _jsx(View, { testID: 'token-note', style: [{ marginTop: actions.length > 0 ? 8 : 16 }, tone ? { paddingVertical: 12, paddingHorizontal: 16, borderRadius: 16, backgroundColor: withAlpha(tone, 0.1) } : { paddingHorizontal: 4 }], children: _jsx(Text, { style: { fontSize: 14, lineHeight: 21, color: tone ?? colors.muted }, children: note }) }) : null] });
|
|
30
|
+
if (stickyHeader)
|
|
31
|
+
return _jsx(StickyHeaderLayout, { testID: testID, headerTestID: 'token-sticky-header', header: header, background: stickyHeaderBackground, scrollComponent: scrollComponent, children: body });
|
|
32
|
+
return _jsxs(View, { testID: testID, style: { padding: 16 }, children: [header, body] });
|
|
20
33
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { View, type ScrollViewProps } from 'react-native';
|
|
2
3
|
import type { AssetArtwork } from './asset-balance-row.js';
|
|
3
4
|
export type { AssetArtwork } from './asset-balance-row.js';
|
|
4
5
|
/** The trading words of the block. HIG's built-in strings hold no trading terms, so the host supplies them, translated. */
|
|
@@ -21,6 +22,8 @@ export interface TradeHistoryDetail {
|
|
|
21
22
|
options?: Intl.NumberFormatOptions;
|
|
22
23
|
prefix?: string;
|
|
23
24
|
suffix?: string;
|
|
25
|
+
/** With a number `value`: host-formatted text drawn and read in place of Intl's, still moving place by place. */
|
|
26
|
+
formattedValue?: string;
|
|
24
27
|
}
|
|
25
28
|
export interface TradeHistoryAction {
|
|
26
29
|
id: string;
|
|
@@ -35,13 +38,27 @@ export interface TradeHistoryDetailBlockProps {
|
|
|
35
38
|
/** Asset name: Amazon. */
|
|
36
39
|
name: string;
|
|
37
40
|
icon?: AssetArtwork;
|
|
41
|
+
/** Short ticker for the fallback disc when there is no `icon`: BTC. Without it the disc shows the first letters of the name. */
|
|
42
|
+
symbol?: string;
|
|
38
43
|
side: 'long' | 'short';
|
|
39
44
|
/** 20 reads `20×`. */
|
|
40
45
|
leverage?: number;
|
|
46
|
+
/** A short muted qualifier after the leverage, read with it: current. */
|
|
47
|
+
leverageNote?: string;
|
|
41
48
|
/** Net profit and loss in dollars. `null` reads as unknown. */
|
|
42
49
|
pnl: number | null;
|
|
50
|
+
/** Format of the headline result. Defaults to signed US dollars with up to four decimals. The provider's `numberFormat` is merged under it. */
|
|
51
|
+
pnlOptions?: Intl.NumberFormatOptions;
|
|
43
52
|
/** Return on margin as a fraction: 0.0284 reads +2.84%. */
|
|
44
53
|
pnlPercent?: number | null;
|
|
54
|
+
/** Format of the return on margin. Defaults to a signed percent with two decimals. */
|
|
55
|
+
percentOptions?: Intl.NumberFormatOptions;
|
|
56
|
+
/** One muted sentence under the details, such as that part of the record is missing. */
|
|
57
|
+
note?: string;
|
|
58
|
+
/** Short host text in a badge beside the title: Demo. */
|
|
59
|
+
badge?: string;
|
|
60
|
+
/** Ref to a View around the summary (the asset line, the headline figure and the return), for a host that captures it as an image. Without it the summary has no wrapper. */
|
|
61
|
+
summaryRef?: React.Ref<View>;
|
|
45
62
|
/** Entry and exit prices. With both, one bar runs from entry to exit in the result colour, with the two prices under it, in place of two rows. */
|
|
46
63
|
entry?: number;
|
|
47
64
|
exit?: number;
|
|
@@ -53,7 +70,15 @@ export interface TradeHistoryDetailBlockProps {
|
|
|
53
70
|
onBack?: () => void;
|
|
54
71
|
/** A control on the trailing edge of the header, usually an IconButton. */
|
|
55
72
|
headerAction?: React.ReactNode;
|
|
73
|
+
/** Fills the View drawn with `summaryRef`, so an image captured from it is not transparent: `true` for the background role, or a colour such as the sheet's `useColors().overlay`. */
|
|
74
|
+
summaryBackground?: boolean | string;
|
|
75
|
+
/** Keeps the header pinned while the rest scrolls: the block becomes its own scroll view with the header as its sticky first child, transparent at rest and filled once content scrolls under it. Place it in a bounded container. */
|
|
76
|
+
stickyHeader?: boolean;
|
|
77
|
+
/** Fill behind the pinned header once content scrolls under it. Defaults to the background role; in a sheet pass the sheet's fill. */
|
|
78
|
+
stickyHeaderBackground?: string;
|
|
79
|
+
/** The scroll view used with `stickyHeader`, such as a sheet library's own. */
|
|
80
|
+
scrollComponent?: React.ComponentType<ScrollViewProps>;
|
|
56
81
|
testID?: string;
|
|
57
82
|
}
|
|
58
83
|
/** The full record of one closed trade, drawn on the screen without cards because none of it is pressable: the asset with its side and leverage on one line, the net profit and loss with its return on margin, a bar from the entry price to the exit price, the host's other figures as a compact grid, and the host's actions side by side. */
|
|
59
|
-
export declare function TradeHistoryDetailBlock({ labels, name, icon, side, leverage, pnl, pnlPercent, entry, exit, priceOptions, details, actions, onBack, headerAction, testID }: TradeHistoryDetailBlockProps): React.JSX.Element;
|
|
84
|
+
export declare function TradeHistoryDetailBlock({ labels, name, icon, symbol, side, leverage, leverageNote, pnl, pnlOptions, pnlPercent, percentOptions, entry, exit, priceOptions, details, note, badge, summaryRef, summaryBackground, actions, onBack, headerAction, stickyHeader, stickyHeaderBackground, scrollComponent, testID }: TradeHistoryDetailBlockProps): React.JSX.Element;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Image, View } from 'react-native';
|
|
3
|
-
import { useColors, useFills, useHIG,
|
|
3
|
+
import { useColors, useFills, useHIG, useNumberLocale } from './provider.js';
|
|
4
4
|
import { Text } from './surface.js';
|
|
5
5
|
import { BarPnl } from './bar-pnl.js';
|
|
6
|
-
import { Button
|
|
7
|
-
import {
|
|
6
|
+
import { Button } from './button.js';
|
|
7
|
+
import { ScreenHeader } from './screen-header.js';
|
|
8
|
+
import { StickyHeaderLayout } from './sticky-header.js';
|
|
8
9
|
import { AnimatedNumberReadout } from './animated-number.js';
|
|
9
10
|
import { formatNumberReadout } from './animated-number-model.js';
|
|
10
11
|
const pnlUsd = { style: 'currency', currency: 'USD', signDisplay: 'exceptZero', maximumFractionDigits: 4 };
|
|
@@ -24,15 +25,22 @@ function Sentence({ template, text, value, options, tone, testID }) {
|
|
|
24
25
|
return _jsxs(View, { accessible: true, accessibilityLabel: reading, testID: testID, style: { direction, flexDirection: 'row', alignItems: 'center', justifyContent: 'center', flexShrink: 1 }, children: [parts[0] ? _jsx(Text, { accessible: false, style: words, children: parts[0] }) : null, _jsx(AnimatedNumberReadout, { value: value, options: options, tone: tone, style: type }), parts[1] ? _jsx(Text, { accessible: false, style: words, children: parts[1] }) : null] });
|
|
25
26
|
}
|
|
26
27
|
/** The full record of one closed trade, drawn on the screen without cards because none of it is pressable: the asset with its side and leverage on one line, the net profit and loss with its return on margin, a bar from the entry price to the exit price, the host's other figures as a compact grid, and the host's actions side by side. */
|
|
27
|
-
export function TradeHistoryDetailBlock({ labels, name, icon, side, leverage, pnl, pnlPercent, entry, exit, priceOptions, details, actions = [], onBack, headerAction, testID }) {
|
|
28
|
-
const colors = useColors(), fills = useFills(),
|
|
28
|
+
export function TradeHistoryDetailBlock({ labels, name, icon, symbol, side, leverage, leverageNote, pnl, pnlOptions = pnlUsd, pnlPercent, percentOptions = pnlShare, entry, exit, priceOptions, details, note, badge, summaryRef, summaryBackground, actions = [], onBack, headerAction, stickyHeader, stickyHeaderBackground, scrollComponent, testID }) {
|
|
29
|
+
const colors = useColors(), fills = useFills(), { direction } = useHIG(), locale = useNumberLocale();
|
|
29
30
|
const long = side === 'long', word = long ? labels.long : labels.short, tint = long ? colors.up : colors.down;
|
|
30
31
|
const tone = known(pnl) && pnl > 0 ? 'up' : known(pnl) && pnl < 0 ? 'down' : 'text';
|
|
31
32
|
const turns = known(leverage) ? formatNumberReadout(leverage, locale, gearing).text + times : null;
|
|
32
33
|
const shape = { width: avatar, height: avatar, borderRadius: avatar / 2, backgroundColor: fills.raised, alignItems: 'center', justifyContent: 'center', overflow: 'hidden' };
|
|
33
|
-
const art = typeof icon === 'string' ? _jsx(Image, { accessible: false, accessibilityIgnoresInvertColors: true, source: { uri: icon }, style: shape }) : _jsx(View, { style: shape, children: icon ?? _jsx(Text, { accessible: false, maxFontSizeMultiplier: 1, style: { fontSize: 9, lineHeight: 12, fontWeight: '600', color: colors.muted }, children: name.slice(0, 3) }) });
|
|
34
|
+
const art = typeof icon === 'string' ? _jsx(Image, { accessible: false, accessibilityIgnoresInvertColors: true, source: { uri: icon }, style: shape }) : _jsx(View, { style: shape, children: icon ?? _jsx(Text, { accessible: false, maxFontSizeMultiplier: 1, style: { fontSize: 9, lineHeight: 12, fontWeight: '600', color: colors.muted }, children: symbol ?? name.slice(0, 3) }) });
|
|
34
35
|
const meta = { fontSize: 14, lineHeight: 20 };
|
|
36
|
+
// The summary gets a wrapper only when the host asks for a ref to capture it, so the default tree is unchanged.
|
|
37
|
+
const fill = summaryBackground === true ? colors.background : typeof summaryBackground === 'string' && summaryBackground ? summaryBackground : undefined;
|
|
38
|
+
const wrap = (summary) => summaryRef ? _jsx(View, { ref: summaryRef, collapsable: false, testID: 'trade-summary', style: fill ? { backgroundColor: fill } : undefined, children: summary }) : summary;
|
|
35
39
|
// Three figures to a line: a small label over its value.
|
|
36
|
-
const rows = details.map(detail => _jsxs(View, { testID: `trade-detail-${detail.label}`, style: { width: '33.333%', paddingEnd: 8, gap: 2 }, children: [_jsx(Text, { numberOfLines: 1, style: { fontSize: 12, lineHeight: 16, color: colors.muted }, children: detail.label }), typeof detail.value === 'number' ? _jsx(AnimatedNumberReadout, { value: detail.value, options: detail.options, prefix: detail.prefix, suffix: detail.suffix, tone: 'text', style: { fontSize: 15, lineHeight: 22, fontWeight: '600' } }) : _jsx(Text, { style: { fontSize: 15, lineHeight: 22, fontWeight: '600', color: colors.text }, children: detail.value })] }, detail.label));
|
|
37
|
-
|
|
40
|
+
const rows = details.map(detail => _jsxs(View, { testID: `trade-detail-${detail.label}`, style: { width: '33.333%', paddingEnd: 8, gap: 2 }, children: [_jsx(Text, { numberOfLines: 1, style: { fontSize: 12, lineHeight: 16, color: colors.muted }, children: detail.label }), typeof detail.value === 'number' ? _jsx(AnimatedNumberReadout, { value: detail.value, options: detail.options, prefix: detail.prefix, suffix: detail.suffix, formattedValue: detail.formattedValue, animateFormatted: !!detail.formattedValue, tone: 'text', style: { fontSize: 15, lineHeight: 22, fontWeight: '600' } }) : _jsx(Text, { style: { fontSize: 15, lineHeight: 22, fontWeight: '600', color: colors.text }, children: detail.value })] }, detail.label));
|
|
41
|
+
const header = _jsx(ScreenHeader, { testID: 'trade', title: labels.title, badge: badge, onBack: onBack, action: headerAction });
|
|
42
|
+
const body = _jsxs(_Fragment, { children: [wrap(_jsxs(_Fragment, { children: [_jsxs(View, { testID: 'trade-asset', accessible: true, accessibilityLabel: [name, word, turns, leverageNote].filter(Boolean).join(', '), style: { direction, flexDirection: 'row', flexWrap: 'wrap', alignItems: 'center', justifyContent: 'center', gap: 8, marginTop: 16 }, children: [_jsx(View, { ...hidden, children: art }), _jsx(Text, { ...hidden, numberOfLines: 1, style: { flexShrink: 1, fontSize: 16, lineHeight: 24, fontWeight: '600', color: colors.text }, children: name }), _jsx(View, { ...hidden, children: _jsxs(View, { style: { direction, flexDirection: 'row', alignItems: 'center', gap: 4 }, children: [_jsx(Text, { testID: 'trade-side-arrow', style: { ...meta, fontWeight: '600', color: tint }, children: long ? up : down }), _jsx(Text, { testID: 'trade-side', style: { ...meta, fontWeight: '600', color: tint, textTransform: 'uppercase' }, children: word }), turns ? _jsx(Text, { testID: 'trade-leverage', style: { ...meta, color: colors.muted }, children: turns }) : null, leverageNote ? _jsx(Text, { testID: 'trade-leverage-note', style: { ...meta, color: colors.muted }, children: leverageNote }) : null] }) })] }), _jsxs(View, { testID: 'trade-pnl', style: { alignItems: 'center', gap: 4, marginTop: 8 }, children: [_jsx(AnimatedNumberReadout, { testID: 'trade-pnl-value', label: labels.netPnl, value: pnl, options: pnlOptions, tone: tone, style: { fontSize: 40, lineHeight: 48, fontWeight: '700' } }), pnlPercent !== undefined ? _jsx(Sentence, { testID: 'trade-pnl-percent', template: labels.onMargin, text: known(pnlPercent) ? formatNumberReadout(pnlPercent, locale, percentOptions).text : unknown, value: known(pnlPercent) ? pnlPercent : null, options: percentOptions, tone: tone }) : null] })] })), known(entry) && known(exit) ? _jsx(View, { style: { marginTop: 20, paddingHorizontal: 4 }, children: _jsx(BarPnl, { testID: 'trade-bar', surface: false, fit: true, side: side, entry: entry, mark: exit, labels: { entry: labels.entry ?? empty, mark: labels.exit ?? empty, liquidation: empty }, priceOptions: priceOptions }) }) : null, details.length > 0 ? _jsx(View, { testID: 'trade-details', style: { direction, flexDirection: 'row', flexWrap: 'wrap', rowGap: 16, marginTop: 20, paddingHorizontal: 4 }, children: rows }) : null, note ? _jsx(Text, { testID: 'trade-note', style: { marginTop: 16, paddingHorizontal: 4, fontSize: 14, lineHeight: 21, color: colors.muted }, children: note }) : null, actions.length > 0 ? _jsx(View, { testID: 'trade-actions', style: { direction, flexDirection: 'row', gap: 8, marginTop: 16 }, children: actions.map(action => _jsx(View, { style: { flex: 1, minWidth: 0 }, children: _jsx(Button, { fullWidth: true, testID: `trade-action-${action.id}`, intent: action.intent ?? 'secondary', disabled: action.disabled, busy: action.busy, onPress: action.onSelect, children: action.label }) }, action.id)) }) : null] });
|
|
43
|
+
if (stickyHeader)
|
|
44
|
+
return _jsx(StickyHeaderLayout, { testID: testID, headerTestID: 'trade-sticky-header', header: header, background: stickyHeaderBackground, scrollComponent: scrollComponent, children: body });
|
|
45
|
+
return _jsxs(View, { testID: testID, style: { padding: 16 }, children: [header, body] });
|
|
38
46
|
}
|