react-native-terra-ui 0.8.1 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/lib/module/components/screen/Screen.js +135 -25
- package/lib/module/components/screen/Screen.js.map +1 -1
- package/lib/module/components/screen/ScreenContext.js +7 -1
- package/lib/module/components/screen/ScreenContext.js.map +1 -1
- package/lib/module/components/screen/ScreenList.js +20 -4
- package/lib/module/components/screen/ScreenList.js.map +1 -1
- package/lib/module/components/screen/ScreenScrollView.js +18 -4
- package/lib/module/components/screen/ScreenScrollView.js.map +1 -1
- package/lib/module/components/screen/hooks/use-nested-container-warning.js +39 -0
- package/lib/module/components/screen/hooks/use-nested-container-warning.js.map +1 -0
- package/lib/module/components/screen/parts/ScreenBottomInset.android.js +42 -0
- package/lib/module/components/screen/parts/ScreenBottomInset.android.js.map +1 -0
- package/lib/module/components/screen/parts/ScreenBottomInset.js +37 -0
- package/lib/module/components/screen/parts/ScreenBottomInset.js.map +1 -0
- package/lib/module/components/screen/parts/ScreenFrame.js +1 -0
- package/lib/module/components/screen/parts/ScreenFrame.js.map +1 -1
- package/lib/typescript/src/components/screen/Screen.d.ts +27 -5
- package/lib/typescript/src/components/screen/Screen.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/ScreenContext.d.ts +40 -1
- package/lib/typescript/src/components/screen/ScreenContext.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/ScreenList.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/ScreenScrollView.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/hooks/use-nested-container-warning.d.ts +24 -0
- package/lib/typescript/src/components/screen/hooks/use-nested-container-warning.d.ts.map +1 -0
- package/lib/typescript/src/components/screen/parts/ScreenBottomInset.android.d.ts +11 -0
- package/lib/typescript/src/components/screen/parts/ScreenBottomInset.android.d.ts.map +1 -0
- package/lib/typescript/src/components/screen/parts/ScreenBottomInset.d.ts +17 -0
- package/lib/typescript/src/components/screen/parts/ScreenBottomInset.d.ts.map +1 -0
- package/lib/typescript/src/components/screen/parts/ScreenFrame.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/screen/Screen.tsx +147 -16
- package/src/components/screen/ScreenContext.tsx +48 -0
- package/src/components/screen/ScreenList.tsx +23 -2
- package/src/components/screen/ScreenScrollView.tsx +24 -2
- package/src/components/screen/hooks/use-nested-container-warning.ts +40 -0
- package/src/components/screen/parts/ScreenBottomInset.android.tsx +35 -0
- package/src/components/screen/parts/ScreenBottomInset.tsx +29 -0
- package/src/components/screen/parts/ScreenFrame.tsx +8 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.9.1](https://github.com/earthlin9/react-native-terra-ui/compare/v0.9.0...v0.9.1) (2026-09-07)
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* **ui:** [screen] hand vertical insets to UIKit on header-less screens ([4f1a95c](https://github.com/earthlin9/react-native-terra-ui/commit/4f1a95c31bfbcf6d8424095b3961ee28ea1743ab))
|
|
8
|
+
* **ui:** [screen] require both vertical edges before handing insets over ([f135e01](https://github.com/earthlin9/react-native-terra-ui/commit/f135e010c372b0812171bd6b9771503acf094f47))
|
|
9
|
+
|
|
10
|
+
## [0.9.0](https://github.com/earthlin9/react-native-terra-ui/compare/v0.8.1...v0.9.0) (2026-09-07)
|
|
11
|
+
|
|
12
|
+
### ⚠ BREAKING CHANGES
|
|
13
|
+
|
|
14
|
+
* **ui:** scroll content draws beneath the bottom safe area instead
|
|
15
|
+
of stopping above it. A screen that added its own bottom clearance for a
|
|
16
|
+
tab bar should drop it, or the allowance is counted twice. Omit "bottom"
|
|
17
|
+
from `safeArea` to reserve no room for the bar at all and supply clearance
|
|
18
|
+
through `extraBottomPadding`.
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **showcase:** add native tab bar for components and blocks ([8e7f07f](https://github.com/earthlin9/react-native-terra-ui/commit/8e7f07f92b8a0eec76545ad6827ce2a6f04e5357))
|
|
23
|
+
* **ui:** [screen] hand the bottom safe area to the scroll container ([844869b](https://github.com/earthlin9/react-native-terra-ui/commit/844869b02f5488c8d545aab8c7e60dbf0e065a1a))
|
|
24
|
+
|
|
3
25
|
## [0.8.1](https://github.com/earthlin9/react-native-terra-ui/compare/v0.8.0...v0.8.1) (2026-09-07)
|
|
4
26
|
|
|
5
27
|
### Features
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import { View } from "react-native-unistyles/components/native/View";
|
|
4
4
|
import { Children, Fragment, forwardRef, isValidElement, useMemo } from "react";
|
|
5
|
-
import {
|
|
5
|
+
import { Platform } from "react-native";
|
|
6
|
+
import { useUnistyles } from "react-native-unistyles";
|
|
6
7
|
import { resolveThemeColor } from "../../utils/resolve-theme-color.js";
|
|
7
8
|
import { PortalProvider } from "../portal/index.js";
|
|
8
9
|
import { ScreenFrame } from "./parts/ScreenFrame.js";
|
|
@@ -42,6 +43,40 @@ function ScreenHeader({
|
|
|
42
43
|
}
|
|
43
44
|
ScreenHeader.displayName = "Screen.Header";
|
|
44
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Whether this child is a vertical scroll container that can pad its own bottom
|
|
48
|
+
* inset. A horizontal one cannot: bottom padding does nothing for it, so the
|
|
49
|
+
* frame keeps that edge.
|
|
50
|
+
*/
|
|
51
|
+
function ownsBottomInset(child) {
|
|
52
|
+
if (child.props.horizontal) return false;
|
|
53
|
+
if (child.type === ScreenScrollView || child.type === ScreenList) return true;
|
|
54
|
+
// Fast Refresh can retain an older function identity in existing child elements.
|
|
55
|
+
const {
|
|
56
|
+
displayName
|
|
57
|
+
} = child.type;
|
|
58
|
+
return displayName === "Screen.ScrollView" || displayName === "Screen.List";
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Whether the screen has such a container among its children. Inspects fragments,
|
|
63
|
+
* but does not execute arbitrary child components — a container nested inside one
|
|
64
|
+
* is not found, and the frame keeps the bottom edge.
|
|
65
|
+
*/
|
|
66
|
+
function hasScrollContainerOwningBottom(children) {
|
|
67
|
+
let found = false;
|
|
68
|
+
Children.forEach(children, child => {
|
|
69
|
+
if (found) return;
|
|
70
|
+
if (! /*#__PURE__*/isValidElement(child)) return;
|
|
71
|
+
if (child.type === Fragment) {
|
|
72
|
+
found = hasScrollContainerOwningBottom(child.props.children);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
found = ownsBottomInset(child);
|
|
76
|
+
});
|
|
77
|
+
return found;
|
|
78
|
+
}
|
|
79
|
+
|
|
45
80
|
/** Inspect fragments, but do not execute arbitrary child components. */
|
|
46
81
|
function hasScreenHeader(children) {
|
|
47
82
|
let found = false;
|
|
@@ -71,29 +106,108 @@ const ScreenBase = /*#__PURE__*/forwardRef(function Screen({
|
|
|
71
106
|
const hasHeader = useMemo(() => hasScreenHeader(children), [children]);
|
|
72
107
|
const resolvedMargins = contentPadding ?? margins ?? (hasMargins === false ? "none" : "all");
|
|
73
108
|
const edges = useMemo(() => resolveSafeAreaEdges(safeArea), [safeArea]);
|
|
109
|
+
const hasVerticalScrollContainer = useMemo(() => hasScrollContainerOwningBottom(children), [children]);
|
|
110
|
+
/*
|
|
111
|
+
A screen with no `Screen.Header` wears UIKit's own navigation bar, and only
|
|
112
|
+
UIKit can inset a scroll view for one.
|
|
113
|
+
A native large title changes height on every frame of its collapse, and the
|
|
114
|
+
bar is a sibling view this screen cannot measure — so an inset computed in JS
|
|
115
|
+
is always a frame late and always the wrong size. Worse, UIKit will not
|
|
116
|
+
collapse the title at all unless the scroll view it finds fills the screen:
|
|
117
|
+
padding the top edge on the frame starts that view 168pt down (measured on an
|
|
118
|
+
iPhone 17, expanded title), and the title then stays full size while rows
|
|
119
|
+
scroll up and overprint it.
|
|
120
|
+
So the frame keeps no vertical edge on such a screen, the container turns
|
|
121
|
+
UIKit's `contentInsetAdjustmentBehavior` back on, and UIKit pays the top and
|
|
122
|
+
the bottom both — which is why `ScreenBottomInset` stands down here rather
|
|
123
|
+
than paying that edge a second time. iOS only: this is UIKit's mechanism, and
|
|
124
|
+
Android has no navigation bar to track.
|
|
125
|
+
Both vertical edges have to be protected to hand them over, because UIKit
|
|
126
|
+
adjusts for both or for neither. A policy that asks for one and not the other
|
|
127
|
+
cannot be expressed this way, so it keeps the ordinary treatment below and
|
|
128
|
+
is honoured exactly as written — at the cost of the title collapse, which is
|
|
129
|
+
the better trade: an edge list is an explicit instruction, and silently
|
|
130
|
+
insetting an edge the caller excluded would be the worse surprise.
|
|
131
|
+
*/
|
|
132
|
+
const platformInsetsEligible = Platform.OS === "ios" && !hasHeader && edges.top && edges.bottom;
|
|
133
|
+
const platformAdjustsInsets = platformInsetsEligible && hasVerticalScrollContainer;
|
|
134
|
+
/*
|
|
135
|
+
Otherwise the bottom edge goes to the scroll container when there is one to
|
|
136
|
+
take it.
|
|
137
|
+
Applied to the frame, the bottom inset shrinks the scroll viewport, so content
|
|
138
|
+
stops above a tab bar rather than passing beneath it — and on iOS that inset
|
|
139
|
+
includes the bar itself, which UIKit folds into a tab screen's safe area. The
|
|
140
|
+
container reaches the same resting position by padding the end of its content
|
|
141
|
+
instead, which is how the platform's own content-inset adjustment behaves.
|
|
142
|
+
*/
|
|
143
|
+
const contentOwnsBottomInset = !platformAdjustsInsets && edges.bottom && hasVerticalScrollContainer;
|
|
144
|
+
const frameEdges = useMemo(() => platformAdjustsInsets ? {
|
|
145
|
+
...edges,
|
|
146
|
+
top: false,
|
|
147
|
+
bottom: false
|
|
148
|
+
} : contentOwnsBottomInset ? {
|
|
149
|
+
...edges,
|
|
150
|
+
bottom: false
|
|
151
|
+
} : edges, [platformAdjustsInsets, contentOwnsBottomInset, edges]);
|
|
74
152
|
const {
|
|
75
153
|
theme
|
|
76
154
|
} = useUnistyles();
|
|
77
155
|
const resolvedBackground = resolveThemeColor(background, theme) ?? theme.color["surface.canvas"];
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
156
|
+
/*
|
|
157
|
+
A plain object, not a Unistyles stylesheet, and the background belongs in it
|
|
158
|
+
rather than arriving later.
|
|
159
|
+
Unistyles applies a dynamic function's style after mount. UIKit resolves a
|
|
160
|
+
screen's scroll view once, while it is being presented, and a scroll area
|
|
161
|
+
that was not yet the size of the screen at that moment never drives the
|
|
162
|
+
navigation bar afterwards — the large title stays expanded for the rest of
|
|
163
|
+
the screen's life.
|
|
164
|
+
*/
|
|
165
|
+
const rootStyle = useMemo(() => ({
|
|
166
|
+
flex: 1,
|
|
167
|
+
backgroundColor: resolvedBackground
|
|
168
|
+
}), [resolvedBackground]);
|
|
169
|
+
return (
|
|
170
|
+
/*#__PURE__*/
|
|
171
|
+
/*
|
|
172
|
+
`collapsable={false}`, because a background colour alone is the worst of
|
|
173
|
+
both worlds here.
|
|
174
|
+
Fabric decides two things separately: whether a view is mounted at all, and
|
|
175
|
+
whether it *keeps* its children. A `View` with only layout styles is
|
|
176
|
+
dropped and its children are re-parented to its own parent — harmless. Give
|
|
177
|
+
it a background and it is mounted, but it still does not form a stacking
|
|
178
|
+
context, so the children are mounted *beside* it instead of inside it. The
|
|
179
|
+
screen's view then begins with an empty full-screen view, and UIKit — which
|
|
180
|
+
finds the scroll view by walking first subviews down from the view
|
|
181
|
+
controller (`RNSScrollViewFinder` mirrors the same walk) — reaches that dead
|
|
182
|
+
end and finds nothing. Measured on an iPhone 17: no content-inset
|
|
183
|
+
adjustment and no large-title collapse at all.
|
|
184
|
+
`collapsable={false}` forms the stacking context, so the frame, the safe
|
|
185
|
+
areas, and the scroll container stay in one unbroken first-subview chain.
|
|
186
|
+
*/
|
|
187
|
+
_jsx(View, {
|
|
188
|
+
collapsable: false,
|
|
189
|
+
ref: ref,
|
|
190
|
+
style: [rootStyle, style],
|
|
191
|
+
...rest,
|
|
192
|
+
children: /*#__PURE__*/_jsx(ScreenScrollProvider, {
|
|
193
|
+
background: resolvedBackground,
|
|
194
|
+
contentPadding: resolvedMargins,
|
|
195
|
+
safeArea: safeArea,
|
|
196
|
+
contentOwnsBottomInset: contentOwnsBottomInset,
|
|
197
|
+
platformAdjustsInsets: platformAdjustsInsets,
|
|
198
|
+
platformInsetsEligible: platformInsetsEligible,
|
|
199
|
+
hasHeader: hasHeader,
|
|
200
|
+
children: /*#__PURE__*/_jsx(ScreenHeaderAppearanceProvider, {
|
|
201
|
+
children: /*#__PURE__*/_jsx(ScreenFrame, {
|
|
202
|
+
edges: frameEdges,
|
|
203
|
+
children: /*#__PURE__*/_jsx(PortalProvider, {
|
|
204
|
+
children: children
|
|
205
|
+
})
|
|
92
206
|
})
|
|
93
207
|
})
|
|
94
208
|
})
|
|
95
209
|
})
|
|
96
|
-
|
|
210
|
+
);
|
|
97
211
|
});
|
|
98
212
|
ScreenBase.Header = ScreenHeader;
|
|
99
213
|
ScreenBase.ScrollView = ScreenScrollView;
|
|
@@ -104,9 +218,11 @@ ScreenBase.List = ScreenList;
|
|
|
104
218
|
* Themed screen root with shared scroll state and a local header portal.
|
|
105
219
|
*
|
|
106
220
|
* Pair a `Screen.Header` child with one primary `Screen.ScrollView`
|
|
107
|
-
* or `Screen.List`. The root applies safe-area clearance to all children
|
|
108
|
-
*
|
|
109
|
-
* the
|
|
221
|
+
* or `Screen.List`. The root applies safe-area clearance to all children, except
|
|
222
|
+
* the bottom edge when that primary container is vertical — it pads that inset
|
|
223
|
+
* into the end of its own content instead, so content scrolls under a bottom bar
|
|
224
|
+
* rather than stopping above it. Scroll containers add themed content padding and
|
|
225
|
+
* header clearance. The ref targets the root View, not the scroll container.
|
|
110
226
|
*
|
|
111
227
|
* @example
|
|
112
228
|
* ```tsx
|
|
@@ -117,10 +233,4 @@ ScreenBase.List = ScreenList;
|
|
|
117
233
|
* ```
|
|
118
234
|
*/
|
|
119
235
|
export const Screen = ScreenBase;
|
|
120
|
-
const styles = StyleSheet.create(() => ({
|
|
121
|
-
container: backgroundColor => ({
|
|
122
|
-
flex: 1,
|
|
123
|
-
backgroundColor
|
|
124
|
-
})
|
|
125
|
-
}));
|
|
126
236
|
//# sourceMappingURL=Screen.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Children","Fragment","forwardRef","isValidElement","useMemo","
|
|
1
|
+
{"version":3,"names":["Children","Fragment","forwardRef","isValidElement","useMemo","Platform","useUnistyles","resolveThemeColor","PortalProvider","ScreenFrame","ScreenHeaderAppearanceProvider","ScreenHeaderAppearanceSlot","ScreenScrollProvider","ScreenFlatList","ScreenList","ScreenScrollView","resolveSafeAreaEdges","jsx","_jsx","ScreenHeader","children","as","rest","Component","displayName","ownsBottomInset","child","props","horizontal","type","hasScrollContainerOwningBottom","found","forEach","hasScreenHeader","ScreenBase","Screen","background","contentPadding","safeArea","margins","hasMargins","inTabView","_inTabView","style","ref","hasHeader","resolvedMargins","edges","hasVerticalScrollContainer","platformInsetsEligible","OS","top","bottom","platformAdjustsInsets","contentOwnsBottomInset","frameEdges","theme","resolvedBackground","color","rootStyle","flex","backgroundColor","View","collapsable","Header","ScrollView","FlatList","List"],"sourceRoot":"../../../../src","sources":["components/screen/Screen.tsx"],"mappings":";;;AAAA,SACEA,QAAQ,EAIRC,QAAQ,EACRC,UAAU,EACVC,cAAc,EAIdC,OAAO,QACF,OAAO;AACd,SAASC,QAAQ,QAA8B,cAAc;AAE7D,SAASC,YAAY,QAAQ,wBAAwB;AAGrD,SAASC,iBAAiB;AAC1B,SAASC,cAAc;AACvB,SAASC,WAAW;AACpB,SAASC,8BAA8B,EAAEC,0BAA0B;AACnE,SAASC,oBAAoB;AAC7B,SAASC,cAAc;AACvB,SAASC,UAAU;AACnB,SAASC,gBAAgB;AAEzB,SAASC,oBAAoB;;AAE7B;AAAA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EhB,KAAK,CAAE;MAAA,GAAKrB,IAAI;MAAAF,QAAA,eACrEF,IAAA,CAACN,oBAAoB;QACnBwB,UAAU,EAAEqB,kBAAmB;QAC/BpB,cAAc,EAAES,eAAgB;QAChCR,QAAQ,EAAEA,QAAS;QACnBgB,sBAAsB,EAAEA,sBAAuB;QAC/CD,qBAAqB,EAAEA,qBAAsB;QAC7CJ,sBAAsB,EAAEA,sBAAuB;QAC/CJ,SAAS,EAAEA,SAAU;QAAAzB,QAAA,eAErBF,IAAA,CAACR,8BAA8B;UAAAU,QAAA,eAC7BF,IAAA,CAACT,WAAW;YAACsC,KAAK,EAAEQ,UAAW;YAAAnC,QAAA,eAC7BF,IAAA,CAACV,cAAc;cAAAY,QAAA,EAAEA;YAAQ,CAAiB;UAAC,CAChC;QAAC,CACgB;MAAC,CACb;IAAC,CACnB;EAAC;AAEX,CAAC,CAAoB;AAErBc,UAAU,CAAC8B,MAAM,GAAG7C,YAAY;AAChCe,UAAU,CAAC+B,UAAU,GAAGlD,gBAAgB;AACxCmB,UAAU,CAACgC,QAAQ,GAAGrD,cAAc;AACpCqB,UAAU,CAACiC,IAAI,GAAGrD,UAAU;;AAE5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMqB,MAAM,GAAGD,UAAU","ignoreList":[]}
|
|
@@ -23,6 +23,9 @@ export function ScreenScrollProvider({
|
|
|
23
23
|
children,
|
|
24
24
|
contentPadding = "all",
|
|
25
25
|
safeArea = "auto",
|
|
26
|
+
contentOwnsBottomInset = false,
|
|
27
|
+
platformAdjustsInsets = false,
|
|
28
|
+
platformInsetsEligible = false,
|
|
26
29
|
hasHeader = false
|
|
27
30
|
}) {
|
|
28
31
|
const scrollY = useSharedValue(0);
|
|
@@ -43,6 +46,9 @@ export function ScreenScrollProvider({
|
|
|
43
46
|
background,
|
|
44
47
|
contentPadding,
|
|
45
48
|
safeArea,
|
|
49
|
+
contentOwnsBottomInset,
|
|
50
|
+
platformAdjustsInsets,
|
|
51
|
+
platformInsetsEligible,
|
|
46
52
|
margins: contentPadding,
|
|
47
53
|
hasHeader,
|
|
48
54
|
scrollY,
|
|
@@ -51,7 +57,7 @@ export function ScreenScrollProvider({
|
|
|
51
57
|
setHeaderCollapseHeight,
|
|
52
58
|
scrollRef,
|
|
53
59
|
scrollHandler
|
|
54
|
-
}), [background, contentPadding, safeArea, hasHeader, scrollY, headerCollapseHeight, headerSnapOffsets, setHeaderCollapseHeight, scrollRef, scrollHandler]);
|
|
60
|
+
}), [background, contentPadding, safeArea, contentOwnsBottomInset, platformAdjustsInsets, platformInsetsEligible, hasHeader, scrollY, headerCollapseHeight, headerSnapOffsets, setHeaderCollapseHeight, scrollRef, scrollHandler]);
|
|
55
61
|
return /*#__PURE__*/_jsx(ScreenContext.Provider, {
|
|
56
62
|
value: value,
|
|
57
63
|
children: children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createContext","useCallback","useContext","useMemo","useState","useAnimatedRef","useAnimatedScrollHandler","useSharedValue","jsx","_jsx","SCREEN_HEADER_PORTAL_HOST","ScreenContext","ScreenScrollProvider","background","children","contentPadding","safeArea","hasHeader","scrollY","headerCollapseHeight","headerSnapOffsets","setHeaderSnapOffsets","scrollRef","setHeaderCollapseHeight","height","rounded","Math","round","value","undefined","scrollHandler","onScroll","event","contentOffset","y","margins","Provider","useScreen","context","Error"],"sourceRoot":"../../../../src","sources":["components/screen/ScreenContext.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAkBC,WAAW,EAAEC,UAAU,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAEjG,SAIEC,cAAc,EACdC,wBAAwB,EACxBC,cAAc,QACT,yBAAyB;;AAIhC;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAGA;AACA,OAAO,MAAMC,yBAAyB,GAAG,eAAe;;AAExD;;
|
|
1
|
+
{"version":3,"names":["createContext","useCallback","useContext","useMemo","useState","useAnimatedRef","useAnimatedScrollHandler","useSharedValue","jsx","_jsx","SCREEN_HEADER_PORTAL_HOST","ScreenContext","ScreenScrollProvider","background","children","contentPadding","safeArea","contentOwnsBottomInset","platformAdjustsInsets","platformInsetsEligible","hasHeader","scrollY","headerCollapseHeight","headerSnapOffsets","setHeaderSnapOffsets","scrollRef","setHeaderCollapseHeight","height","rounded","Math","round","value","undefined","scrollHandler","onScroll","event","contentOffset","y","margins","Provider","useScreen","context","Error"],"sourceRoot":"../../../../src","sources":["components/screen/ScreenContext.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAkBC,WAAW,EAAEC,UAAU,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAEjG,SAIEC,cAAc,EACdC,wBAAwB,EACxBC,cAAc,QACT,yBAAyB;;AAIhC;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAGA;AACA,OAAO,MAAMC,yBAAyB,GAAG,eAAe;;AAExD;;AAyEA,OAAO,MAAMC,aAAa,gBAAGX,aAAa,CAA4B,IAAI,CAAC;;AAE3E;;AAmBA;AACA;AACA;AACA;AACA,OAAO,SAASY,oBAAoBA,CAAC;EACnCC,UAAU,GAAG,aAAa;EAC1BC,QAAQ;EACRC,cAAc,GAAG,KAAK;EACtBC,QAAQ,GAAG,MAAM;EACjBC,sBAAsB,GAAG,KAAK;EAC9BC,qBAAqB,GAAG,KAAK;EAC7BC,sBAAsB,GAAG,KAAK;EAC9BC,SAAS,GAAG;AACa,CAAC,EAAE;EAC5B,MAAMC,OAAO,GAAGd,cAAc,CAAC,CAAC,CAAC;EACjC,MAAMe,oBAAoB,GAAGf,cAAc,CAAC,CAAC,CAAC;EAC9C,MAAM,CAACgB,iBAAiB,EAAEC,oBAAoB,CAAC,GAAGpB,QAAQ,CAAW,CAAC;EACtE,MAAMqB,SAAS,GAAGpB,cAAc,CAAsB,CAAC;EAEvD,MAAMqB,uBAAuB,GAAGzB,WAAW,CACxC0B,MAAc,IAAK;I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AAK,CAAC,kDAAkD,CAAC;EACrE;EACA,OAAOD,OAAO;AAChB","ignoreList":[]}
|
|
@@ -7,8 +7,10 @@ import Animated from "react-native-reanimated";
|
|
|
7
7
|
import { StyleSheet } from "react-native-unistyles";
|
|
8
8
|
import { resolveScreenPadding } from "../../theme/screen-padding.js";
|
|
9
9
|
import { PortalHost } from "../portal/index.js";
|
|
10
|
+
import { useNestedContainerWarning } from "./hooks/use-nested-container-warning.js";
|
|
10
11
|
import { useScreenRef } from "./hooks/use-screen-ref.js";
|
|
11
12
|
import { useScreenScrollHandler } from "./hooks/use-screen-scroll-handler.js";
|
|
13
|
+
import { ScreenBottomInset } from "./parts/ScreenBottomInset";
|
|
12
14
|
import { renderScreenPlaceholder } from "./parts/ScreenPlaceholder.js";
|
|
13
15
|
import { SCREEN_HEADER_PORTAL_HOST, useScreen } from "./ScreenContext.js";
|
|
14
16
|
import { hasHorizontalPadding, hasVerticalPadding, renderListComponent } from "./utils.js";
|
|
@@ -59,8 +61,14 @@ const ScreenListBase = /*#__PURE__*/forwardRef(function ScreenList({
|
|
|
59
61
|
scrollHandler,
|
|
60
62
|
headerSnapOffsets,
|
|
61
63
|
contentPadding: screenPadding,
|
|
62
|
-
hasHeader
|
|
64
|
+
hasHeader,
|
|
65
|
+
contentOwnsBottomInset,
|
|
66
|
+
platformAdjustsInsets
|
|
63
67
|
} = useScreen();
|
|
68
|
+
// The root yields the bottom edge only to a vertical container, so a horizontal
|
|
69
|
+
// one here is a secondary container and must not pay the inset a second time.
|
|
70
|
+
const ownsBottomInset = contentOwnsBottomInset && !horizontal;
|
|
71
|
+
useNestedContainerWarning("Screen.List", horizontal);
|
|
64
72
|
const mergedRef = useScreenRef(isDefaultFlatList ? scrollRef : undefined, ref);
|
|
65
73
|
const resolvedPadding = contentPadding ?? margins ?? screenPadding;
|
|
66
74
|
const resolvedLoading = isLoading ?? loading;
|
|
@@ -79,6 +87,9 @@ const ScreenListBase = /*#__PURE__*/forwardRef(function ScreenList({
|
|
|
79
87
|
})
|
|
80
88
|
}), renderListComponent(ListHeaderComponent)]
|
|
81
89
|
});
|
|
90
|
+
const footer = ownsBottomInset ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
91
|
+
children: [renderListComponent(ListFooterComponent), /*#__PURE__*/_jsx(ScreenBottomInset, {})]
|
|
92
|
+
}) : ListFooterComponent;
|
|
82
93
|
return /*#__PURE__*/_jsx(AnimatedComponent, {
|
|
83
94
|
ref: mergedRef,
|
|
84
95
|
data: resolvedLoading ? [] : data,
|
|
@@ -86,13 +97,18 @@ const ScreenListBase = /*#__PURE__*/forwardRef(function ScreenList({
|
|
|
86
97
|
style: [{
|
|
87
98
|
backgroundColor: background
|
|
88
99
|
}, style],
|
|
89
|
-
horizontal: horizontal
|
|
90
|
-
|
|
100
|
+
horizontal: horizontal
|
|
101
|
+
/*
|
|
102
|
+
UIKit owns the vertical insets on a header-less iOS screen — see
|
|
103
|
+
`platformAdjustsInsets`. Everywhere else the frame has already paid them,
|
|
104
|
+
so a second adjustment here would count them twice.
|
|
105
|
+
*/,
|
|
106
|
+
contentInsetAdjustmentBehavior: platformAdjustsInsets ? "automatic" : "never",
|
|
91
107
|
automaticallyAdjustContentInsets: false,
|
|
92
108
|
automaticallyAdjustsScrollIndicatorInsets: false,
|
|
93
109
|
contentContainerStyle: [styles.content(resolvedPadding, hasHeader, bottomInset, extraBottomPadding), contentContainerStyle],
|
|
94
110
|
ListHeaderComponent: header,
|
|
95
|
-
ListFooterComponent:
|
|
111
|
+
ListFooterComponent: footer,
|
|
96
112
|
ListEmptyComponent: placeholder ?? ListEmptyComponent,
|
|
97
113
|
showsVerticalScrollIndicator: false,
|
|
98
114
|
scrollEventThrottle: 16,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","useMemo","Animated","StyleSheet","resolveScreenPadding","PortalHost","useScreenRef","useScreenScrollHandler","renderScreenPlaceholder","SCREEN_HEADER_PORTAL_HOST","useScreen","hasHorizontalPadding","hasVerticalPadding","renderListComponent","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","ScreenListBase","ScreenList","as","data","renderItem","style","contentContainerStyle","ListHeaderComponent","ListFooterComponent","ListEmptyComponent","horizontal","isLoading","loading","loadingContent","LoadingComponent","emptyContent","EmptyComponent","contentPadding","margins","bottomInset","extraBottomPadding","scrollHandler","externalScrollHandler","onScroll","rest","ref","isDefaultFlatList","undefined","FlatList","Component","AnimatedComponent","createAnimatedComponent","background","scrollRef","headerSnapOffsets","screenPadding","hasHeader","mergedRef","resolvedPadding","resolvedLoading","placeholder","isEmpty","length","composedScrollHandler","header","children","View","styles","headerWrapper","name","backgroundColor","contentInsetAdjustmentBehavior","automaticallyAdjustContentInsets","automaticallyAdjustsScrollIndicatorInsets","content","showsVerticalScrollIndicator","scrollEventThrottle","snapToOffsets","displayName","create","theme","runtime","padding","x","y","breakpoint","flexGrow","paddingTop","layout","height","paddingHorizontal","paddingBottom","uni__dependencies","marginHorizontal"],"sourceRoot":"../../../../src","sources":["components/screen/ScreenList.tsx"],"mappings":";;;;AAAA,SAKEA,UAAU,EAIVC,OAAO,QACF,OAAO;AAGd,OAAOC,QAAQ,MAAM,yBAAyB;AAC9C,SAASC,UAAU,QAAQ,wBAAwB;AAEnD,SAASC,oBAAoB;AAC7B,SAASC,UAAU;AACnB,SAASC,YAAY;AACrB,SAASC,sBAAsB;AAC/B,SAASC,uBAAuB;AAChC,SAASC,yBAAyB,EAAEC,SAAS;AAE7C,SAASC,oBAAoB,EAAEC,kBAAkB,EAAEC,mBAAmB;;AAEtE;;AAKA;;AAgBA;;AAyBA;;AA+BA;;AAiBA;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAiBA,MAAMC,cAAc,
|
|
1
|
+
{"version":3,"names":["forwardRef","useMemo","Animated","StyleSheet","resolveScreenPadding","PortalHost","useNestedContainerWarning","useScreenRef","useScreenScrollHandler","ScreenBottomInset","renderScreenPlaceholder","SCREEN_HEADER_PORTAL_HOST","useScreen","hasHorizontalPadding","hasVerticalPadding","renderListComponent","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","ScreenListBase","ScreenList","as","data","renderItem","style","contentContainerStyle","ListHeaderComponent","ListFooterComponent","ListEmptyComponent","horizontal","isLoading","loading","loadingContent","LoadingComponent","emptyContent","EmptyComponent","contentPadding","margins","bottomInset","extraBottomPadding","scrollHandler","externalScrollHandler","onScroll","rest","ref","isDefaultFlatList","undefined","FlatList","Component","AnimatedComponent","createAnimatedComponent","background","scrollRef","headerSnapOffsets","screenPadding","hasHeader","contentOwnsBottomInset","platformAdjustsInsets","ownsBottomInset","mergedRef","resolvedPadding","resolvedLoading","placeholder","isEmpty","length","composedScrollHandler","header","children","View","styles","headerWrapper","name","footer","backgroundColor","contentInsetAdjustmentBehavior","automaticallyAdjustContentInsets","automaticallyAdjustsScrollIndicatorInsets","content","showsVerticalScrollIndicator","scrollEventThrottle","snapToOffsets","displayName","create","theme","runtime","padding","x","y","breakpoint","flexGrow","paddingTop","layout","height","paddingHorizontal","paddingBottom","uni__dependencies","marginHorizontal"],"sourceRoot":"../../../../src","sources":["components/screen/ScreenList.tsx"],"mappings":";;;;AAAA,SAKEA,UAAU,EAIVC,OAAO,QACF,OAAO;AAGd,OAAOC,QAAQ,MAAM,yBAAyB;AAC9C,SAASC,UAAU,QAAQ,wBAAwB;AAEnD,SAASC,oBAAoB;AAC7B,SAASC,UAAU;AACnB,SAASC,yBAAyB;AAClC,SAASC,YAAY;AACrB,SAASC,sBAAsB;AAC/B,SAASC,iBAAiB;AAC1B,SAASC,uBAAuB;AAChC,SAASC,yBAAyB,EAAEC,SAAS;AAE7C,SAASC,oBAAoB,EAAEC,kBAAkB,EAAEC,mBAAmB;;AAEtE;;AAKA;;AAgBA;;AAyBA;;AA+BA;;AAiBA;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAA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,CAAC,CAAC,IAAIhD,kBAAkB;MAAAwD,iBAAA;IAC5F,CAAC;EACH,CAAC;EACDzB,aAAa,EAAGe,OAA6B,KAAM;IACjDW,gBAAgB,EAAEtF,oBAAoB,CAAC2E,OAAO,CAAC,GAAG,CAACpF,oBAAoB,CAACkF,KAAK,EAAEC,OAAO,CAACI,UAAU,CAAC,CAACF,CAAC,GAAG,CAAC;IAAAS,iBAAA;EAC1G,CAAC;AACH,CAAC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -6,8 +6,10 @@ import Animated from "react-native-reanimated";
|
|
|
6
6
|
import { StyleSheet } from "react-native-unistyles";
|
|
7
7
|
import { resolveScreenPadding } from "../../theme/screen-padding.js";
|
|
8
8
|
import { PortalHost } from "../portal/index.js";
|
|
9
|
+
import { useNestedContainerWarning } from "./hooks/use-nested-container-warning.js";
|
|
9
10
|
import { useScreenRef } from "./hooks/use-screen-ref.js";
|
|
10
11
|
import { useScreenScrollHandler } from "./hooks/use-screen-scroll-handler.js";
|
|
12
|
+
import { ScreenBottomInset } from "./parts/ScreenBottomInset";
|
|
11
13
|
import { renderScreenPlaceholder } from "./parts/ScreenPlaceholder.js";
|
|
12
14
|
import { SCREEN_HEADER_PORTAL_HOST, useScreen } from "./ScreenContext.js";
|
|
13
15
|
import { hasHorizontalPadding, hasVerticalPadding } from "./utils.js";
|
|
@@ -56,8 +58,14 @@ export const ScreenScrollView = /*#__PURE__*/forwardRef(function ScreenScrollVie
|
|
|
56
58
|
scrollHandler,
|
|
57
59
|
contentPadding: screenPadding,
|
|
58
60
|
hasHeader,
|
|
59
|
-
background
|
|
61
|
+
background,
|
|
62
|
+
contentOwnsBottomInset,
|
|
63
|
+
platformAdjustsInsets
|
|
60
64
|
} = useScreen();
|
|
65
|
+
// The root yields the bottom edge only to a vertical container, so a horizontal
|
|
66
|
+
// one here is a secondary container and must not pay the inset a second time.
|
|
67
|
+
const ownsBottomInset = contentOwnsBottomInset && !horizontal;
|
|
68
|
+
useNestedContainerWarning("Screen.ScrollView", horizontal);
|
|
61
69
|
const resolvedPadding = contentPadding ?? margins ?? screenPadding;
|
|
62
70
|
const mergedRef = useScreenRef(scrollRef, ref);
|
|
63
71
|
const placeholder = renderScreenPlaceholder({
|
|
@@ -72,8 +80,13 @@ export const ScreenScrollView = /*#__PURE__*/forwardRef(function ScreenScrollVie
|
|
|
72
80
|
style: [{
|
|
73
81
|
backgroundColor: background
|
|
74
82
|
}, style],
|
|
75
|
-
horizontal: horizontal
|
|
76
|
-
|
|
83
|
+
horizontal: horizontal
|
|
84
|
+
/*
|
|
85
|
+
UIKit owns the vertical insets on a header-less iOS screen — see
|
|
86
|
+
`platformAdjustsInsets`. Everywhere else the frame has already paid
|
|
87
|
+
them, so a second adjustment here would count them twice.
|
|
88
|
+
*/,
|
|
89
|
+
contentInsetAdjustmentBehavior: platformAdjustsInsets ? "automatic" : "never",
|
|
77
90
|
automaticallyAdjustContentInsets: false,
|
|
78
91
|
automaticallyAdjustsScrollIndicatorInsets: false,
|
|
79
92
|
showsVerticalScrollIndicator: false,
|
|
@@ -89,9 +102,10 @@ export const ScreenScrollView = /*#__PURE__*/forwardRef(function ScreenScrollVie
|
|
|
89
102
|
}), /*#__PURE__*/_jsx(View, {
|
|
90
103
|
style: [styles.content(horizontal), contentStyle],
|
|
91
104
|
children: placeholder ?? children
|
|
92
|
-
})]
|
|
105
|
+
}), ownsBottomInset && /*#__PURE__*/_jsx(ScreenBottomInset, {})]
|
|
93
106
|
});
|
|
94
107
|
});
|
|
108
|
+
ScreenScrollView.displayName = "Screen.ScrollView";
|
|
95
109
|
const styles = StyleSheet.create((theme, runtime) => ({
|
|
96
110
|
scrollContent: (hasHeader, padding, extraBottomPadding) => {
|
|
97
111
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Children","forwardRef","Animated","StyleSheet","resolveScreenPadding","PortalHost","useScreenRef","useScreenScrollHandler","renderScreenPlaceholder","SCREEN_HEADER_PORTAL_HOST","useScreen","hasHorizontalPadding","hasVerticalPadding","jsx","_jsx","jsxs","_jsxs","ScreenScrollView","children","style","contentContainerStyle","contentStyle","scrollHandler","externalScrollHandler","onScroll","horizontal","isLoading","loading","loadingContent","LoadingComponent","emptyContent","EmptyComponent","contentPadding","margins","extraBottomPadding","isEmpty","rest","ref","scrollRef","screenPadding","hasHeader","background","resolvedPadding","mergedRef","placeholder","undefined","toArray","length","composedScrollHandler","ScrollView","backgroundColor","contentInsetAdjustmentBehavior","automaticallyAdjustContentInsets","automaticallyAdjustsScrollIndicatorInsets","showsVerticalScrollIndicator","scrollEventThrottle","styles","scrollContent","View","headerWrapper","name","content","create","theme","runtime","padding","x","y","breakpoint","flexGrow","paddingTop","layout","header","height","paddingHorizontal","paddingBottom","uni__dependencies","marginHorizontal","flexDirection"],"sourceRoot":"../../../../src","sources":["components/screen/ScreenScrollView.tsx"],"mappings":";;;AAAA,SAASA,QAAQ,EAAqBC,UAAU,QAAwB,OAAO;AAG/E,OAAOC,QAAQ,MAAM,yBAAyB;AAC9C,SAASC,UAAU,QAAQ,wBAAwB;AAEnD,SAASC,oBAAoB;AAC7B,SAASC,UAAU;AACnB,SAASC,YAAY;AACrB,SAASC,sBAAsB;AAC/B,SAASC,uBAAuB;AAChC,SAASC,yBAAyB,EAAEC,SAAS;AAE7C,SAASC,oBAAoB,EAAEC,kBAAkB;;AAEjD;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,
|
|
1
|
+
{"version":3,"names":["Children","forwardRef","Animated","StyleSheet","resolveScreenPadding","PortalHost","useNestedContainerWarning","useScreenRef","useScreenScrollHandler","ScreenBottomInset","renderScreenPlaceholder","SCREEN_HEADER_PORTAL_HOST","useScreen","hasHorizontalPadding","hasVerticalPadding","jsx","_jsx","jsxs","_jsxs","ScreenScrollView","children","style","contentContainerStyle","contentStyle","scrollHandler","externalScrollHandler","onScroll","horizontal","isLoading","loading","loadingContent","LoadingComponent","emptyContent","EmptyComponent","contentPadding","margins","extraBottomPadding","isEmpty","rest","ref","scrollRef","screenPadding","hasHeader","background","contentOwnsBottomInset","platformAdjustsInsets","ownsBottomInset","resolvedPadding","mergedRef","placeholder","undefined","toArray","length","composedScrollHandler","ScrollView","backgroundColor","contentInsetAdjustmentBehavior","automaticallyAdjustContentInsets","automaticallyAdjustsScrollIndicatorInsets","showsVerticalScrollIndicator","scrollEventThrottle","styles","scrollContent","View","headerWrapper","name","content","displayName","create","theme","runtime","padding","x","y","breakpoint","flexGrow","paddingTop","layout","header","height","paddingHorizontal","paddingBottom","uni__dependencies","marginHorizontal","flexDirection"],"sourceRoot":"../../../../src","sources":["components/screen/ScreenScrollView.tsx"],"mappings":";;;AAAA,SAASA,QAAQ,EAAqBC,UAAU,QAAwB,OAAO;AAG/E,OAAOC,QAAQ,MAAM,yBAAyB;AAC9C,SAASC,UAAU,QAAQ,wBAAwB;AAEnD,SAASC,oBAAoB;AAC7B,SAASC,UAAU;AACnB,SAASC,yBAAyB;AAClC,SAASC,YAAY;AACrB,SAASC,sBAAsB;AAC/B,SAASC,iBAAiB;AAC1B,SAASC,uBAAuB;AAChC,SAASC,yBAAyB,EAAEC,SAAS;AAE7C,SAASC,oBAAoB,EAAEC,kBAAkB;;AAEjD;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,gBAAGlB,UAAU,CACxC,SAASkB,gBAAgBA,CACvB;EACEC,QAAQ;EACRC,KAAK;EACLC,qBAAqB;EACrBC,YAAY;EACZC,aAAa,EAAEC,qBAAqB;EACpCC,QAAQ;EACRC,UAAU,GAAG,KAAK;EAClBC,SAAS;EACTC,OA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kB,CAACyD,OAAO,CAAC,GAAGE,CAAC,GAAG,CAAC,CAAC;MAChGO,iBAAiB,EAAEnE,oBAAoB,CAAC0D,OAAO,CAAC,GAAGC,CAAC,GAAG,CAAC;MACxDS,aAAa,EAAE,CAACnE,kBAAkB,CAACyD,OAAO,CAAC,GAAGE,CAAC,GAAG,CAAC,IAAIrC,kBAAkB;MAAA8C,iBAAA;IAC3E,CAAC;EACH,CAAC;EACDlB,aAAa,EAAGO,OAA6B,KAAM;IACjDY,gBAAgB,EAAEtE,oBAAoB,CAAC0D,OAAO,CAAC,GAAG,CAACnE,oBAAoB,CAACiE,KAAK,EAAEC,OAAO,CAACI,UAAU,CAAC,CAACF,CAAC,GAAG,CAAC;IAAAU,iBAAA;EAC1G,CAAC,CAAC;EACFhB,OAAO,EAAGvC,UAAmB,KAAM;IAAEgD,QAAQ,EAAE,CAAC;IAAES,aAAa,EAAEzD,UAAU,GAAG,KAAK,GAAG;EAAS,CAAC;AAClG,CAAC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useEffect } from "react";
|
|
4
|
+
import { useScreen } from "../ScreenContext.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Warns, in development, when this container is the one the screen root failed
|
|
8
|
+
* to find.
|
|
9
|
+
*
|
|
10
|
+
* The root inspects its own children and fragments but does not execute
|
|
11
|
+
* component children, so a container rendered inside one is invisible to it (see
|
|
12
|
+
* `hasScrollContainerOwningBottom`). On a header-less iOS screen that changes
|
|
13
|
+
* behaviour rather than just bookkeeping: the frame pads the top edge, the scroll
|
|
14
|
+
* view no longer fills the screen, and UIKit stops collapsing the native large
|
|
15
|
+
* title — silently, with the screen otherwise looking correct.
|
|
16
|
+
*
|
|
17
|
+
* The container is the only place that can tell. `platformInsetsEligible` says
|
|
18
|
+
* the screen qualified; a container mounting while `platformAdjustsInsets` is
|
|
19
|
+
* false says the root never saw it. Both true together mean exactly this mistake,
|
|
20
|
+
* so there is nothing here to false-positive on: a screen with no scroll
|
|
21
|
+
* container at all never runs this hook, and a deliberate `safeArea` opt-out is
|
|
22
|
+
* not eligible in the first place.
|
|
23
|
+
*
|
|
24
|
+
* @param container Name to report, e.g. `"Screen.List"`.
|
|
25
|
+
* @param horizontal Whether this container scrolls horizontally; those are never
|
|
26
|
+
* candidates for the vertical insets and never warn.
|
|
27
|
+
*/
|
|
28
|
+
export function useNestedContainerWarning(container, horizontal) {
|
|
29
|
+
const {
|
|
30
|
+
platformAdjustsInsets,
|
|
31
|
+
platformInsetsEligible
|
|
32
|
+
} = useScreen();
|
|
33
|
+
const isNested = platformInsetsEligible && !platformAdjustsInsets && !horizontal;
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (!__DEV__ || !isNested) return;
|
|
36
|
+
console.warn(`[react-native-terra-ui] ${container} is nested inside another component, so its Screen could not find it. ` + "On iOS a Screen with no Screen.Header hands its vertical insets to UIKit, but only when the scroll " + "container is among its own children — nested, the frame pads the top instead and a native large title " + `will not collapse. Render ${container} as a direct child of Screen; fragments are fine.`);
|
|
37
|
+
}, [container, isNested]);
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=use-nested-container-warning.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","useScreen","useNestedContainerWarning","container","horizontal","platformAdjustsInsets","platformInsetsEligible","isNested","__DEV__","console","warn"],"sourceRoot":"../../../../../src","sources":["components/screen/hooks/use-nested-container-warning.ts"],"mappings":";;AAAA,SAASA,SAAS,QAAQ,OAAO;AAEjC,SAASC,SAAS;;AAElB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,yBAAyBA,CAACC,SAAiB,EAAEC,UAAmB,EAAQ;EACtF,MAAM;IAAEC,qBAAqB;IAAEC;EAAuB,CAAC,GAAGL,SAAS,CAAC,CAAC;EACrE,MAAMM,QAAQ,GAAGD,sBAAsB,IAAI,CAACD,qBAAqB,IAAI,CAACD,UAAU;EAEhFJ,SAAS,CAAC,MAAM;IACd,IAAI,CAACQ,OAAO,IAAI,CAACD,QAAQ,EAAE;IAC3BE,OAAO,CAACC,IAAI,CACV,2BAA2BP,SAAS,wEAAwE,GAC1G,qGAAqG,GACrG,wGAAwG,GACxG,6BAA6BA,SAAS,mDAC1C,CAAC;EACH,CAAC,EAAE,CAACA,SAAS,EAAEI,QAAQ,CAAC,CAAC;AAC3B","ignoreList":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { StyleSheet } from "react-native-unistyles";
|
|
4
|
+
|
|
5
|
+
// Keep native codegen declarations outside the library's generated public types.
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
const {
|
|
8
|
+
SafeAreaView
|
|
9
|
+
} = require("react-native-screens/src/components/safe-area");
|
|
10
|
+
const BOTTOM_EDGE = {
|
|
11
|
+
top: false,
|
|
12
|
+
bottom: true,
|
|
13
|
+
left: false,
|
|
14
|
+
right: false
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Android's bottom safe area as scroll content — see the iOS file for why this
|
|
19
|
+
* is a native view rather than a measured inset.
|
|
20
|
+
*
|
|
21
|
+
* `insetType: "all"` is the same combination the Screen frame uses: system insets
|
|
22
|
+
* plus native interface insets, which is what carries a native tab bar. The frame
|
|
23
|
+
* leaves the bottom edge unconsumed when the content owns it, so this view still
|
|
24
|
+
* sees the inset and is the one to consume it.
|
|
25
|
+
*/
|
|
26
|
+
export function ScreenBottomInset() {
|
|
27
|
+
return /*#__PURE__*/_jsx(SafeAreaView, {
|
|
28
|
+
edges: BOTTOM_EDGE,
|
|
29
|
+
insetType: "all",
|
|
30
|
+
style: styles.spacer
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
const styles = StyleSheet.create(() => ({
|
|
34
|
+
// `flex: 0` cancels the `flex: 1` this SafeAreaView sets on itself, which would
|
|
35
|
+
// otherwise let the spacer eat the content container's growth.
|
|
36
|
+
spacer: {
|
|
37
|
+
flex: 0,
|
|
38
|
+
flexGrow: 0,
|
|
39
|
+
flexShrink: 0
|
|
40
|
+
}
|
|
41
|
+
}));
|
|
42
|
+
//# sourceMappingURL=ScreenBottomInset.android.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["StyleSheet","jsx","_jsx","SafeAreaView","require","BOTTOM_EDGE","top","bottom","left","right","ScreenBottomInset","edges","insetType","style","styles","spacer","create","flex","flexGrow","flexShrink"],"sourceRoot":"../../../../../src","sources":["components/screen/parts/ScreenBottomInset.android.tsx"],"mappings":";;AAGA,SAASA,UAAU,QAAQ,wBAAwB;;AAEnD;AAAA,SAAAC,GAAA,IAAAC,IAAA;AACA,MAAM;EAAEC;AAAa,CAAC,GAAGC,OAAO,CAAC,+CAA+C,CAO/E;AAED,MAAMC,WAAW,GAAG;EAAEC,GAAG,EAAE,KAAK;EAAEC,MAAM,EAAE,IAAI;EAAEC,IAAI,EAAE,KAAK;EAAEC,KAAK,EAAE;AAAM,CAAC;;AAE3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAAA,EAAG;EAClC,oBAAOR,IAAA,CAACC,YAAY;IAACQ,KAAK,EAAEN,WAAY;IAACO,SAAS,EAAC,KAAK;IAACC,KAAK,EAAEC,MAAM,CAACC;EAAO,CAAE,CAAC;AACnF;AAEA,MAAMD,MAAM,GAAGd,UAAU,CAACgB,MAAM,CAAC,OAAO;EACtC;EACA;EACAD,MAAM,EAAE;IAAEE,IAAI,EAAE,CAAC;IAAEC,QAAQ,EAAE,CAAC;IAAEC,UAAU,EAAE;EAAE;AAChD,CAAC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { SafeAreaView } from "react-native-safe-area-context";
|
|
4
|
+
import { StyleSheet } from "react-native-unistyles";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
const BOTTOM_EDGE = ["bottom"];
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The bottom safe area as a piece of scroll content rather than frame padding.
|
|
10
|
+
*
|
|
11
|
+
* A scroll container that yields its bottom edge to the content (see
|
|
12
|
+
* `contentOwnsBottomInset`) keeps a full-bleed viewport, so its rows pass under
|
|
13
|
+
* a tab bar or home indicator instead of stopping above one. This spacer is what
|
|
14
|
+
* keeps the *end* of that content clear of the bar: an empty safe-area view whose
|
|
15
|
+
* own padding is its whole height.
|
|
16
|
+
*
|
|
17
|
+
* Deliberately a native safe-area view rather than a measured number. The inset
|
|
18
|
+
* that matters here includes bars this screen does not own — a native tab bar is
|
|
19
|
+
* a sibling view, not a window inset — and asking the platform for padding gets
|
|
20
|
+
* the same answer the frame would have applied, on both platforms, without a JS
|
|
21
|
+
* round trip through a value that lands a frame late.
|
|
22
|
+
*/
|
|
23
|
+
export function ScreenBottomInset() {
|
|
24
|
+
return /*#__PURE__*/_jsx(SafeAreaView, {
|
|
25
|
+
edges: BOTTOM_EDGE,
|
|
26
|
+
style: styles.spacer
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
const styles = StyleSheet.create(() => ({
|
|
30
|
+
// Height comes entirely from the inset, so the spacer must not flex with the
|
|
31
|
+
// content container's `flexGrow: 1`.
|
|
32
|
+
spacer: {
|
|
33
|
+
flexGrow: 0,
|
|
34
|
+
flexShrink: 0
|
|
35
|
+
}
|
|
36
|
+
}));
|
|
37
|
+
//# sourceMappingURL=ScreenBottomInset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["SafeAreaView","StyleSheet","jsx","_jsx","BOTTOM_EDGE","ScreenBottomInset","edges","style","styles","spacer","create","flexGrow","flexShrink"],"sourceRoot":"../../../../../src","sources":["components/screen/parts/ScreenBottomInset.tsx"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,gCAAgC;AAC7D,SAASC,UAAU,QAAQ,wBAAwB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEpD,MAAMC,WAAW,GAAG,CAAC,QAAQ,CAAU;;AAEvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAAA,EAAG;EAClC,oBAAOF,IAAA,CAACH,YAAY;IAACM,KAAK,EAAEF,WAAY;IAACG,KAAK,EAAEC,MAAM,CAACC;EAAO,CAAE,CAAC;AACnE;AAEA,MAAMD,MAAM,GAAGP,UAAU,CAACS,MAAM,CAAC,OAAO;EACtC;EACA;EACAD,MAAM,EAAE;IAAEE,QAAQ,EAAE,CAAC;IAAEC,UAAU,EAAE;EAAE;AACvC,CAAC,CAAC,CAAC","ignoreList":[]}
|