@colixsystems/widget-sdk 0.354.0 → 0.355.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -2
- package/dist/contract.cjs +6 -4
- package/dist/contract.js +6 -4
- package/dist/index.d.ts +4 -0
- package/dist/linter.cjs +32 -5
- package/dist/linter.js +32 -5
- package/dist/nested-scroll-props.js +12 -0
- package/dist/primitives.native.js +2 -3
- package/dist/scroll-view.js +3 -3
- package/dist/scrollers.native.js +20 -0
- package/package.json +1 -1
- package/src/contract.js +6 -4
package/README.md
CHANGED
|
@@ -91,7 +91,15 @@ See the design reference for the full architecture: [`docs/architecture/widget-m
|
|
|
91
91
|
|
|
92
92
|
## Status
|
|
93
93
|
|
|
94
|
-
`v0.
|
|
94
|
+
`v0.355.1` — pre-publish. The package surface (types, function names, export paths) is the v1 contract; runtime behaviour for some hooks is stubbed (each hook documents what's wired and what isn't). It is **not yet published to npm**.
|
|
95
|
+
|
|
96
|
+
### What's new in 0.355.1 (contract 1.291.0)
|
|
97
|
+
|
|
98
|
+
**The date rule reads date-fns options it cannot see.** `date-shown-fixed-format` no longer flags a date-fns pattern that prints words when the call's options may carry the app's locale without spelling it out: options held in a variable (`format(d, "PPP", opts)`), an options object with a spread (`{ ...dfOptions }`), or a call with no `locale` after date-fns `setDefaultOptions` was given one (`setDefaultOptions({ locale: appLocale })`, imported by name, by default from `date-fns/setDefaultOptions` or through a namespace). A fixed `date-fns/locale` import is still one language, so `setDefaultOptions({ locale: sv })` or `{ ...dfOptions, locale: sv }` still flags, and a numeric day-before-month pattern flags whatever the options. Fewer findings, no new ones.
|
|
99
|
+
|
|
100
|
+
### What's new in 0.355.0 (contract 1.291.0)
|
|
101
|
+
|
|
102
|
+
**A list scrolls inside a scrolling page on Android.** A vertical `ScrollView`, `FlatList` or `SectionList` from this SDK now sets `nestedScrollEnabled` on native. Without it Android gives every vertical drag to the page, so a list with a fixed or maximum height never moved. Pass `nestedScrollEnabled={false}` to leave the drag to the page. An `inverted` list is left as it was: Android flips it, so it would scroll the page the wrong way; put it in a Fit to screen section. A `@shopify/flash-list` list, or a scroller imported from `react-native`, must set the prop itself. Installed apps pick it up with their next native build.
|
|
95
103
|
|
|
96
104
|
### What's new in 0.354.0 (contract 1.290.0)
|
|
97
105
|
|
|
@@ -3607,7 +3615,7 @@ Also: `useFileSignatures(fileIds)` is now **self-scoped** (the caller's own sign
|
|
|
3607
3615
|
- **`react-native-reanimated`** (`web`/`native`) — declarative animations.
|
|
3608
3616
|
- **`react-native-gesture-handler`** (`web`/`native`) — native-driven touch gestures.
|
|
3609
3617
|
- **`react-native-safe-area-context`** (`web`/`native`) — safe-area insets.
|
|
3610
|
-
- **`@shopify/flash-list`** (`web`/`native`) — high-performance virtualised list.
|
|
3618
|
+
- **`@shopify/flash-list`** (`web`/`native`) — high-performance virtualised list. Pass `nestedScrollEnabled` so it scrolls inside a scrolling page on Android.
|
|
3611
3619
|
- **`react-native-paper`** (`web`/`native`) — Material Design components.
|
|
3612
3620
|
- **`react-native-vector-icons`** (`web`/`native`) — icon font families.
|
|
3613
3621
|
- **`@react-native-community/slider`** (`web`/`native`) — slider input.
|
package/dist/contract.cjs
CHANGED
|
@@ -3638,7 +3638,7 @@ const PRIMITIVES = [
|
|
|
3638
3638
|
{
|
|
3639
3639
|
name: "ScrollView",
|
|
3640
3640
|
description:
|
|
3641
|
-
"Scrollable container. Pass `horizontal` to scroll on the x-axis. On the web, a horizontal row whose content overflows shows mouse users that it scrolls: the edge with more content fades, and hovering shows previous / next arrows that scroll about one view width. Touch screens and the exported app swipe as before, and a row that fits shows nothing. Pass `showsScrollAffordance={false}` only when the widget draws its own arrows. A short set of chips is better wrapped in a `<ChipGroup>` than scrolled. See https://reactnative.dev/docs/scrollview.",
|
|
3641
|
+
"Scrollable container. Pass `horizontal` to scroll on the x-axis. On the web, a horizontal row whose content overflows shows mouse users that it scrolls: the edge with more content fades, and hovering shows previous / next arrows that scroll about one view width. Touch screens and the exported app swipe as before, and a row that fits shows nothing. Pass `showsScrollAffordance={false}` only when the widget draws its own arrows. A short set of chips is better wrapped in a `<ChipGroup>` than scrolled. A vertical `ScrollView`, `FlatList` or `SectionList` from this SDK scrolls inside a scrolling page on Android too: it sets `nestedScrollEnabled` unless it is `inverted` or you pass `false`. One imported from `react-native` does not. See https://reactnative.dev/docs/scrollview.",
|
|
3642
3642
|
rnComponent: "ScrollView",
|
|
3643
3643
|
docsUrl: "https://reactnative.dev/docs/scrollview",
|
|
3644
3644
|
},
|
|
@@ -4999,7 +4999,7 @@ const VETTED_IMPORTS = [
|
|
|
4999
4999
|
platforms: ["web", "native"],
|
|
5000
5000
|
category: "primitive",
|
|
5001
5001
|
description:
|
|
5002
|
-
"Direct RN imports for APIs the SDK hasn't re-exported yet. On web `react-native` is host-resolved to the host's single react-native-web instance (external, shimmed) — NOT aliased at bundle time — so a bundled widget shares the host's RN-web (one StyleSheet/context, no double-instance conflicts). On native Metro resolves the real library.",
|
|
5002
|
+
"Direct RN imports for APIs the SDK hasn't re-exported yet. Take `ScrollView`, `FlatList` and `SectionList` from the SDK: React Native's own do not scroll inside a scrolling page on Android unless you pass `nestedScrollEnabled`. On web `react-native` is host-resolved to the host's single react-native-web instance (external, shimmed) — NOT aliased at bundle time — so a bundled widget shares the host's RN-web (one StyleSheet/context, no double-instance conflicts). On native Metro resolves the real library.",
|
|
5003
5003
|
},
|
|
5004
5004
|
{
|
|
5005
5005
|
specifier: "axios",
|
|
@@ -5146,7 +5146,7 @@ const VETTED_IMPORTS = [
|
|
|
5146
5146
|
platforms: ["web", "native"],
|
|
5147
5147
|
category: "list",
|
|
5148
5148
|
description:
|
|
5149
|
-
"High-performance virtualised list with a FlatList-compatible API. Prefer it over FlatList for long datasets; renders on both platforms.",
|
|
5149
|
+
"High-performance virtualised list with a FlatList-compatible API. Prefer it over FlatList for long datasets; renders on both platforms. Pass `nestedScrollEnabled`, or a vertical one does not scroll inside a scrolling page on Android.",
|
|
5150
5150
|
},
|
|
5151
5151
|
{
|
|
5152
5152
|
specifier: "react-native-paper",
|
|
@@ -7200,7 +7200,9 @@ const CONTRACT = deepFreeze({
|
|
|
7200
7200
|
// 1.290.0: stricter lint (sc-17804) — the app's button colours paint the
|
|
7201
7201
|
// primary `<Button>` only, and a literal `variant` the button does not
|
|
7202
7202
|
// draw is the publish-blocking `button-unknown-variant` finding.
|
|
7203
|
-
|
|
7203
|
+
// 1.291.0: behaviour (sc-18689) — a vertical native `ScrollView`, `FlatList`
|
|
7204
|
+
// or `SectionList` sets `nestedScrollEnabled` unless inverted or the author sets it.
|
|
7205
|
+
version: "1.291.0",
|
|
7204
7206
|
sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
|
|
7205
7207
|
hooks: HOOKS,
|
|
7206
7208
|
primitives: PRIMITIVES,
|
package/dist/contract.js
CHANGED
|
@@ -3633,7 +3633,7 @@ const PRIMITIVES = [
|
|
|
3633
3633
|
{
|
|
3634
3634
|
name: "ScrollView",
|
|
3635
3635
|
description:
|
|
3636
|
-
"Scrollable container. Pass `horizontal` to scroll on the x-axis. On the web, a horizontal row whose content overflows shows mouse users that it scrolls: the edge with more content fades, and hovering shows previous / next arrows that scroll about one view width. Touch screens and the exported app swipe as before, and a row that fits shows nothing. Pass `showsScrollAffordance={false}` only when the widget draws its own arrows. A short set of chips is better wrapped in a `<ChipGroup>` than scrolled. See https://reactnative.dev/docs/scrollview.",
|
|
3636
|
+
"Scrollable container. Pass `horizontal` to scroll on the x-axis. On the web, a horizontal row whose content overflows shows mouse users that it scrolls: the edge with more content fades, and hovering shows previous / next arrows that scroll about one view width. Touch screens and the exported app swipe as before, and a row that fits shows nothing. Pass `showsScrollAffordance={false}` only when the widget draws its own arrows. A short set of chips is better wrapped in a `<ChipGroup>` than scrolled. A vertical `ScrollView`, `FlatList` or `SectionList` from this SDK scrolls inside a scrolling page on Android too: it sets `nestedScrollEnabled` unless it is `inverted` or you pass `false`. One imported from `react-native` does not. See https://reactnative.dev/docs/scrollview.",
|
|
3637
3637
|
rnComponent: "ScrollView",
|
|
3638
3638
|
docsUrl: "https://reactnative.dev/docs/scrollview",
|
|
3639
3639
|
},
|
|
@@ -4994,7 +4994,7 @@ const VETTED_IMPORTS = [
|
|
|
4994
4994
|
platforms: ["web", "native"],
|
|
4995
4995
|
category: "primitive",
|
|
4996
4996
|
description:
|
|
4997
|
-
"Direct RN imports for APIs the SDK hasn't re-exported yet. On web `react-native` is host-resolved to the host's single react-native-web instance (external, shimmed) — NOT aliased at bundle time — so a bundled widget shares the host's RN-web (one StyleSheet/context, no double-instance conflicts). On native Metro resolves the real library.",
|
|
4997
|
+
"Direct RN imports for APIs the SDK hasn't re-exported yet. Take `ScrollView`, `FlatList` and `SectionList` from the SDK: React Native's own do not scroll inside a scrolling page on Android unless you pass `nestedScrollEnabled`. On web `react-native` is host-resolved to the host's single react-native-web instance (external, shimmed) — NOT aliased at bundle time — so a bundled widget shares the host's RN-web (one StyleSheet/context, no double-instance conflicts). On native Metro resolves the real library.",
|
|
4998
4998
|
},
|
|
4999
4999
|
{
|
|
5000
5000
|
specifier: "axios",
|
|
@@ -5141,7 +5141,7 @@ const VETTED_IMPORTS = [
|
|
|
5141
5141
|
platforms: ["web", "native"],
|
|
5142
5142
|
category: "list",
|
|
5143
5143
|
description:
|
|
5144
|
-
"High-performance virtualised list with a FlatList-compatible API. Prefer it over FlatList for long datasets; renders on both platforms.",
|
|
5144
|
+
"High-performance virtualised list with a FlatList-compatible API. Prefer it over FlatList for long datasets; renders on both platforms. Pass `nestedScrollEnabled`, or a vertical one does not scroll inside a scrolling page on Android.",
|
|
5145
5145
|
},
|
|
5146
5146
|
{
|
|
5147
5147
|
specifier: "react-native-paper",
|
|
@@ -7195,7 +7195,9 @@ const CONTRACT = deepFreeze({
|
|
|
7195
7195
|
// 1.290.0: stricter lint (sc-17804) — the app's button colours paint the
|
|
7196
7196
|
// primary `<Button>` only, and a literal `variant` the button does not
|
|
7197
7197
|
// draw is the publish-blocking `button-unknown-variant` finding.
|
|
7198
|
-
|
|
7198
|
+
// 1.291.0: behaviour (sc-18689) — a vertical native `ScrollView`, `FlatList`
|
|
7199
|
+
// or `SectionList` sets `nestedScrollEnabled` unless inverted or the author sets it.
|
|
7200
|
+
version: "1.291.0",
|
|
7199
7201
|
sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
|
|
7200
7202
|
hooks: HOOKS,
|
|
7201
7203
|
primitives: PRIMITIVES,
|
package/dist/index.d.ts
CHANGED
|
@@ -4421,6 +4421,10 @@ export const Image: any;
|
|
|
4421
4421
|
* scroll about one view width. Touch screens and the exported app are
|
|
4422
4422
|
* unchanged; keyboard and shift-wheel scrolling keep working. Pass false
|
|
4423
4423
|
* only when the widget draws its own arrows.
|
|
4424
|
+
*
|
|
4425
|
+
* On native a vertical ScrollView, FlatList or SectionList sets
|
|
4426
|
+
* `nestedScrollEnabled` unless inverted or you pass it, so it scrolls inside a scrolling
|
|
4427
|
+
* page on Android.
|
|
4424
4428
|
*/
|
|
4425
4429
|
export const ScrollView: any;
|
|
4426
4430
|
export const TextInput: any;
|
package/dist/linter.cjs
CHANGED
|
@@ -2012,7 +2012,14 @@ const MEMBER_CALL_RE = /(?<![\w$.])([\w$]+)\s*\.\s*([\w$]+)\s*\(/g;
|
|
|
2012
2012
|
|
|
2013
2013
|
/** date-fns formatter names and namespaces, and the locale objects it was given. */
|
|
2014
2014
|
function _dateFnsImports(strings) {
|
|
2015
|
-
const imports = {
|
|
2015
|
+
const imports = {
|
|
2016
|
+
formatters: new Map(),
|
|
2017
|
+
namespaces: new Set(),
|
|
2018
|
+
locales: new Set(),
|
|
2019
|
+
localeNamespaces: new Set(),
|
|
2020
|
+
defaultSetters: new Set(),
|
|
2021
|
+
defaultAppLocale: false,
|
|
2022
|
+
};
|
|
2016
2023
|
for (const [, ns, deflt, named, , subpath = ""] of strings.matchAll(DATE_FNS_IMPORT_RE)) {
|
|
2017
2024
|
if (subpath.startsWith("/locale")) {
|
|
2018
2025
|
if (ns) imports.localeNamespaces.add(ns);
|
|
@@ -2025,9 +2032,11 @@ function _dateFnsImports(strings) {
|
|
|
2025
2032
|
}
|
|
2026
2033
|
if (ns && !subpath) imports.namespaces.add(ns);
|
|
2027
2034
|
if (deflt && DATE_FNS_FORMATTERS.has(subpath.slice(1))) imports.formatters.set(deflt, DATE_FNS_FORMATTERS.get(subpath.slice(1)));
|
|
2035
|
+
if (deflt && subpath === "/setDefaultOptions") imports.defaultSetters.add(deflt);
|
|
2028
2036
|
for (const spec of (named || "").split(",")) {
|
|
2029
2037
|
const [imported, local] = spec.trim().split(/\s+as\s+/);
|
|
2030
2038
|
if (DATE_FNS_FORMATTERS.has(imported)) imports.formatters.set(local || imported, DATE_FNS_FORMATTERS.get(imported));
|
|
2039
|
+
if (imported === "setDefaultOptions") imports.defaultSetters.add(local || imported);
|
|
2031
2040
|
}
|
|
2032
2041
|
}
|
|
2033
2042
|
return imports;
|
|
@@ -2051,12 +2060,16 @@ function _callArgs(code, openParen) {
|
|
|
2051
2060
|
|
|
2052
2061
|
const _stringLiteral = (text) => /^\s*(["'`])((?:(?!\1)[^$\\]){1,80})\1/.exec(text)?.[2] ?? null;
|
|
2053
2062
|
|
|
2054
|
-
/**
|
|
2063
|
+
/**
|
|
2064
|
+
* True when the options may carry a locale that is not one fixed date-fns locale:
|
|
2065
|
+
* named in them, in an object held elsewhere or spread in, or set by setDefaultOptions.
|
|
2066
|
+
*/
|
|
2055
2067
|
function _appLocaleOption(options, imports) {
|
|
2056
2068
|
const m = LOCALE_OPTION_RE.exec(options);
|
|
2057
|
-
if (
|
|
2058
|
-
|
|
2059
|
-
|
|
2069
|
+
if (m) return !m[1] || !(imports.locales.has(m[1]) || (imports.localeNamespaces.has(m[1]) && m[2]));
|
|
2070
|
+
const literal = options.trimStart();
|
|
2071
|
+
if (literal && (!literal.startsWith("{") || literal.includes("..."))) return true;
|
|
2072
|
+
return imports.defaultAppLocale;
|
|
2060
2073
|
}
|
|
2061
2074
|
|
|
2062
2075
|
/** A date-fns pattern that prints words without the app's locale, or a day and month not year-first. */
|
|
@@ -2102,6 +2115,20 @@ function _fixedDateFormatRules(source) {
|
|
|
2102
2115
|
const options = starts.length > patternArg + 1 ? code.slice(starts[patternArg + 1], end) : "";
|
|
2103
2116
|
if (pattern && _fixedDatePattern(pattern, _appLocaleOption(options, imports))) report(m.index, `pattern "${pattern}"`);
|
|
2104
2117
|
};
|
|
2118
|
+
const setsAppLocale = (m) => {
|
|
2119
|
+
const { starts, end } = _callArgs(code, m.index + m[0].length - 1);
|
|
2120
|
+
return _appLocaleOption(code.slice(starts[0], end), imports);
|
|
2121
|
+
};
|
|
2122
|
+
if (imports.defaultSetters.size > 0) {
|
|
2123
|
+
for (const m of code.matchAll(CALL_RE)) {
|
|
2124
|
+
if (imports.defaultSetters.has(m[1]) && setsAppLocale(m)) imports.defaultAppLocale = true;
|
|
2125
|
+
}
|
|
2126
|
+
}
|
|
2127
|
+
if (imports.namespaces.size > 0) {
|
|
2128
|
+
for (const m of code.matchAll(MEMBER_CALL_RE)) {
|
|
2129
|
+
if (imports.namespaces.has(m[1]) && m[2] === "setDefaultOptions" && setsAppLocale(m)) imports.defaultAppLocale = true;
|
|
2130
|
+
}
|
|
2131
|
+
}
|
|
2105
2132
|
if (imports.formatters.size > 0) {
|
|
2106
2133
|
for (const m of code.matchAll(CALL_RE)) {
|
|
2107
2134
|
if (imports.formatters.has(m[1])) checkCall(m, imports.formatters.get(m[1]));
|
package/dist/linter.js
CHANGED
|
@@ -2007,7 +2007,14 @@ const MEMBER_CALL_RE = /(?<![\w$.])([\w$]+)\s*\.\s*([\w$]+)\s*\(/g;
|
|
|
2007
2007
|
|
|
2008
2008
|
/** date-fns formatter names and namespaces, and the locale objects it was given. */
|
|
2009
2009
|
function _dateFnsImports(strings) {
|
|
2010
|
-
const imports = {
|
|
2010
|
+
const imports = {
|
|
2011
|
+
formatters: new Map(),
|
|
2012
|
+
namespaces: new Set(),
|
|
2013
|
+
locales: new Set(),
|
|
2014
|
+
localeNamespaces: new Set(),
|
|
2015
|
+
defaultSetters: new Set(),
|
|
2016
|
+
defaultAppLocale: false,
|
|
2017
|
+
};
|
|
2011
2018
|
for (const [, ns, deflt, named, , subpath = ""] of strings.matchAll(DATE_FNS_IMPORT_RE)) {
|
|
2012
2019
|
if (subpath.startsWith("/locale")) {
|
|
2013
2020
|
if (ns) imports.localeNamespaces.add(ns);
|
|
@@ -2020,9 +2027,11 @@ function _dateFnsImports(strings) {
|
|
|
2020
2027
|
}
|
|
2021
2028
|
if (ns && !subpath) imports.namespaces.add(ns);
|
|
2022
2029
|
if (deflt && DATE_FNS_FORMATTERS.has(subpath.slice(1))) imports.formatters.set(deflt, DATE_FNS_FORMATTERS.get(subpath.slice(1)));
|
|
2030
|
+
if (deflt && subpath === "/setDefaultOptions") imports.defaultSetters.add(deflt);
|
|
2023
2031
|
for (const spec of (named || "").split(",")) {
|
|
2024
2032
|
const [imported, local] = spec.trim().split(/\s+as\s+/);
|
|
2025
2033
|
if (DATE_FNS_FORMATTERS.has(imported)) imports.formatters.set(local || imported, DATE_FNS_FORMATTERS.get(imported));
|
|
2034
|
+
if (imported === "setDefaultOptions") imports.defaultSetters.add(local || imported);
|
|
2026
2035
|
}
|
|
2027
2036
|
}
|
|
2028
2037
|
return imports;
|
|
@@ -2046,12 +2055,16 @@ function _callArgs(code, openParen) {
|
|
|
2046
2055
|
|
|
2047
2056
|
const _stringLiteral = (text) => /^\s*(["'`])((?:(?!\1)[^$\\]){1,80})\1/.exec(text)?.[2] ?? null;
|
|
2048
2057
|
|
|
2049
|
-
/**
|
|
2058
|
+
/**
|
|
2059
|
+
* True when the options may carry a locale that is not one fixed date-fns locale:
|
|
2060
|
+
* named in them, in an object held elsewhere or spread in, or set by setDefaultOptions.
|
|
2061
|
+
*/
|
|
2050
2062
|
function _appLocaleOption(options, imports) {
|
|
2051
2063
|
const m = LOCALE_OPTION_RE.exec(options);
|
|
2052
|
-
if (
|
|
2053
|
-
|
|
2054
|
-
|
|
2064
|
+
if (m) return !m[1] || !(imports.locales.has(m[1]) || (imports.localeNamespaces.has(m[1]) && m[2]));
|
|
2065
|
+
const literal = options.trimStart();
|
|
2066
|
+
if (literal && (!literal.startsWith("{") || literal.includes("..."))) return true;
|
|
2067
|
+
return imports.defaultAppLocale;
|
|
2055
2068
|
}
|
|
2056
2069
|
|
|
2057
2070
|
/** A date-fns pattern that prints words without the app's locale, or a day and month not year-first. */
|
|
@@ -2097,6 +2110,20 @@ function _fixedDateFormatRules(source) {
|
|
|
2097
2110
|
const options = starts.length > patternArg + 1 ? code.slice(starts[patternArg + 1], end) : "";
|
|
2098
2111
|
if (pattern && _fixedDatePattern(pattern, _appLocaleOption(options, imports))) report(m.index, `pattern "${pattern}"`);
|
|
2099
2112
|
};
|
|
2113
|
+
const setsAppLocale = (m) => {
|
|
2114
|
+
const { starts, end } = _callArgs(code, m.index + m[0].length - 1);
|
|
2115
|
+
return _appLocaleOption(code.slice(starts[0], end), imports);
|
|
2116
|
+
};
|
|
2117
|
+
if (imports.defaultSetters.size > 0) {
|
|
2118
|
+
for (const m of code.matchAll(CALL_RE)) {
|
|
2119
|
+
if (imports.defaultSetters.has(m[1]) && setsAppLocale(m)) imports.defaultAppLocale = true;
|
|
2120
|
+
}
|
|
2121
|
+
}
|
|
2122
|
+
if (imports.namespaces.size > 0) {
|
|
2123
|
+
for (const m of code.matchAll(MEMBER_CALL_RE)) {
|
|
2124
|
+
if (imports.namespaces.has(m[1]) && m[2] === "setDefaultOptions" && setsAppLocale(m)) imports.defaultAppLocale = true;
|
|
2125
|
+
}
|
|
2126
|
+
}
|
|
2100
2127
|
if (imports.formatters.size > 0) {
|
|
2101
2128
|
for (const m of code.matchAll(CALL_RE)) {
|
|
2102
2129
|
if (imports.formatters.has(m[1])) checkCall(m, imports.formatters.get(m[1]));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Android gives a vertical drag to the outermost scroller unless the inner one
|
|
2
|
+
// takes part in nested scrolling, so a list inside a scrolling page never moves.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A scroller's props with nested scrolling on, unless horizontal, inverted or
|
|
6
|
+
* set by the author. Android flips an inverted list, so what it leaves over
|
|
7
|
+
* would scroll the page the wrong way.
|
|
8
|
+
*/
|
|
9
|
+
export function nestedScrollProps(props) {
|
|
10
|
+
if (props.horizontal || props.inverted || props.nestedScrollEnabled != null) return props;
|
|
11
|
+
return { ...props, nestedScrollEnabled: true };
|
|
12
|
+
}
|
|
@@ -10,14 +10,13 @@ export {
|
|
|
10
10
|
View,
|
|
11
11
|
Pressable,
|
|
12
12
|
Image,
|
|
13
|
-
ScrollView,
|
|
14
|
-
FlatList,
|
|
15
|
-
SectionList,
|
|
16
13
|
ActivityIndicator,
|
|
17
14
|
Switch,
|
|
18
15
|
StyleSheet,
|
|
19
16
|
Linking,
|
|
20
17
|
} from "react-native";
|
|
18
|
+
// sc-18689 — a vertical one nests inside the page on Android.
|
|
19
|
+
export { ScrollView, FlatList, SectionList } from "./scrollers.native.js";
|
|
21
20
|
// sc-9168 — bounded to the device font-scale cap; no web twin (no such setting).
|
|
22
21
|
export { Text, TextInput } from "./bounded-text.native.js";
|
|
23
22
|
|
package/dist/scroll-view.js
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
// scrollbar is hidden reads as cut off. Where the content overflows, the edge
|
|
4
4
|
// with more content fades out, and hovering shows previous / next arrows.
|
|
5
5
|
//
|
|
6
|
-
// Native
|
|
7
|
-
//
|
|
8
|
-
//
|
|
6
|
+
// Native draws no affordance (./scrollers.native.js): a swipe is the native
|
|
7
|
+
// one. Scrolling is the same capability on both hosts; only the input differs.
|
|
8
|
+
// Touch screens on the web are left unchanged.
|
|
9
9
|
|
|
10
10
|
import React from "react";
|
|
11
11
|
import { useHostTheme, useSdkText } from "./hooks.js";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// sc-18689: the native scrollers. No web twin: a browser nests scrolling itself.
|
|
2
|
+
import React from "react";
|
|
3
|
+
import {
|
|
4
|
+
ScrollView as RNScrollView,
|
|
5
|
+
FlatList as RNFlatList,
|
|
6
|
+
SectionList as RNSectionList,
|
|
7
|
+
} from "react-native";
|
|
8
|
+
import { nestedScrollProps } from "./nested-scroll-props.js";
|
|
9
|
+
|
|
10
|
+
function nested(Base, name) {
|
|
11
|
+
const Scroller = React.forwardRef((props, ref) =>
|
|
12
|
+
React.createElement(Base, { ...nestedScrollProps(props), ref }),
|
|
13
|
+
);
|
|
14
|
+
Scroller.displayName = name;
|
|
15
|
+
return Scroller;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const ScrollView = nested(RNScrollView, "ScrollView");
|
|
19
|
+
export const FlatList = nested(RNFlatList, "FlatList");
|
|
20
|
+
export const SectionList = nested(RNSectionList, "SectionList");
|
package/package.json
CHANGED
package/src/contract.js
CHANGED
|
@@ -3633,7 +3633,7 @@ const PRIMITIVES = [
|
|
|
3633
3633
|
{
|
|
3634
3634
|
name: "ScrollView",
|
|
3635
3635
|
description:
|
|
3636
|
-
"Scrollable container. Pass `horizontal` to scroll on the x-axis. On the web, a horizontal row whose content overflows shows mouse users that it scrolls: the edge with more content fades, and hovering shows previous / next arrows that scroll about one view width. Touch screens and the exported app swipe as before, and a row that fits shows nothing. Pass `showsScrollAffordance={false}` only when the widget draws its own arrows. A short set of chips is better wrapped in a `<ChipGroup>` than scrolled. See https://reactnative.dev/docs/scrollview.",
|
|
3636
|
+
"Scrollable container. Pass `horizontal` to scroll on the x-axis. On the web, a horizontal row whose content overflows shows mouse users that it scrolls: the edge with more content fades, and hovering shows previous / next arrows that scroll about one view width. Touch screens and the exported app swipe as before, and a row that fits shows nothing. Pass `showsScrollAffordance={false}` only when the widget draws its own arrows. A short set of chips is better wrapped in a `<ChipGroup>` than scrolled. A vertical `ScrollView`, `FlatList` or `SectionList` from this SDK scrolls inside a scrolling page on Android too: it sets `nestedScrollEnabled` unless it is `inverted` or you pass `false`. One imported from `react-native` does not. See https://reactnative.dev/docs/scrollview.",
|
|
3637
3637
|
rnComponent: "ScrollView",
|
|
3638
3638
|
docsUrl: "https://reactnative.dev/docs/scrollview",
|
|
3639
3639
|
},
|
|
@@ -4994,7 +4994,7 @@ const VETTED_IMPORTS = [
|
|
|
4994
4994
|
platforms: ["web", "native"],
|
|
4995
4995
|
category: "primitive",
|
|
4996
4996
|
description:
|
|
4997
|
-
"Direct RN imports for APIs the SDK hasn't re-exported yet. On web `react-native` is host-resolved to the host's single react-native-web instance (external, shimmed) — NOT aliased at bundle time — so a bundled widget shares the host's RN-web (one StyleSheet/context, no double-instance conflicts). On native Metro resolves the real library.",
|
|
4997
|
+
"Direct RN imports for APIs the SDK hasn't re-exported yet. Take `ScrollView`, `FlatList` and `SectionList` from the SDK: React Native's own do not scroll inside a scrolling page on Android unless you pass `nestedScrollEnabled`. On web `react-native` is host-resolved to the host's single react-native-web instance (external, shimmed) — NOT aliased at bundle time — so a bundled widget shares the host's RN-web (one StyleSheet/context, no double-instance conflicts). On native Metro resolves the real library.",
|
|
4998
4998
|
},
|
|
4999
4999
|
{
|
|
5000
5000
|
specifier: "axios",
|
|
@@ -5141,7 +5141,7 @@ const VETTED_IMPORTS = [
|
|
|
5141
5141
|
platforms: ["web", "native"],
|
|
5142
5142
|
category: "list",
|
|
5143
5143
|
description:
|
|
5144
|
-
"High-performance virtualised list with a FlatList-compatible API. Prefer it over FlatList for long datasets; renders on both platforms.",
|
|
5144
|
+
"High-performance virtualised list with a FlatList-compatible API. Prefer it over FlatList for long datasets; renders on both platforms. Pass `nestedScrollEnabled`, or a vertical one does not scroll inside a scrolling page on Android.",
|
|
5145
5145
|
},
|
|
5146
5146
|
{
|
|
5147
5147
|
specifier: "react-native-paper",
|
|
@@ -7195,7 +7195,9 @@ const CONTRACT = deepFreeze({
|
|
|
7195
7195
|
// 1.290.0: stricter lint (sc-17804) — the app's button colours paint the
|
|
7196
7196
|
// primary `<Button>` only, and a literal `variant` the button does not
|
|
7197
7197
|
// draw is the publish-blocking `button-unknown-variant` finding.
|
|
7198
|
-
|
|
7198
|
+
// 1.291.0: behaviour (sc-18689) — a vertical native `ScrollView`, `FlatList`
|
|
7199
|
+
// or `SectionList` sets `nestedScrollEnabled` unless inverted or the author sets it.
|
|
7200
|
+
version: "1.291.0",
|
|
7199
7201
|
sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
|
|
7200
7202
|
hooks: HOOKS,
|
|
7201
7203
|
primitives: PRIMITIVES,
|