react-native-terra-ui 0.9.0 → 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 +7 -0
- package/lib/module/components/screen/Screen.js +87 -27
- package/lib/module/components/screen/Screen.js.map +1 -1
- package/lib/module/components/screen/ScreenContext.js +5 -1
- package/lib/module/components/screen/ScreenContext.js.map +1 -1
- package/lib/module/components/screen/ScreenList.js +11 -3
- package/lib/module/components/screen/ScreenList.js.map +1 -1
- package/lib/module/components/screen/ScreenScrollView.js +11 -3
- 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/ScreenFrame.js +1 -0
- package/lib/module/components/screen/parts/ScreenFrame.js.map +1 -1
- package/lib/typescript/src/components/screen/Screen.d.ts +6 -0
- package/lib/typescript/src/components/screen/Screen.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/ScreenContext.d.ts +27 -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/ScreenFrame.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/screen/Screen.tsx +81 -17
- package/src/components/screen/ScreenContext.tsx +32 -0
- package/src/components/screen/ScreenList.tsx +9 -1
- package/src/components/screen/ScreenScrollView.tsx +9 -1
- package/src/components/screen/hooks/use-nested-container-warning.ts +40 -0
- package/src/components/screen/parts/ScreenFrame.tsx +8 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
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
|
+
|
|
3
10
|
## [0.9.0](https://github.com/earthlin9/react-native-terra-ui/compare/v0.8.1...v0.9.0) (2026-09-07)
|
|
4
11
|
|
|
5
12
|
### ⚠ BREAKING CHANGES
|
|
@@ -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";
|
|
@@ -105,43 +106,108 @@ const ScreenBase = /*#__PURE__*/forwardRef(function Screen({
|
|
|
105
106
|
const hasHeader = useMemo(() => hasScreenHeader(children), [children]);
|
|
106
107
|
const resolvedMargins = contentPadding ?? margins ?? (hasMargins === false ? "none" : "all");
|
|
107
108
|
const edges = useMemo(() => resolveSafeAreaEdges(safeArea), [safeArea]);
|
|
109
|
+
const hasVerticalScrollContainer = useMemo(() => hasScrollContainerOwningBottom(children), [children]);
|
|
108
110
|
/*
|
|
109
|
-
|
|
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.
|
|
110
137
|
Applied to the frame, the bottom inset shrinks the scroll viewport, so content
|
|
111
138
|
stops above a tab bar rather than passing beneath it — and on iOS that inset
|
|
112
139
|
includes the bar itself, which UIKit folds into a tab screen's safe area. The
|
|
113
140
|
container reaches the same resting position by padding the end of its content
|
|
114
141
|
instead, which is how the platform's own content-inset adjustment behaves.
|
|
115
142
|
*/
|
|
116
|
-
const contentOwnsBottomInset =
|
|
117
|
-
const frameEdges = useMemo(() =>
|
|
143
|
+
const contentOwnsBottomInset = !platformAdjustsInsets && edges.bottom && hasVerticalScrollContainer;
|
|
144
|
+
const frameEdges = useMemo(() => platformAdjustsInsets ? {
|
|
118
145
|
...edges,
|
|
146
|
+
top: false,
|
|
119
147
|
bottom: false
|
|
120
|
-
} :
|
|
148
|
+
} : contentOwnsBottomInset ? {
|
|
149
|
+
...edges,
|
|
150
|
+
bottom: false
|
|
151
|
+
} : edges, [platformAdjustsInsets, contentOwnsBottomInset, edges]);
|
|
121
152
|
const {
|
|
122
153
|
theme
|
|
123
154
|
} = useUnistyles();
|
|
124
155
|
const resolvedBackground = resolveThemeColor(background, theme) ?? theme.color["surface.canvas"];
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
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
|
+
})
|
|
140
206
|
})
|
|
141
207
|
})
|
|
142
208
|
})
|
|
143
209
|
})
|
|
144
|
-
|
|
210
|
+
);
|
|
145
211
|
});
|
|
146
212
|
ScreenBase.Header = ScreenHeader;
|
|
147
213
|
ScreenBase.ScrollView = ScreenScrollView;
|
|
@@ -167,10 +233,4 @@ ScreenBase.List = ScreenList;
|
|
|
167
233
|
* ```
|
|
168
234
|
*/
|
|
169
235
|
export const Screen = ScreenBase;
|
|
170
|
-
const styles = StyleSheet.create(() => ({
|
|
171
|
-
container: backgroundColor => ({
|
|
172
|
-
flex: 1,
|
|
173
|
-
backgroundColor
|
|
174
|
-
})
|
|
175
|
-
}));
|
|
176
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,SAAAC,GAAA,IAAAC,IAAA;AAYA;AACA;AACA;AACA;AACA;A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EF,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":[]}
|
|
@@ -24,6 +24,8 @@ export function ScreenScrollProvider({
|
|
|
24
24
|
contentPadding = "all",
|
|
25
25
|
safeArea = "auto",
|
|
26
26
|
contentOwnsBottomInset = false,
|
|
27
|
+
platformAdjustsInsets = false,
|
|
28
|
+
platformInsetsEligible = false,
|
|
27
29
|
hasHeader = false
|
|
28
30
|
}) {
|
|
29
31
|
const scrollY = useSharedValue(0);
|
|
@@ -45,6 +47,8 @@ export function ScreenScrollProvider({
|
|
|
45
47
|
contentPadding,
|
|
46
48
|
safeArea,
|
|
47
49
|
contentOwnsBottomInset,
|
|
50
|
+
platformAdjustsInsets,
|
|
51
|
+
platformInsetsEligible,
|
|
48
52
|
margins: contentPadding,
|
|
49
53
|
hasHeader,
|
|
50
54
|
scrollY,
|
|
@@ -53,7 +57,7 @@ export function ScreenScrollProvider({
|
|
|
53
57
|
setHeaderCollapseHeight,
|
|
54
58
|
scrollRef,
|
|
55
59
|
scrollHandler
|
|
56
|
-
}), [background, contentPadding, safeArea, contentOwnsBottomInset, hasHeader, scrollY, headerCollapseHeight, headerSnapOffsets, setHeaderCollapseHeight, scrollRef, scrollHandler]);
|
|
60
|
+
}), [background, contentPadding, safeArea, contentOwnsBottomInset, platformAdjustsInsets, platformInsetsEligible, hasHeader, scrollY, headerCollapseHeight, headerSnapOffsets, setHeaderCollapseHeight, scrollRef, scrollHandler]);
|
|
57
61
|
return /*#__PURE__*/_jsx(ScreenContext.Provider, {
|
|
58
62
|
value: value,
|
|
59
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","contentOwnsBottomInset","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;IAClB,MAAMC,OAAO,GAAGC,IAAI,CAACC,KAAK,CAACH,MAAM,C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ignoreList":[]}
|
|
@@ -7,6 +7,7 @@ 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";
|
|
12
13
|
import { ScreenBottomInset } from "./parts/ScreenBottomInset";
|
|
@@ -61,11 +62,13 @@ const ScreenListBase = /*#__PURE__*/forwardRef(function ScreenList({
|
|
|
61
62
|
headerSnapOffsets,
|
|
62
63
|
contentPadding: screenPadding,
|
|
63
64
|
hasHeader,
|
|
64
|
-
contentOwnsBottomInset
|
|
65
|
+
contentOwnsBottomInset,
|
|
66
|
+
platformAdjustsInsets
|
|
65
67
|
} = useScreen();
|
|
66
68
|
// The root yields the bottom edge only to a vertical container, so a horizontal
|
|
67
69
|
// one here is a secondary container and must not pay the inset a second time.
|
|
68
70
|
const ownsBottomInset = contentOwnsBottomInset && !horizontal;
|
|
71
|
+
useNestedContainerWarning("Screen.List", horizontal);
|
|
69
72
|
const mergedRef = useScreenRef(isDefaultFlatList ? scrollRef : undefined, ref);
|
|
70
73
|
const resolvedPadding = contentPadding ?? margins ?? screenPadding;
|
|
71
74
|
const resolvedLoading = isLoading ?? loading;
|
|
@@ -94,8 +97,13 @@ const ScreenListBase = /*#__PURE__*/forwardRef(function ScreenList({
|
|
|
94
97
|
style: [{
|
|
95
98
|
backgroundColor: background
|
|
96
99
|
}, style],
|
|
97
|
-
horizontal: horizontal
|
|
98
|
-
|
|
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",
|
|
99
107
|
automaticallyAdjustContentInsets: false,
|
|
100
108
|
automaticallyAdjustsScrollIndicatorInsets: false,
|
|
101
109
|
contentContainerStyle: [styles.content(resolvedPadding, hasHeader, bottomInset, extraBottomPadding), contentContainerStyle],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","useMemo","Animated","StyleSheet","resolveScreenPadding","PortalHost","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","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,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,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"],"mapp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H,MAAM;MAAE+C,CAAC;MAAEC;IAAE,CAAC,GAAGtF,oBAAoB,CAACkF,KAAK,EAAEC,OAAO,CAACI,UAAU,CAAC;IAChE,OAAO;MACLC,QAAQ,EAAE,CAAC;MACXC,UAAU,EAAE,CAACnC,SAAS,GAAG4B,KAAK,CAACQ,MAAM,CAACzB,MAAM,CAAC0B,MAAM,GAAG,CAAC,KAAKjF,kBAAkB,CAAC0E,OAAO,CAAC,GAAGE,CAAC,GAAG,CAAC,CAAC;MAChGM,iBAAiB,EAAEnF,oBAAoB,CAAC2E,OAAO,CAAC,GAAGC,CAAC,GAAG,CAAC;MACxDQ,aAAa,EAAE,CAACxD,WAAW,KAAK3B,kBAAkB,CAAC0E,OAAO,CAAC,GAAGE,CAAC,GAAG,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,6 +6,7 @@ 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";
|
|
11
12
|
import { ScreenBottomInset } from "./parts/ScreenBottomInset";
|
|
@@ -58,11 +59,13 @@ export const ScreenScrollView = /*#__PURE__*/forwardRef(function ScreenScrollVie
|
|
|
58
59
|
contentPadding: screenPadding,
|
|
59
60
|
hasHeader,
|
|
60
61
|
background,
|
|
61
|
-
contentOwnsBottomInset
|
|
62
|
+
contentOwnsBottomInset,
|
|
63
|
+
platformAdjustsInsets
|
|
62
64
|
} = useScreen();
|
|
63
65
|
// The root yields the bottom edge only to a vertical container, so a horizontal
|
|
64
66
|
// one here is a secondary container and must not pay the inset a second time.
|
|
65
67
|
const ownsBottomInset = contentOwnsBottomInset && !horizontal;
|
|
68
|
+
useNestedContainerWarning("Screen.ScrollView", horizontal);
|
|
66
69
|
const resolvedPadding = contentPadding ?? margins ?? screenPadding;
|
|
67
70
|
const mergedRef = useScreenRef(scrollRef, ref);
|
|
68
71
|
const placeholder = renderScreenPlaceholder({
|
|
@@ -77,8 +80,13 @@ export const ScreenScrollView = /*#__PURE__*/forwardRef(function ScreenScrollVie
|
|
|
77
80
|
style: [{
|
|
78
81
|
backgroundColor: background
|
|
79
82
|
}, style],
|
|
80
|
-
horizontal: horizontal
|
|
81
|
-
|
|
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",
|
|
82
90
|
automaticallyAdjustContentInsets: false,
|
|
83
91
|
automaticallyAdjustsScrollIndicatorInsets: false,
|
|
84
92
|
showsVerticalScrollIndicator: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Children","forwardRef","Animated","StyleSheet","resolveScreenPadding","PortalHost","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","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,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,
|
|
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,OAAO,GAAG,KAAK;EACfC,cAAc;EACdC,gBAAgB;EAChBC,YAAY;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AChGO,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":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useCallback","useContext","useState","Animated","StyleSheet","ScreenHeaderAppearanceContext","ScreenSafeArea","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","ScreenFrame","children","edges","appearance","topInset","setTopInset","onLayout","event","nativeEvent","layout","y","View","style","styles","content","top","background","undefined","pointerEvents","topSafeArea","color","animatedStyle","create","flex","height","backgroundColor","position","left","right"],"sourceRoot":"../../../../../src","sources":["components/screen/parts/ScreenFrame.tsx"],"mappings":";;;AAAA,SAAiCA,WAAW,EAAEC,UAAU,EAAEC,QAAQ,QAAQ,OAAO;AAGjF,OAAOC,QAAQ,MAAM,yBAAyB;AAC9C,SAASC,UAAU,QAAQ,wBAAwB;AAGnD,SAASC,6BAA6B;AACtC,SAASC,cAAc;AAA2B,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAElD,OAAO,SAASC,WAAWA,CAAC;EAAEC,QAAQ;EAAEC;AAAyD,CAAC,EAAE;EAClG,MAAMC,UAAU,GAAGf,UAAU,CAACI,6BAA6B,CAAC;EAC5D,MAAM,CAACY,QAAQ,EAAEC,WAAW,CAAC,GAAGhB,QAAQ,CAAC,CAAC,CAAC;EAC3C,MAAMiB,QAAQ,GAAGnB,WAAW,CAAEoB,KAAwB,IAAK;IACzD;IACAF,WAAW,CAACE,KAAK,CAACC,WAAW,CAACC,MAAM,CAACC,CAAC,CAAC;EACzC,CAAC,EAAE,EAAE,CAAC;EAEN,oBACEX,KAAA,CAAAF,SAAA;IAAAI,QAAA,gBACEN,IAAA,CAACF,cAAc;MAACS,KAAK,EAAEA,KAAM;MAAAD,QAAA,
|
|
1
|
+
{"version":3,"names":["useCallback","useContext","useState","Animated","StyleSheet","ScreenHeaderAppearanceContext","ScreenSafeArea","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","ScreenFrame","children","edges","appearance","topInset","setTopInset","onLayout","event","nativeEvent","layout","y","View","collapsable","style","styles","content","top","background","undefined","pointerEvents","topSafeArea","color","animatedStyle","create","flex","height","backgroundColor","position","left","right"],"sourceRoot":"../../../../../src","sources":["components/screen/parts/ScreenFrame.tsx"],"mappings":";;;AAAA,SAAiCA,WAAW,EAAEC,UAAU,EAAEC,QAAQ,QAAQ,OAAO;AAGjF,OAAOC,QAAQ,MAAM,yBAAyB;AAC9C,SAASC,UAAU,QAAQ,wBAAwB;AAGnD,SAASC,6BAA6B;AACtC,SAASC,cAAc;AAA2B,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAElD,OAAO,SAASC,WAAWA,CAAC;EAAEC,QAAQ;EAAEC;AAAyD,CAAC,EAAE;EAClG,MAAMC,UAAU,GAAGf,UAAU,CAACI,6BAA6B,CAAC;EAC5D,MAAM,CAACY,QAAQ,EAAEC,WAAW,CAAC,GAAGhB,QAAQ,CAAC,CAAC,CAAC;EAC3C,MAAMiB,QAAQ,GAAGnB,WAAW,CAAEoB,KAAwB,IAAK;IACzD;IACAF,WAAW,CAACE,KAAK,CAACC,WAAW,CAACC,MAAM,CAACC,CAAC,CAAC;EACzC,CAAC,EAAE,EAAE,CAAC;EAEN,oBACEX,KAAA,CAAAF,SAAA;IAAAI,QAAA,gBACEN,IAAA,CAACF,cAAc;MAACS,KAAK,EAAEA,KAAM;MAAAD,QAAA,eAQ3BN,IAAA,CAACgB,IAAI;QAACC,WAAW,EAAE,KAAM;QAACC,KAAK,EAAEC,MAAM,CAACC,OAAQ;QAACT,QAAQ,EAAEA,QAAS;QAAAL,QAAA,EACjEA;MAAQ,CACL;IAAC,CACO,CAAC,EAChBC,KAAK,CAACc,GAAG,IAAIb,UAAU,EAAEc,UAAU,KAAKC,SAAS,iBAChDvB,IAAA,CAACL,QAAQ,CAACqB,IAAI;MACZQ,aAAa,EAAC,MAAM;MACpBN,KAAK,EAAE,CACLC,MAAM,CAACM,WAAW,CAAChB,QAAQ,EAAED,UAAU,CAACc,UAAU,CAACI,KAAK,CAAC,EACzDlB,UAAU,CAACc,UAAU,CAACK,aAAa;IACnC,CACH,CACF;EAAA,CACD,CAAC;AAEP;AAEA,MAAMR,MAAM,GAAGvB,UAAU,CAACgC,MAAM,CAAC,OAAO;EACtCR,OAAO,EAAE;IAAES,IAAI,EAAE;EAAE,CAAC;EACpBJ,WAAW,EAAEA,CAACK,MAAc,EAAEC,eAAuB,MAAM;IACzDC,QAAQ,EAAE,UAAU;IACpBX,GAAG,EAAE,CAAC;IACNY,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE,CAAC;IACRJ,MAAM;IACNC;EACF,CAAC;AACH,CAAC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -61,6 +61,12 @@ export interface ScreenProps extends ViewProps {
|
|
|
61
61
|
* root frame. Drop `"bottom"` from the list to reserve no room for the bar at
|
|
62
62
|
* all — see `extraBottomPadding` for adding your own.
|
|
63
63
|
*
|
|
64
|
+
* On iOS, a screen with no `Screen.Header` hands both vertical edges to UIKit's
|
|
65
|
+
* own content-inset adjustment instead: the bar above such a screen is a native
|
|
66
|
+
* navigation bar, and a native large title only collapses for a scroll view
|
|
67
|
+
* that fills the screen. Do not also pass `contentInsetAdjustmentBehavior` to
|
|
68
|
+
* the container there — the default already asks UIKit for it.
|
|
69
|
+
*
|
|
64
70
|
* @defaultValue "auto"
|
|
65
71
|
*/
|
|
66
72
|
safeArea?: ScreenSafeAreaPolicy;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Screen.d.ts","sourceRoot":"","sources":["../../../../../src/components/screen/Screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,wBAAwB,EAC7B,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,QAAQ,EACR,UAAU,EAEV,KAAK,iBAAiB,EAEtB,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AACf,OAAO,
|
|
1
|
+
{"version":3,"file":"Screen.d.ts","sourceRoot":"","sources":["../../../../../src/components/screen/Screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,wBAAwB,EAC7B,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,QAAQ,EACR,UAAU,EAEV,KAAK,iBAAiB,EAEtB,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AACf,OAAO,EAAY,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAI9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAM/C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAkB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAc,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,cAAc,IAAI,oBAAoB,EAAE,MAAM,YAAS,CAAC;AAG3G,qFAAqF;AACrF,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,WAAW,GAAG,OAAO,QAAQ,IAAI,iBAAiB,CACxF;IACE;;;;OAIG;IACH,EAAE,CAAC,EAAE,CAAC,CAAC;CACR,GAAG,IAAI,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAClD,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,iBAAS,YAAY,CAAC,CAAC,SAAS,WAAW,GAAG,OAAO,QAAQ,EAAE,EAC7D,QAAQ,EACR,EAAE,EACF,GAAG,IAAI,EACR,EAAE,iBAAiB,CAAC,CAAC,CAAC,+BAOtB;kBAXQ,YAAY;;;AA+DrB,uFAAuF;AACvF,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,qFAAqF;IACrF,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;OAIG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,cAAc,CAAC,EAAE,oBAAoB,CAAC;IACtC;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAChC,sCAAsC;IACtC,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,KAAK,eAAe,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,YAAY,CAAC,OAAO,IAAI,CAAC,EAAE,WAAW,CAAC,CAAC,GAAG;IAC7F,2DAA2D;IAC3D,MAAM,EAAE,OAAO,YAAY,CAAC;IAC5B,6EAA6E;IAC7E,UAAU,EAAE,OAAO,gBAAgB,CAAC;IACpC,kEAAkE;IAClE,QAAQ,EAAE,OAAO,cAAc,CAAC;IAChC,sEAAsE;IACtE,IAAI,EAAE,OAAO,UAAU,CAAC;CACzB,CAAC;AAgIF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,MAAM,iBAAa,CAAC"}
|
|
@@ -25,6 +25,28 @@ export interface ScreenContextValue {
|
|
|
25
25
|
* or a horizontal container needs.
|
|
26
26
|
*/
|
|
27
27
|
contentOwnsBottomInset: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Whether the platform's own content-inset adjustment pays the vertical insets.
|
|
30
|
+
*
|
|
31
|
+
* True on an iOS screen with no `Screen.Header`: the navigation bar above such a
|
|
32
|
+
* screen is UIKit's, and only UIKit can inset a scroll view for one — a native
|
|
33
|
+
* large title resizes on every frame of its collapse, and it refuses to collapse
|
|
34
|
+
* at all for a scroll view that does not fill the screen. The frame therefore
|
|
35
|
+
* keeps no vertical edge, the container asks for
|
|
36
|
+
* `contentInsetAdjustmentBehavior: "automatic"` rather than `"never"`, and
|
|
37
|
+
* `contentOwnsBottomInset` stays false because UIKit pays that edge too.
|
|
38
|
+
*/
|
|
39
|
+
platformAdjustsInsets: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Whether this screen *would* hand its vertical insets to the platform, if it
|
|
42
|
+
* found a vertical scroll container among its children.
|
|
43
|
+
*
|
|
44
|
+
* Everything `platformAdjustsInsets` needs except the container itself. The two
|
|
45
|
+
* differ only when the container is nested inside another component, where the
|
|
46
|
+
* root cannot see it — which is a mistake on such a screen, and the difference
|
|
47
|
+
* is how a mounting container detects that it was the one missed.
|
|
48
|
+
*/
|
|
49
|
+
platformInsetsEligible: boolean;
|
|
28
50
|
/** @deprecated Use contentPadding. */
|
|
29
51
|
margins: ScreenContentPadding;
|
|
30
52
|
/** Whether a `Screen.Header` is present. Used by scroll containers to add top inset. */
|
|
@@ -63,6 +85,10 @@ export interface ScreenScrollProviderProps {
|
|
|
63
85
|
safeArea?: ScreenSafeArea;
|
|
64
86
|
/** Whether the primary scroll container pads the bottom safe area. Default false. */
|
|
65
87
|
contentOwnsBottomInset?: boolean;
|
|
88
|
+
/** Whether the platform adjusts the scroll container's vertical insets. Default false. */
|
|
89
|
+
platformAdjustsInsets?: boolean;
|
|
90
|
+
/** Whether the screen qualifies for that, container aside. Default false. */
|
|
91
|
+
platformInsetsEligible?: boolean;
|
|
66
92
|
/** Whether a `Screen.Header` child is present. Default false. */
|
|
67
93
|
hasHeader?: boolean;
|
|
68
94
|
/** Resolved background color shared with scroll containers. */
|
|
@@ -72,7 +98,7 @@ export interface ScreenScrollProviderProps {
|
|
|
72
98
|
* Owns the screen's shared scroll ref, offset, snap offsets, and header collapse
|
|
73
99
|
* metrics. Scroll containers bind the ref via {@link useScreen}.
|
|
74
100
|
*/
|
|
75
|
-
export declare function ScreenScrollProvider({ background, children, contentPadding, safeArea, contentOwnsBottomInset, hasHeader, }: ScreenScrollProviderProps): import("react").JSX.Element;
|
|
101
|
+
export declare function ScreenScrollProvider({ background, children, contentPadding, safeArea, contentOwnsBottomInset, platformAdjustsInsets, platformInsetsEligible, hasHeader, }: ScreenScrollProviderProps): import("react").JSX.Element;
|
|
76
102
|
/**
|
|
77
103
|
* Reads the nearest `Screen`'s configuration, shared scroll state, and ref.
|
|
78
104
|
* Read `scrollY.value` in Reanimated worklets to animate without React renders.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScreenContext.d.ts","sourceRoot":"","sources":["../../../../../src/components/screen/ScreenContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,SAAS,EAA8C,MAAM,OAAO,CAAC;AAElG,OAAO,QAAQ,EAAE,EACf,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAC3B,KAAK,WAAW,EAIjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,YAAS,CAAC;AAEpE,6EAA6E;AAC7E,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;AAE/D,yDAAyD;AACzD,eAAO,MAAM,yBAAyB,kBAAkB,CAAC;AAEzD,gFAAgF;AAChF,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,cAAc,EAAE,oBAAoB,CAAC;IACrC,6EAA6E;IAC7E,QAAQ,EAAE,cAAc,CAAC;IACzB;;;;;;;;;OASG;IACH,sBAAsB,EAAE,OAAO,CAAC;IAChC,sCAAsC;IACtC,OAAO,EAAE,oBAAoB,CAAC;IAC9B,wFAAwF;IACxF,SAAS,EAAE,OAAO,CAAC;IACnB,8EAA8E;IAC9E,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7B;;;OAGG;IACH,oBAAoB,EA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E,OAAO,CAAC;IACjC,0FAA0F;IAC1F,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,6EAA6E;IAC7E,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,iEAAiE;IACjE,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,UAA0B,EAC1B,QAAQ,EACR,cAAsB,EACtB,QAAiB,EACjB,sBAA8B,EAC9B,qBAA6B,EAC7B,sBAA8B,EAC9B,SAAiB,GAClB,EAAE,yBAAyB,+BAwD3B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,SAAS,IAAI,kBAAkB,CAM9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScreenList.d.ts","sourceRoot":"","sources":["../../../../../src/components/screen/ScreenList.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAE1B,KAAK,WAAW,EAEhB,KAAK,YAAY,EAEjB,KAAK,aAAa,EAEnB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,KAAK,cAAc,EAAQ,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"ScreenList.d.ts","sourceRoot":"","sources":["../../../../../src/components/screen/ScreenList.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAE1B,KAAK,WAAW,EAEhB,KAAK,YAAY,EAEjB,KAAK,aAAa,EAEnB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,KAAK,cAAc,EAAQ,MAAM,cAAc,CAAC;AAavF,OAAO,KAAK,EAAwB,qBAAqB,EAAE,MAAM,YAAS,CAAC;AAG3E,oGAAoG;AACpG,MAAM,W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CAAC,MAAM,CAAC,CAAC,GACpE,KAAK,SAAS,MAAM,qBAAqB,CAAC,EAAE,CAAC,GAC3C,OAAO,GACP,KAAK,GACP,KAAK,GACP,KAAK,CAAC,CAAC;IACf,GAAG,CAAC,EAAE,qBAAqB,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;CACxC,CAAC;AAEJ,iFAAiF;AACjF,MAAM,MAAM,eAAe,CACzB,CAAC,GAAG,OAAO,EACX,EAAE,SAAS,WAAW,GAAG,OAAO,QAAQ,IACtC,EAAE,SAAS,OAAO,QAAQ,GAAG,qBAAqB,CAAC,CAAC,CAAC,GAAG,qBAAqB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAEzF,UAAU,mBAAmB;IAC3B,CAAC,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,YAAY,GAAG,IAAI,CAAC;IACjF,CAAC,CAAC,EAAE,EAAE,SAAS,WAAW,EAAE,KAAK,EAAE,qBAAqB,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,YAAY,GAAG,IAAI,CAAC;IACtF,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AA8GD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,UAAU,EAAqB,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScreenScrollView.d.ts","sourceRoot":"","sources":["../../../../../src/components/screen/ScreenScrollView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA2C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAChF,OAAO,EAAmB,KAAK,eAAe,EAAE,KAAK,SAAS,EAAQ,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"ScreenScrollView.d.ts","sourceRoot":"","sources":["../../../../../src/components/screen/ScreenScrollView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA2C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAChF,OAAO,EAAmB,KAAK,eAAe,EAAE,KAAK,SAAS,EAAQ,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAa3G,OAAO,KAAK,EAAwB,qBAAqB,EAAE,MAAM,YAAS,CAAC;AAG3E,qFAAqF;AACrF,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC,EAAE,qBAAqB;IACvG,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,iEAAiE;IACjE,YAAY,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACpC,uFAAuF;IACvF,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,gBAAgB,8MA6E5B,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Warns, in development, when this container is the one the screen root failed
|
|
3
|
+
* to find.
|
|
4
|
+
*
|
|
5
|
+
* The root inspects its own children and fragments but does not execute
|
|
6
|
+
* component children, so a container rendered inside one is invisible to it (see
|
|
7
|
+
* `hasScrollContainerOwningBottom`). On a header-less iOS screen that changes
|
|
8
|
+
* behaviour rather than just bookkeeping: the frame pads the top edge, the scroll
|
|
9
|
+
* view no longer fills the screen, and UIKit stops collapsing the native large
|
|
10
|
+
* title — silently, with the screen otherwise looking correct.
|
|
11
|
+
*
|
|
12
|
+
* The container is the only place that can tell. `platformInsetsEligible` says
|
|
13
|
+
* the screen qualified; a container mounting while `platformAdjustsInsets` is
|
|
14
|
+
* false says the root never saw it. Both true together mean exactly this mistake,
|
|
15
|
+
* so there is nothing here to false-positive on: a screen with no scroll
|
|
16
|
+
* container at all never runs this hook, and a deliberate `safeArea` opt-out is
|
|
17
|
+
* not eligible in the first place.
|
|
18
|
+
*
|
|
19
|
+
* @param container Name to report, e.g. `"Screen.List"`.
|
|
20
|
+
* @param horizontal Whether this container scrolls horizontally; those are never
|
|
21
|
+
* candidates for the vertical insets and never warn.
|
|
22
|
+
*/
|
|
23
|
+
export declare function useNestedContainerWarning(container: string, horizontal: boolean): void;
|
|
24
|
+
//# sourceMappingURL=use-nested-container-warning.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-nested-container-warning.d.ts","sourceRoot":"","sources":["../../../../../../src/components/screen/hooks/use-nested-container-warning.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,GAAG,IAAI,CAatF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScreenFrame.d.ts","sourceRoot":"","sources":["../../../../../../src/components/screen/parts/ScreenFrame.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAqC,MAAM,OAAO,CAAC;AAMlF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAU,CAAC;AAIpD,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,iBAAiB,CAAC;IAAE,KAAK,EAAE,mBAAmB,CAAA;CAAE,CAAC,+
|
|
1
|
+
{"version":3,"file":"ScreenFrame.d.ts","sourceRoot":"","sources":["../../../../../../src/components/screen/parts/ScreenFrame.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAqC,MAAM,OAAO,CAAC;AAMlF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAU,CAAC;AAIpD,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,iBAAiB,CAAC;IAAE,KAAK,EAAE,mBAAmB,CAAA;CAAE,CAAC,+BAiCjG"}
|
package/package.json
CHANGED
|
@@ -11,9 +11,9 @@ import {
|
|
|
11
11
|
type ReactNode,
|
|
12
12
|
useMemo,
|
|
13
13
|
} from "react";
|
|
14
|
-
import { View, type ViewProps } from "react-native";
|
|
14
|
+
import { Platform, View, type ViewProps } from "react-native";
|
|
15
15
|
|
|
16
|
-
import {
|
|
16
|
+
import { useUnistyles } from "react-native-unistyles";
|
|
17
17
|
|
|
18
18
|
import type { ColorToken } from "#theme/types";
|
|
19
19
|
import { resolveThemeColor } from "#utils/resolve-theme-color";
|
|
@@ -145,6 +145,12 @@ export interface ScreenProps extends ViewProps {
|
|
|
145
145
|
* root frame. Drop `"bottom"` from the list to reserve no room for the bar at
|
|
146
146
|
* all — see `extraBottomPadding` for adding your own.
|
|
147
147
|
*
|
|
148
|
+
* On iOS, a screen with no `Screen.Header` hands both vertical edges to UIKit's
|
|
149
|
+
* own content-inset adjustment instead: the bar above such a screen is a native
|
|
150
|
+
* navigation bar, and a native large title only collapses for a scroll view
|
|
151
|
+
* that fills the screen. Do not also pass `contentInsetAdjustmentBehavior` to
|
|
152
|
+
* the container there — the default already asks UIKit for it.
|
|
153
|
+
*
|
|
148
154
|
* @defaultValue "auto"
|
|
149
155
|
*/
|
|
150
156
|
safeArea?: ScreenSafeAreaPolicy;
|
|
@@ -184,8 +190,37 @@ const ScreenBase = forwardRef<ComponentRef<typeof View>, ScreenProps>(function S
|
|
|
184
190
|
const hasHeader = useMemo(() => hasScreenHeader(children), [children]);
|
|
185
191
|
const resolvedMargins = contentPadding ?? margins ?? (hasMargins === false ? "none" : "all");
|
|
186
192
|
const edges = useMemo(() => resolveSafeAreaEdges(safeArea), [safeArea]);
|
|
193
|
+
const hasVerticalScrollContainer = useMemo(() => hasScrollContainerOwningBottom(children), [children]);
|
|
187
194
|
/*
|
|
188
|
-
|
|
195
|
+
A screen with no `Screen.Header` wears UIKit's own navigation bar, and only
|
|
196
|
+
UIKit can inset a scroll view for one.
|
|
197
|
+
|
|
198
|
+
A native large title changes height on every frame of its collapse, and the
|
|
199
|
+
bar is a sibling view this screen cannot measure — so an inset computed in JS
|
|
200
|
+
is always a frame late and always the wrong size. Worse, UIKit will not
|
|
201
|
+
collapse the title at all unless the scroll view it finds fills the screen:
|
|
202
|
+
padding the top edge on the frame starts that view 168pt down (measured on an
|
|
203
|
+
iPhone 17, expanded title), and the title then stays full size while rows
|
|
204
|
+
scroll up and overprint it.
|
|
205
|
+
|
|
206
|
+
So the frame keeps no vertical edge on such a screen, the container turns
|
|
207
|
+
UIKit's `contentInsetAdjustmentBehavior` back on, and UIKit pays the top and
|
|
208
|
+
the bottom both — which is why `ScreenBottomInset` stands down here rather
|
|
209
|
+
than paying that edge a second time. iOS only: this is UIKit's mechanism, and
|
|
210
|
+
Android has no navigation bar to track.
|
|
211
|
+
|
|
212
|
+
Both vertical edges have to be protected to hand them over, because UIKit
|
|
213
|
+
adjusts for both or for neither. A policy that asks for one and not the other
|
|
214
|
+
cannot be expressed this way, so it keeps the ordinary treatment below and
|
|
215
|
+
is honoured exactly as written — at the cost of the title collapse, which is
|
|
216
|
+
the better trade: an edge list is an explicit instruction, and silently
|
|
217
|
+
insetting an edge the caller excluded would be the worse surprise.
|
|
218
|
+
*/
|
|
219
|
+
const platformInsetsEligible = Platform.OS === "ios" && !hasHeader && edges.top && edges.bottom;
|
|
220
|
+
const platformAdjustsInsets = platformInsetsEligible && hasVerticalScrollContainer;
|
|
221
|
+
/*
|
|
222
|
+
Otherwise the bottom edge goes to the scroll container when there is one to
|
|
223
|
+
take it.
|
|
189
224
|
|
|
190
225
|
Applied to the frame, the bottom inset shrinks the scroll viewport, so content
|
|
191
226
|
stops above a tab bar rather than passing beneath it — and on iOS that inset
|
|
@@ -193,24 +228,60 @@ const ScreenBase = forwardRef<ComponentRef<typeof View>, ScreenProps>(function S
|
|
|
193
228
|
container reaches the same resting position by padding the end of its content
|
|
194
229
|
instead, which is how the platform's own content-inset adjustment behaves.
|
|
195
230
|
*/
|
|
196
|
-
const contentOwnsBottomInset =
|
|
197
|
-
() => edges.bottom && hasScrollContainerOwningBottom(children),
|
|
198
|
-
[edges.bottom, children]
|
|
199
|
-
);
|
|
231
|
+
const contentOwnsBottomInset = !platformAdjustsInsets && edges.bottom && hasVerticalScrollContainer;
|
|
200
232
|
const frameEdges = useMemo(
|
|
201
|
-
() =>
|
|
202
|
-
|
|
233
|
+
() =>
|
|
234
|
+
platformAdjustsInsets
|
|
235
|
+
? { ...edges, top: false, bottom: false }
|
|
236
|
+
: contentOwnsBottomInset
|
|
237
|
+
? { ...edges, bottom: false }
|
|
238
|
+
: edges,
|
|
239
|
+
[platformAdjustsInsets, contentOwnsBottomInset, edges]
|
|
203
240
|
);
|
|
204
241
|
const { theme } = useUnistyles();
|
|
205
242
|
const resolvedBackground = resolveThemeColor(background, theme) ?? theme.color["surface.canvas"];
|
|
243
|
+
/*
|
|
244
|
+
A plain object, not a Unistyles stylesheet, and the background belongs in it
|
|
245
|
+
rather than arriving later.
|
|
246
|
+
|
|
247
|
+
Unistyles applies a dynamic function's style after mount. UIKit resolves a
|
|
248
|
+
screen's scroll view once, while it is being presented, and a scroll area
|
|
249
|
+
that was not yet the size of the screen at that moment never drives the
|
|
250
|
+
navigation bar afterwards — the large title stays expanded for the rest of
|
|
251
|
+
the screen's life.
|
|
252
|
+
*/
|
|
253
|
+
const rootStyle = useMemo(
|
|
254
|
+
() => ({ flex: 1, backgroundColor: resolvedBackground }) as const,
|
|
255
|
+
[resolvedBackground]
|
|
256
|
+
);
|
|
206
257
|
|
|
207
258
|
return (
|
|
208
|
-
|
|
259
|
+
/*
|
|
260
|
+
`collapsable={false}`, because a background colour alone is the worst of
|
|
261
|
+
both worlds here.
|
|
262
|
+
|
|
263
|
+
Fabric decides two things separately: whether a view is mounted at all, and
|
|
264
|
+
whether it *keeps* its children. A `View` with only layout styles is
|
|
265
|
+
dropped and its children are re-parented to its own parent — harmless. Give
|
|
266
|
+
it a background and it is mounted, but it still does not form a stacking
|
|
267
|
+
context, so the children are mounted *beside* it instead of inside it. The
|
|
268
|
+
screen's view then begins with an empty full-screen view, and UIKit — which
|
|
269
|
+
finds the scroll view by walking first subviews down from the view
|
|
270
|
+
controller (`RNSScrollViewFinder` mirrors the same walk) — reaches that dead
|
|
271
|
+
end and finds nothing. Measured on an iPhone 17: no content-inset
|
|
272
|
+
adjustment and no large-title collapse at all.
|
|
273
|
+
|
|
274
|
+
`collapsable={false}` forms the stacking context, so the frame, the safe
|
|
275
|
+
areas, and the scroll container stay in one unbroken first-subview chain.
|
|
276
|
+
*/
|
|
277
|
+
<View collapsable={false} ref={ref} style={[rootStyle, style]} {...rest}>
|
|
209
278
|
<ScreenScrollProvider
|
|
210
279
|
background={resolvedBackground}
|
|
211
280
|
contentPadding={resolvedMargins}
|
|
212
281
|
safeArea={safeArea}
|
|
213
282
|
contentOwnsBottomInset={contentOwnsBottomInset}
|
|
283
|
+
platformAdjustsInsets={platformAdjustsInsets}
|
|
284
|
+
platformInsetsEligible={platformInsetsEligible}
|
|
214
285
|
hasHeader={hasHeader}
|
|
215
286
|
>
|
|
216
287
|
<ScreenHeaderAppearanceProvider>
|
|
@@ -247,10 +318,3 @@ ScreenBase.List = ScreenList;
|
|
|
247
318
|
* ```
|
|
248
319
|
*/
|
|
249
320
|
export const Screen = ScreenBase;
|
|
250
|
-
|
|
251
|
-
const styles = StyleSheet.create(() => ({
|
|
252
|
-
container: (backgroundColor: string) => ({
|
|
253
|
-
flex: 1,
|
|
254
|
-
backgroundColor,
|
|
255
|
-
}),
|
|
256
|
-
}));
|
|
@@ -37,6 +37,28 @@ export interface ScreenContextValue {
|
|
|
37
37
|
* or a horizontal container needs.
|
|
38
38
|
*/
|
|
39
39
|
contentOwnsBottomInset: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Whether the platform's own content-inset adjustment pays the vertical insets.
|
|
42
|
+
*
|
|
43
|
+
* True on an iOS screen with no `Screen.Header`: the navigation bar above such a
|
|
44
|
+
* screen is UIKit's, and only UIKit can inset a scroll view for one — a native
|
|
45
|
+
* large title resizes on every frame of its collapse, and it refuses to collapse
|
|
46
|
+
* at all for a scroll view that does not fill the screen. The frame therefore
|
|
47
|
+
* keeps no vertical edge, the container asks for
|
|
48
|
+
* `contentInsetAdjustmentBehavior: "automatic"` rather than `"never"`, and
|
|
49
|
+
* `contentOwnsBottomInset` stays false because UIKit pays that edge too.
|
|
50
|
+
*/
|
|
51
|
+
platformAdjustsInsets: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Whether this screen *would* hand its vertical insets to the platform, if it
|
|
54
|
+
* found a vertical scroll container among its children.
|
|
55
|
+
*
|
|
56
|
+
* Everything `platformAdjustsInsets` needs except the container itself. The two
|
|
57
|
+
* differ only when the container is nested inside another component, where the
|
|
58
|
+
* root cannot see it — which is a mistake on such a screen, and the difference
|
|
59
|
+
* is how a mounting container detects that it was the one missed.
|
|
60
|
+
*/
|
|
61
|
+
platformInsetsEligible: boolean;
|
|
40
62
|
/** @deprecated Use contentPadding. */
|
|
41
63
|
margins: ScreenContentPadding;
|
|
42
64
|
/** Whether a `Screen.Header` is present. Used by scroll containers to add top inset. */
|
|
@@ -78,6 +100,10 @@ export interface ScreenScrollProviderProps {
|
|
|
78
100
|
safeArea?: ScreenSafeArea;
|
|
79
101
|
/** Whether the primary scroll container pads the bottom safe area. Default false. */
|
|
80
102
|
contentOwnsBottomInset?: boolean;
|
|
103
|
+
/** Whether the platform adjusts the scroll container's vertical insets. Default false. */
|
|
104
|
+
platformAdjustsInsets?: boolean;
|
|
105
|
+
/** Whether the screen qualifies for that, container aside. Default false. */
|
|
106
|
+
platformInsetsEligible?: boolean;
|
|
81
107
|
/** Whether a `Screen.Header` child is present. Default false. */
|
|
82
108
|
hasHeader?: boolean;
|
|
83
109
|
|
|
@@ -95,6 +121,8 @@ export function ScreenScrollProvider({
|
|
|
95
121
|
contentPadding = "all",
|
|
96
122
|
safeArea = "auto",
|
|
97
123
|
contentOwnsBottomInset = false,
|
|
124
|
+
platformAdjustsInsets = false,
|
|
125
|
+
platformInsetsEligible = false,
|
|
98
126
|
hasHeader = false,
|
|
99
127
|
}: ScreenScrollProviderProps) {
|
|
100
128
|
const scrollY = useSharedValue(0);
|
|
@@ -123,6 +151,8 @@ export function ScreenScrollProvider({
|
|
|
123
151
|
contentPadding,
|
|
124
152
|
safeArea,
|
|
125
153
|
contentOwnsBottomInset,
|
|
154
|
+
platformAdjustsInsets,
|
|
155
|
+
platformInsetsEligible,
|
|
126
156
|
margins: contentPadding,
|
|
127
157
|
hasHeader,
|
|
128
158
|
scrollY,
|
|
@@ -137,6 +167,8 @@ export function ScreenScrollProvider({
|
|
|
137
167
|
contentPadding,
|
|
138
168
|
safeArea,
|
|
139
169
|
contentOwnsBottomInset,
|
|
170
|
+
platformAdjustsInsets,
|
|
171
|
+
platformInsetsEligible,
|
|
140
172
|
hasHeader,
|
|
141
173
|
scrollY,
|
|
142
174
|
headerCollapseHeight,
|
|
@@ -16,6 +16,7 @@ import { StyleSheet } from "react-native-unistyles";
|
|
|
16
16
|
|
|
17
17
|
import { resolveScreenPadding } from "#theme/screen-padding";
|
|
18
18
|
import { PortalHost } from "../portal";
|
|
19
|
+
import { useNestedContainerWarning } from "./hooks/use-nested-container-warning";
|
|
19
20
|
import { useScreenRef } from "./hooks/use-screen-ref";
|
|
20
21
|
import { useScreenScrollHandler } from "./hooks/use-screen-scroll-handler";
|
|
21
22
|
import { ScreenBottomInset } from "./parts/ScreenBottomInset";
|
|
@@ -174,10 +175,12 @@ const ScreenListBase = forwardRef(function ScreenList(
|
|
|
174
175
|
contentPadding: screenPadding,
|
|
175
176
|
hasHeader,
|
|
176
177
|
contentOwnsBottomInset,
|
|
178
|
+
platformAdjustsInsets,
|
|
177
179
|
} = useScreen();
|
|
178
180
|
// The root yields the bottom edge only to a vertical container, so a horizontal
|
|
179
181
|
// one here is a secondary container and must not pay the inset a second time.
|
|
180
182
|
const ownsBottomInset = contentOwnsBottomInset && !horizontal;
|
|
183
|
+
useNestedContainerWarning("Screen.List", horizontal);
|
|
181
184
|
const mergedRef = useScreenRef(isDefaultFlatList ? scrollRef : undefined, ref);
|
|
182
185
|
const resolvedPadding = contentPadding ?? margins ?? screenPadding;
|
|
183
186
|
const resolvedLoading = isLoading ?? loading;
|
|
@@ -212,7 +215,12 @@ const ScreenListBase = forwardRef(function ScreenList(
|
|
|
212
215
|
renderItem={renderItem}
|
|
213
216
|
style={[{ backgroundColor: background }, style]}
|
|
214
217
|
horizontal={horizontal}
|
|
215
|
-
|
|
218
|
+
/*
|
|
219
|
+
UIKit owns the vertical insets on a header-less iOS screen — see
|
|
220
|
+
`platformAdjustsInsets`. Everywhere else the frame has already paid them,
|
|
221
|
+
so a second adjustment here would count them twice.
|
|
222
|
+
*/
|
|
223
|
+
contentInsetAdjustmentBehavior={platformAdjustsInsets ? "automatic" : "never"}
|
|
216
224
|
automaticallyAdjustContentInsets={false}
|
|
217
225
|
automaticallyAdjustsScrollIndicatorInsets={false}
|
|
218
226
|
contentContainerStyle={[
|
|
@@ -6,6 +6,7 @@ import { StyleSheet } from "react-native-unistyles";
|
|
|
6
6
|
|
|
7
7
|
import { resolveScreenPadding } from "#theme/screen-padding";
|
|
8
8
|
import { PortalHost } from "../portal";
|
|
9
|
+
import { useNestedContainerWarning } from "./hooks/use-nested-container-warning";
|
|
9
10
|
import { useScreenRef } from "./hooks/use-screen-ref";
|
|
10
11
|
import { useScreenScrollHandler } from "./hooks/use-screen-scroll-handler";
|
|
11
12
|
import { ScreenBottomInset } from "./parts/ScreenBottomInset";
|
|
@@ -72,10 +73,12 @@ export const ScreenScrollView = forwardRef<ComponentRef<typeof ScrollView>, Scre
|
|
|
72
73
|
hasHeader,
|
|
73
74
|
background,
|
|
74
75
|
contentOwnsBottomInset,
|
|
76
|
+
platformAdjustsInsets,
|
|
75
77
|
} = useScreen();
|
|
76
78
|
// The root yields the bottom edge only to a vertical container, so a horizontal
|
|
77
79
|
// one here is a secondary container and must not pay the inset a second time.
|
|
78
80
|
const ownsBottomInset = contentOwnsBottomInset && !horizontal;
|
|
81
|
+
useNestedContainerWarning("Screen.ScrollView", horizontal);
|
|
79
82
|
const resolvedPadding = contentPadding ?? margins ?? screenPadding;
|
|
80
83
|
const mergedRef = useScreenRef(scrollRef, ref);
|
|
81
84
|
const placeholder = renderScreenPlaceholder({
|
|
@@ -91,7 +94,12 @@ export const ScreenScrollView = forwardRef<ComponentRef<typeof ScrollView>, Scre
|
|
|
91
94
|
ref={mergedRef}
|
|
92
95
|
style={[{ backgroundColor: background }, style]}
|
|
93
96
|
horizontal={horizontal}
|
|
94
|
-
|
|
97
|
+
/*
|
|
98
|
+
UIKit owns the vertical insets on a header-less iOS screen — see
|
|
99
|
+
`platformAdjustsInsets`. Everywhere else the frame has already paid
|
|
100
|
+
them, so a second adjustment here would count them twice.
|
|
101
|
+
*/
|
|
102
|
+
contentInsetAdjustmentBehavior={platformAdjustsInsets ? "automatic" : "never"}
|
|
95
103
|
automaticallyAdjustContentInsets={false}
|
|
96
104
|
automaticallyAdjustsScrollIndicatorInsets={false}
|
|
97
105
|
showsVerticalScrollIndicator={false}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
|
|
3
|
+
import { useScreen } from "../ScreenContext";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Warns, in development, when this container is the one the screen root failed
|
|
7
|
+
* to find.
|
|
8
|
+
*
|
|
9
|
+
* The root inspects its own children and fragments but does not execute
|
|
10
|
+
* component children, so a container rendered inside one is invisible to it (see
|
|
11
|
+
* `hasScrollContainerOwningBottom`). On a header-less iOS screen that changes
|
|
12
|
+
* behaviour rather than just bookkeeping: the frame pads the top edge, the scroll
|
|
13
|
+
* view no longer fills the screen, and UIKit stops collapsing the native large
|
|
14
|
+
* title — silently, with the screen otherwise looking correct.
|
|
15
|
+
*
|
|
16
|
+
* The container is the only place that can tell. `platformInsetsEligible` says
|
|
17
|
+
* the screen qualified; a container mounting while `platformAdjustsInsets` is
|
|
18
|
+
* false says the root never saw it. Both true together mean exactly this mistake,
|
|
19
|
+
* so there is nothing here to false-positive on: a screen with no scroll
|
|
20
|
+
* container at all never runs this hook, and a deliberate `safeArea` opt-out is
|
|
21
|
+
* not eligible in the first place.
|
|
22
|
+
*
|
|
23
|
+
* @param container Name to report, e.g. `"Screen.List"`.
|
|
24
|
+
* @param horizontal Whether this container scrolls horizontally; those are never
|
|
25
|
+
* candidates for the vertical insets and never warn.
|
|
26
|
+
*/
|
|
27
|
+
export function useNestedContainerWarning(container: string, horizontal: boolean): void {
|
|
28
|
+
const { platformAdjustsInsets, platformInsetsEligible } = useScreen();
|
|
29
|
+
const isNested = platformInsetsEligible && !platformAdjustsInsets && !horizontal;
|
|
30
|
+
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (!__DEV__ || !isNested) return;
|
|
33
|
+
console.warn(
|
|
34
|
+
`[react-native-terra-ui] ${container} is nested inside another component, so its Screen could not find it. ` +
|
|
35
|
+
"On iOS a Screen with no Screen.Header hands its vertical insets to UIKit, but only when the scroll " +
|
|
36
|
+
"container is among its own children — nested, the frame pads the top instead and a native large title " +
|
|
37
|
+
`will not collapse. Render ${container} as a direct child of Screen; fragments are fine.`
|
|
38
|
+
);
|
|
39
|
+
}, [container, isNested]);
|
|
40
|
+
}
|
|
@@ -19,7 +19,14 @@ export function ScreenFrame({ children, edges }: PropsWithChildren<{ edges: Scre
|
|
|
19
19
|
return (
|
|
20
20
|
<>
|
|
21
21
|
<ScreenSafeArea edges={edges}>
|
|
22
|
-
|
|
22
|
+
{/*
|
|
23
|
+
`collapsable={false}` for the same reason as the `Screen` root: whatever
|
|
24
|
+
Fabric decides about this view, its children have to stay inside it.
|
|
25
|
+
UIKit finds a screen's scroll view by walking first subviews down from
|
|
26
|
+
the view controller, and a mounted-but-childless view in that chain is a
|
|
27
|
+
dead end — the large title then never collapses.
|
|
28
|
+
*/}
|
|
29
|
+
<View collapsable={false} style={styles.content} onLayout={onLayout}>
|
|
23
30
|
{children}
|
|
24
31
|
</View>
|
|
25
32
|
</ScreenSafeArea>
|