@expo/ui 58.0.4 → 58.0.6
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 +21 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/ui/HostView.kt +6 -4
- package/android/src/main/java/expo/modules/ui/ModifierRegistry.kt +11 -0
- package/build/jetpack-compose/colors.js +20 -1
- package/build/jetpack-compose/colors.js.map +1 -1
- package/build/jetpack-compose/modifiers/index.d.ts +10 -0
- package/build/jetpack-compose/modifiers/index.js +11 -0
- package/build/jetpack-compose/modifiers/index.js.map +1 -1
- package/build/swift-ui/List/DataListForEach.d.ts +59 -0
- package/build/swift-ui/List/DataListForEach.js +137 -0
- package/build/swift-ui/List/DataListForEach.js.map +1 -0
- package/build/swift-ui/List/ListForEach.d.ts +15 -4
- package/build/swift-ui/List/ListForEach.js +40 -3
- package/build/swift-ui/List/ListForEach.js.map +1 -1
- package/build/swift-ui/List/index.d.ts +1 -1
- package/build/swift-ui/List/index.js.map +1 -1
- package/build/swift-ui/List/window.d.ts +5 -0
- package/build/swift-ui/List/window.js +28 -0
- package/build/swift-ui/List/window.js.map +1 -0
- package/build/swift-ui/modifiers/index.d.ts +16 -7
- package/build/swift-ui/modifiers/index.js +10 -5
- package/build/swift-ui/modifiers/index.js.map +1 -1
- package/expo-module.config.json +1 -1
- package/ios/DataListForEachView.swift +255 -0
- package/ios/ExpoUIModule.swift +3 -0
- package/ios/HostView.swift +29 -7
- package/ios/ListForEachView.swift +12 -3
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.4/expo.modules.ui-58.0.4-sources.jar → 58.0.6/expo.modules.ui-58.0.6-sources.jar} +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.6/expo.modules.ui-58.0.6-sources.jar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.6/expo.modules.ui-58.0.6-sources.jar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.6/expo.modules.ui-58.0.6-sources.jar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.6/expo.modules.ui-58.0.6-sources.jar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.6/expo.modules.ui-58.0.6.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.6/expo.modules.ui-58.0.6.aar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.6/expo.modules.ui-58.0.6.aar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.6/expo.modules.ui-58.0.6.aar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.6/expo.modules.ui-58.0.6.aar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.4/expo.modules.ui-58.0.4.module → 58.0.6/expo.modules.ui-58.0.6.module} +22 -22
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.6/expo.modules.ui-58.0.6.module.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.6/expo.modules.ui-58.0.6.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.6/expo.modules.ui-58.0.6.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.6/expo.modules.ui-58.0.6.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.4/expo.modules.ui-58.0.4.pom → 58.0.6/expo.modules.ui-58.0.6.pom} +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.6/expo.modules.ui-58.0.6.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.6/expo.modules.ui-58.0.6.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.6/expo.modules.ui-58.0.6.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.6/expo.modules.ui-58.0.6.pom.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml +4 -4
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.md5 +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha1 +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha256 +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha512 +1 -1
- package/package.json +2 -2
- package/prebuilds/output/debug/xcframeworks/ExpoUI.tar.gz +0 -0
- package/prebuilds/output/release/xcframeworks/ExpoUI.tar.gz +0 -0
- package/src/jetpack-compose/colors.ts +23 -1
- package/src/jetpack-compose/modifiers/index.ts +11 -0
- package/src/swift-ui/List/DataListForEach.tsx +249 -0
- package/src/swift-ui/List/ListForEach.tsx +56 -6
- package/src/swift-ui/List/index.tsx +1 -1
- package/src/swift-ui/List/window.ts +28 -0
- package/src/swift-ui/modifiers/index.ts +50 -14
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.4/expo.modules.ui-58.0.4-sources.jar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.4/expo.modules.ui-58.0.4-sources.jar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.4/expo.modules.ui-58.0.4-sources.jar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.4/expo.modules.ui-58.0.4-sources.jar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.4/expo.modules.ui-58.0.4.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.4/expo.modules.ui-58.0.4.aar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.4/expo.modules.ui-58.0.4.aar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.4/expo.modules.ui-58.0.4.aar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.4/expo.modules.ui-58.0.4.aar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.4/expo.modules.ui-58.0.4.module.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.4/expo.modules.ui-58.0.4.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.4/expo.modules.ui-58.0.4.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.4/expo.modules.ui-58.0.4.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.4/expo.modules.ui-58.0.4.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.4/expo.modules.ui-58.0.4.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.4/expo.modules.ui-58.0.4.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.4/expo.modules.ui-58.0.4.pom.sha512 +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,27 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 58.0.6 — 2026-09-23
|
|
14
|
+
|
|
15
|
+
### 🛠 Breaking changes
|
|
16
|
+
|
|
17
|
+
- [iOS] `frame()` now matches SwiftUI's two `frame` overloads, so one call accepts either `width`/`height` or `min*`/`ideal*`/`max*`, not both. ([#50537](https://github.com/expo/expo/issues/50537) by [@wwisheess](https://github.com/wwisheess), [#50544](https://github.com/expo/expo/pull/50544) by [@intergalacticspacehighway](https://github.com/intergalacticspacehighway))
|
|
18
|
+
|
|
19
|
+
### 🎉 New features
|
|
20
|
+
|
|
21
|
+
- [iOS] `List.ForEach` recycles rows from a small pool around the visible range, so large lists only render the rows near the viewport. Deprecated element children in favor of this form. ([#49975](https://github.com/expo/expo/pull/49975) by [@nishan](https://github.com/intergalacticspacehighway))
|
|
22
|
+
|
|
23
|
+
## 58.0.5 — 2026-09-22
|
|
24
|
+
|
|
25
|
+
### 🎉 New features
|
|
26
|
+
|
|
27
|
+
- [Android] Added the widget-only `cornerRadius` modifier to `jetpack-compose`. ([#50332](https://github.com/expo/expo/pull/50332) by [@jakex7](https://github.com/jakex7))
|
|
28
|
+
|
|
29
|
+
### 🐛 Bug fixes
|
|
30
|
+
|
|
31
|
+
- [iOS] Fixed `<Host matchContents>` centering its content, and so shifting it by half the height change for a frame, whenever the hosted view was not yet the size of its SwiftUI content. ([#50496](https://github.com/expo/expo/pull/50496) by [@expo-bot](https://github.com/expo-bot))
|
|
32
|
+
- [Android] Cache Material 3 palettes generated from an explicit `scheme` and `seedColor`, so `getMaterialColors` and `useMaterialColors` stop calling the synchronous native module on every render, and `Host` stops re-solving the same scheme on every recomposition. ([#50494](https://github.com/expo/expo/pull/50494) by [@expo-bot](https://github.com/expo-bot))
|
|
33
|
+
|
|
13
34
|
## 58.0.4 — 2026-09-21
|
|
14
35
|
|
|
15
36
|
### 🎉 New features
|
package/android/build.gradle
CHANGED
|
@@ -12,13 +12,13 @@ apply plugin: 'expo-module-gradle-plugin'
|
|
|
12
12
|
apply plugin: 'org.jetbrains.kotlin.plugin.compose'
|
|
13
13
|
|
|
14
14
|
group = 'expo.modules.ui'
|
|
15
|
-
version = '58.0.
|
|
15
|
+
version = '58.0.6'
|
|
16
16
|
|
|
17
17
|
android {
|
|
18
18
|
namespace "expo.modules.ui"
|
|
19
19
|
defaultConfig {
|
|
20
20
|
versionCode 1
|
|
21
|
-
versionName "58.0.
|
|
21
|
+
versionName "58.0.6"
|
|
22
22
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
23
23
|
}
|
|
24
24
|
buildFeatures {
|
|
@@ -24,6 +24,7 @@ import androidx.compose.runtime.Composable
|
|
|
24
24
|
import androidx.compose.runtime.CompositionLocalProvider
|
|
25
25
|
import androidx.compose.runtime.MutableState
|
|
26
26
|
import androidx.compose.runtime.mutableStateOf
|
|
27
|
+
import androidx.compose.runtime.remember
|
|
27
28
|
import androidx.compose.ui.Modifier
|
|
28
29
|
import androidx.compose.ui.graphics.toArgb
|
|
29
30
|
import androidx.compose.ui.layout.Layout
|
|
@@ -112,11 +113,12 @@ internal class HostView(context: Context, appContext: AppContext) :
|
|
|
112
113
|
null -> isSystemInDarkTheme()
|
|
113
114
|
}
|
|
114
115
|
val seedArgb = props.seedColor.value?.composeOrNull?.toArgb()
|
|
115
|
-
val
|
|
116
|
-
seedArgb
|
|
117
|
-
else -> props.colorScheme.value?.toColorScheme(context)
|
|
118
|
-
?: ExpoColorScheme.defaultColorScheme(context, isSystemInDarkTheme())
|
|
116
|
+
val seededScheme = remember(seedArgb, isDark) {
|
|
117
|
+
seedArgb?.let { seedColorScheme(it, isDark) }
|
|
119
118
|
}
|
|
119
|
+
val colorScheme = seededScheme
|
|
120
|
+
?: props.colorScheme.value?.toColorScheme(context)
|
|
121
|
+
?: ExpoColorScheme.defaultColorScheme(context, isSystemInDarkTheme())
|
|
120
122
|
val layoutDirection = props.layoutDirection.value.toLayoutDirection()
|
|
121
123
|
|
|
122
124
|
// Material3's `MaterialTheme` does not provide `LocalContentColor` — only `Surface` does — so
|
|
@@ -216,6 +216,11 @@ internal data class BlurParams(
|
|
|
216
216
|
@Field val radius: Int = 0
|
|
217
217
|
) : Record
|
|
218
218
|
|
|
219
|
+
@OptimizedRecord
|
|
220
|
+
data class CornerRadiusParams(
|
|
221
|
+
@Field val radius: Int = 0
|
|
222
|
+
) : Record
|
|
223
|
+
|
|
219
224
|
@OptimizedRecord
|
|
220
225
|
internal data class RotateParams(
|
|
221
226
|
@Field val degrees: Float = 0f
|
|
@@ -572,6 +577,12 @@ object ModifierRegistry {
|
|
|
572
577
|
Modifier.blur(params.radius.dp)
|
|
573
578
|
}
|
|
574
579
|
|
|
580
|
+
// Glance-only modifier: Jetpack Compose has no equivalent, so it is a no-op here.
|
|
581
|
+
// `expo-widgets` applies it to Android widgets.
|
|
582
|
+
register("cornerRadius") { _, _, _, _ ->
|
|
583
|
+
Modifier
|
|
584
|
+
}
|
|
585
|
+
|
|
575
586
|
// Transform modifiers
|
|
576
587
|
register("rotate") { map, _, appContext, _ ->
|
|
577
588
|
val params = recordFromMap<RotateParams>(map, appContext)
|
|
@@ -11,10 +11,29 @@ import { ExpoUIModule } from './ExpoUIModule';
|
|
|
11
11
|
* React context to cache the palette within a Host subtree.
|
|
12
12
|
* @hidden
|
|
13
13
|
*/ export const HostPaletteContext = createContext(null);
|
|
14
|
+
// Cache the `scheme` + `seedColor` keyed palette to prevent sync calls to `getMaterialColors`.
|
|
15
|
+
// https://github.com/expo/expo/issues/50477
|
|
16
|
+
const seededPalettes = new Map();
|
|
17
|
+
const MAX_SEEDED_PALETTES = 32;
|
|
14
18
|
/**
|
|
15
19
|
* Get the Material 3 color palette.
|
|
16
20
|
*/ export function getMaterialColors(options) {
|
|
17
|
-
|
|
21
|
+
const scheme = options?.scheme;
|
|
22
|
+
const seedColor = options?.seedColor;
|
|
23
|
+
const isCacheable = (scheme === 'light' || scheme === 'dark') && (typeof seedColor === 'string' || typeof seedColor === 'number');
|
|
24
|
+
if (!isCacheable) {
|
|
25
|
+
return ExpoUIModule.getMaterialColors(options ?? null);
|
|
26
|
+
}
|
|
27
|
+
const key = `${scheme}:${seedColor}`;
|
|
28
|
+
let palette = seededPalettes.get(key);
|
|
29
|
+
if (!palette) {
|
|
30
|
+
palette = ExpoUIModule.getMaterialColors(options);
|
|
31
|
+
if (seededPalettes.size >= MAX_SEEDED_PALETTES) {
|
|
32
|
+
seededPalettes.delete(seededPalettes.keys().next().value);
|
|
33
|
+
}
|
|
34
|
+
seededPalettes.set(key, palette);
|
|
35
|
+
}
|
|
36
|
+
return palette;
|
|
18
37
|
}
|
|
19
38
|
/**
|
|
20
39
|
* Returns the Material 3 color palette.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["jetpack-compose/colors.ts"],"sourcesContent":[null],"names":["createContext","useContext","useColorScheme","useRNColorScheme","ExpoUIModule","isDynamicColorAvailable","HostPaletteContext","getMaterialColors","options","
|
|
1
|
+
{"version":3,"sources":["jetpack-compose/colors.ts"],"sourcesContent":[null],"names":["createContext","useContext","useColorScheme","useRNColorScheme","ExpoUIModule","isDynamicColorAvailable","HostPaletteContext","seededPalettes","Map","MAX_SEEDED_PALETTES","getMaterialColors","options","scheme","seedColor","isCacheable","key","palette","get","size","delete","keys","next","value","set","useMaterialColors","hostPalette","systemScheme","colorScheme","resolvedScheme"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,QAAQ;AAClD,SAGEC,kBAAkBC,gBAAgB,QAC7B,eAAe;AAEtB,SAASC,YAAY,QAAQ,iBAAiB;AAoK9C;;;;;CAKC,GACD,OAAO,MAAMC,0BAAmCD,aAAaC,uBAAuB,IAAI,MAAM;AAE9F;;;CAGC,GACD,OAAO,MAAMC,qBAAqBN,cAAqC,MAAM;AAE7E,+FAA+F;AAC/F,4CAA4C;AAC5C,MAAMO,iBAAiB,IAAIC;AAC3B,MAAMC,sBAAsB;AAE5B;;CAEC,GACD,OAAO,SAASC,kBAAkBC,OAA+B;IAC/D,MAAMC,SAASD,SAASC;IACxB,MAAMC,YAAYF,SAASE;IAC3B,MAAMC,cACJ,AAACF,CAAAA,WAAW,WAAWA,WAAW,MAAK,KACtC,CAAA,OAAOC,cAAc,YAAY,OAAOA,cAAc,QAAO;IAChE,IAAI,CAACC,aAAa;QAChB,OAAOV,aAAaM,iBAAiB,CAACC,WAAW;IACnD;IACA,MAAMI,MAAM,GAAGH,OAAO,CAAC,EAAEC,WAAW;IACpC,IAAIG,UAAUT,eAAeU,GAAG,CAACF;IACjC,IAAI,CAACC,SAAS;QACZA,UAAUZ,aAAaM,iBAAiB,CAACC;QACzC,IAAIJ,eAAeW,IAAI,IAAIT,qBAAqB;YAC9CF,eAAeY,MAAM,CAACZ,eAAea,IAAI,GAAGC,IAAI,GAAGC,KAAK;QAC1D;QACAf,eAAegB,GAAG,CAACR,KAAKC;IAC1B;IACA,OAAOA;AACT;AAEA;;;;CAIC,GACD,OAAO,SAASQ,kBAAkBb,OAAkC;IAClE,MAAMc,cAAcxB,WAAWK;IAC/B,MAAMoB,eAAevB;IACrB,IAAIQ,WAAW,QAAQc,eAAe,MAAM;QAC1C,sDAAsD;QACtD,OAAOA;IACT;IACA,sEAAsE;IACtE,MAAM,EAAEE,WAAW,EAAEd,SAAS,EAAE,GAAGF,WAAW,CAAC;IAC/C,MAAMiB,iBACJD,gBAAgB,WAAWA,gBAAgB,SACvCA,cACAD,iBAAiB,SACf,SACA;IACR,OAAOhB,kBAAkB;QAAEE,QAAQgB;QAAgBf;IAAU;AAC/D"}
|
|
@@ -141,6 +141,16 @@ export declare const alpha: (alpha: number) => import("./createModifier").Modifi
|
|
|
141
141
|
* @param radius - Blur radius in dp.
|
|
142
142
|
*/
|
|
143
143
|
export declare const blur: (radius: number) => import("./createModifier").ModifierConfig;
|
|
144
|
+
/**
|
|
145
|
+
* Adds rounded corners to the component.
|
|
146
|
+
*
|
|
147
|
+
* > **Note:** Works only inside Android widgets built with `expo-widgets`, on Android 12 (API level 31) and later.
|
|
148
|
+
*
|
|
149
|
+
* Jetpack Compose has no exact equivalent of Glance's `cornerRadius`, so Expo UI ignores this
|
|
150
|
+
* modifier. Use `clip(Shapes.RoundedCorner(radius))` to round corners in an app.
|
|
151
|
+
* @param radius - Corner radius in dp.
|
|
152
|
+
*/
|
|
153
|
+
export declare const cornerRadius: (radius: number) => import("./createModifier").ModifierConfig;
|
|
144
154
|
/**
|
|
145
155
|
* Rotates the view.
|
|
146
156
|
* @param degrees - Rotation angle in degrees.
|
|
@@ -153,6 +153,17 @@ export { animated, spring, tween, snap, keyframes } from './animation';
|
|
|
153
153
|
*/ export const blur = (radius)=>createModifier('blur', {
|
|
154
154
|
radius
|
|
155
155
|
});
|
|
156
|
+
/**
|
|
157
|
+
* Adds rounded corners to the component.
|
|
158
|
+
*
|
|
159
|
+
* > **Note:** Works only inside Android widgets built with `expo-widgets`, on Android 12 (API level 31) and later.
|
|
160
|
+
*
|
|
161
|
+
* Jetpack Compose has no exact equivalent of Glance's `cornerRadius`, so Expo UI ignores this
|
|
162
|
+
* modifier. Use `clip(Shapes.RoundedCorner(radius))` to round corners in an app.
|
|
163
|
+
* @param radius - Corner radius in dp.
|
|
164
|
+
*/ export const cornerRadius = (radius)=>createModifier('cornerRadius', {
|
|
165
|
+
radius
|
|
166
|
+
});
|
|
156
167
|
// =============================================================================
|
|
157
168
|
// Transform Modifiers
|
|
158
169
|
// =============================================================================
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["jetpack-compose/modifiers/index.ts"],"sourcesContent":[null],"names":["createModifier","createModifierWithEventListener","animated","spring","tween","snap","keyframes","paddingAll","all","padding","start","top","end","bottom","size","width","height","fillMaxSize","fraction","fillMaxWidth","fillMaxHeight","value","defaultMinSize","options","wrapContentWidth","alignment","wrapContentHeight","imePadding","offset","x","y","background","color","animationSpec","border","borderWidth","borderColor","shadow","elevation","dropShadow","shape","config","innerShadow","alpha","blur","radius","rotate","degrees","graphicsLayer","params","zIndex","index","animateContentSize","dampingRatio","stiffness","weight","align","matchParentSize","menuAnchor","type","enabled","clickable","handler","indication","combinedClickable","handlers","event","onClick","onLongClick","selectable","selected","role","selectableGroup","toggleable","onVisibilityChanged","isVisible","minDurationMs","minFractionVisible","onSizeChanged","onGloballyPositioned","layout","testID","tag","semantics","material","name","Shapes","Rectangle","Circle","RoundedCorner","CutCorner","Material","Cookie4Sided","Cookie6Sided","Cookie7Sided","Cookie9Sided","Cookie12Sided","Clover4Leaf","Clover8Leaf","SoftBurst","Boom","Oval","Pill","Triangle","Diamond","Pentagon","Sunny","VerySunny","Fan","PixelCircle","PixelTriangle","Ghostish","Bun","Heart","Arch","Slanted","Puffy","PuffyDiamond","clip","maskClip","verticalScroll","horizontalScroll","createViewModifierEventListener"],"mappings":"AAGA,SAASA,cAAc,EAAEC,+BAA+B,QAAQ,mBAAmB;AAEnF,SACEC,QAAQ,EACRC,MAAM,EACNC,KAAK,EACLC,IAAI,EACJC,SAAS,QAGJ,cAAc;AAsBrB;;;CAGC,GACD,OAAO,MAAMC,aAAa,CAACC,MAAgBR,eAAe,cAAc;QAAEQ;IAAI,GAAG;AAEjF;;;;;;CAMC,GACD,OAAO,MAAMC,UAAU,CAACC,OAAeC,KAAaC,KAAaC,SAC/Db,eAAe,WAAW;QAAEU;QAAOC;QAAKC;QAAKC;IAAO,GAAG;AAEzD,gFAAgF;AAChF,iBAAiB;AACjB,gFAAgF;AAEhF;;;;CAIC,GACD,OAAO,MAAMC,OAAO,CAACC,OAAeC,SAAmBhB,eAAe,QAAQ;QAAEe;QAAOC;IAAO,GAAG;AAEjG;;;CAGC,GACD,OAAO,MAAMC,cAAc,CAACC,WAAsBlB,eAAe,eAAe;QAAEkB;IAAS,GAAG;AAE9F;;;CAGC,GACD,OAAO,MAAMC,eAAe,CAACD,WAAsBlB,eAAe,gBAAgB;QAAEkB;IAAS,GAAG;AAEhG;;;CAGC,GACD,OAAO,MAAME,gBAAgB,CAACF,WAAsBlB,eAAe,iBAAiB;QAAEkB;IAAS,GAAG;AAElG;;;CAGC,GACD,OAAO,MAAMH,QAAQ,CAACM,QAAkBrB,eAAe,SAAS;QAAEe,OAAOM;IAAM,GAAG;AAElF;;;CAGC,GACD,OAAO,MAAML,SAAS,CAACK,QAAkBrB,eAAe,UAAU;QAAEgB,QAAQK;IAAM,GAAG;AAErF;;;;;;;CAOC,GACD,OAAO,MAAMC,iBAAiB,CAACC,UAC7BvB,eAAe,kBAAkBuB,SAAS;AAE5C;;;CAGC,GACD,OAAO,MAAMC,mBAAmB,CAACC,YAC/BzB,eAAe,oBAAoByB,YAAY;QAAEA;IAAU,IAAI,CAAC,GAAG;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AO,
|
|
1
|
+
{"version":3,"sources":["jetpack-compose/modifiers/index.ts"],"sourcesContent":[null],"names":["createModifier","createModifierWithEventListener","animated","spring","tween","snap","keyframes","paddingAll","all","padding","start","top","end","bottom","size","width","height","fillMaxSize","fraction","fillMaxWidth","fillMaxHeight","value","defaultMinSize","options","wrapContentWidth","alignment","wrapContentHeight","imePadding","offset","x","y","background","color","animationSpec","border","borderWidth","borderColor","shadow","elevation","dropShadow","shape","config","innerShadow","alpha","blur","radius","cornerRadius","rotate","degrees","graphicsLayer","params","zIndex","index","animateContentSize","dampingRatio","stiffness","weight","align","matchParentSize","menuAnchor","type","enabled","clickable","handler","indication","combinedClickable","handlers","event","onClick","onLongClick","selectable","selected","role","selectableGroup","toggleable","onVisibilityChanged","isVisible","minDurationMs","minFractionVisible","onSizeChanged","onGloballyPositioned","layout","testID","tag","semantics","material","name","Shapes","Rectangle","Circle","RoundedCorner","CutCorner","Material","Cookie4Sided","Cookie6Sided","Cookie7Sided","Cookie9Sided","Cookie12Sided","Clover4Leaf","Clover8Leaf","SoftBurst","Boom","Oval","Pill","Triangle","Diamond","Pentagon","Sunny","VerySunny","Fan","PixelCircle","PixelTriangle","Ghostish","Bun","Heart","Arch","Slanted","Puffy","PuffyDiamond","clip","maskClip","verticalScroll","horizontalScroll","createViewModifierEventListener"],"mappings":"AAGA,SAASA,cAAc,EAAEC,+BAA+B,QAAQ,mBAAmB;AAEnF,SACEC,QAAQ,EACRC,MAAM,EACNC,KAAK,EACLC,IAAI,EACJC,SAAS,QAGJ,cAAc;AAsBrB;;;CAGC,GACD,OAAO,MAAMC,aAAa,CAACC,MAAgBR,eAAe,cAAc;QAAEQ;IAAI,GAAG;AAEjF;;;;;;CAMC,GACD,OAAO,MAAMC,UAAU,CAACC,OAAeC,KAAaC,KAAaC,SAC/Db,eAAe,WAAW;QAAEU;QAAOC;QAAKC;QAAKC;IAAO,GAAG;AAEzD,gFAAgF;AAChF,iBAAiB;AACjB,gFAAgF;AAEhF;;;;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,aAAab,SAAS;QACtBc,aAAad,SAAS;QACtBe,WAAWf,SAAS;QACpBgB,MAAMhB,SAAS;QACfiB,MAAMjB,SAAS;QACfkB,MAAMlB,SAAS;QACfmB,UAAUnB,SAAS;QACnBoB,SAASpB,SAAS;QAClBqB,UAAUrB,SAAS;QACnBsB,OAAOtB,SAAS;QAChBuB,WAAWvB,SAAS;QACpBwB,KAAKxB,SAAS;QACdyB,aAAazB,SAAS;QACtB0B,eAAe1B,SAAS;QACxB2B,UAAU3B,SAAS;QACnB4B,KAAK5B,SAAS;QACd6B,OAAO7B,SAAS;QAChB8B,MAAM9B,SAAS;QACf+B,SAAS/B,SAAS;QAClBgC,OAAOhC,SAAS;QAChBiC,cAAcjC,SAAS;IACzB;AACF,EAAE;AAEF;;;CAGC,GACD,OAAO,MAAMkC,OAAO,CAAC/E,QAAwBxC,eAAe,QAAQ;QAAEwC;IAAM,GAAG;AAE/E;;;;;;;;;;;;;;CAcC,GACD,OAAO,MAAMgF,WAAW,CAAChF,QAAwBxC,eAAe,YAAY;QAAEwC;IAAM,GAAG;AAEvF,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAEhF;;;;CAIC,GACD,OAAO,MAAMiF,iBAAiB,IAAMzH,eAAe,kBAAkB;AAErE;;;;CAIC,GACD,OAAO,MAAM0H,mBAAmB,IAAM1H,eAAe,oBAAoB;AAEzE,SAASA,cAAc,EAAEC,+BAA+B,QAAQ,mBAAmB;AACnF,SAAS0H,+BAA+B,QAAQ,UAAU"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
|
+
import { type CommonViewModifierProps } from '../types';
|
|
3
|
+
export interface ListForEachProps<ItemT> extends CommonViewModifierProps {
|
|
4
|
+
/** Called with deleted indices from this group's `data` array. */
|
|
5
|
+
onDelete?: (indices: number[]) => void;
|
|
6
|
+
/**
|
|
7
|
+
* Called with the source indices and the destination index. The destination index counts
|
|
8
|
+
* positions before the moved items are removed, so it can equal `data.length`.
|
|
9
|
+
*/
|
|
10
|
+
onMove?: (sourceIndices: number[], destination: number) => void;
|
|
11
|
+
/** Items to display. Replace the array when updating data. */
|
|
12
|
+
data: readonly ItemT[];
|
|
13
|
+
/** Returns a stable, unique string key, also used for `List` selection. */
|
|
14
|
+
keyExtractor: (item: ItemT, index: number) => string;
|
|
15
|
+
/**
|
|
16
|
+
* Renders a row. When `recycling` is `true`, wrap it in `useCallback`, or every row
|
|
17
|
+
* re-renders on each parent render.
|
|
18
|
+
* Recycled rows are reused for other items, so their local state (`useState`) carries over.
|
|
19
|
+
* Reset it when the item changes, or keep the state outside the row.
|
|
20
|
+
*/
|
|
21
|
+
children: (info: {
|
|
22
|
+
item: ItemT;
|
|
23
|
+
index: number;
|
|
24
|
+
}) => ReactElement;
|
|
25
|
+
/**
|
|
26
|
+
* Renders only the rows near the visible range and reuses them while scrolling. Set to `false` to
|
|
27
|
+
* render every row at once. Set it once; changing it remounts the rows.
|
|
28
|
+
* @default true
|
|
29
|
+
*/
|
|
30
|
+
recycling?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Extra rows to prepare on each side of the visible rows. Must be a non-negative integer.
|
|
33
|
+
* Ignored when `recycling` is `false`.
|
|
34
|
+
* @default 10
|
|
35
|
+
*/
|
|
36
|
+
overscanCount?: number;
|
|
37
|
+
/**
|
|
38
|
+
* Placeholder height in points, excluding `List` insets, until a row is measured.
|
|
39
|
+
* Must be positive. Measurements reset when `data` or width changes.
|
|
40
|
+
* Ignored when `recycling` is `false`.
|
|
41
|
+
* @default 64
|
|
42
|
+
*/
|
|
43
|
+
estimatedItemSize?: number;
|
|
44
|
+
}
|
|
45
|
+
type SlotProps = {
|
|
46
|
+
itemKey: string;
|
|
47
|
+
index: number;
|
|
48
|
+
revision: number;
|
|
49
|
+
children: ReactElement;
|
|
50
|
+
};
|
|
51
|
+
export declare const NativeSlot: import("react").ComponentType<SlotProps>;
|
|
52
|
+
export declare function useItemKeys<ItemT>(data: readonly ItemT[], keyExtractor: ListForEachProps<ItemT>['keyExtractor']): string[];
|
|
53
|
+
/**
|
|
54
|
+
* Renders a window of recycled rows inside List or Section.
|
|
55
|
+
* Rows show placeholders while JS prepares content. Native keys still cover the full data set.
|
|
56
|
+
* @platform ios
|
|
57
|
+
*/
|
|
58
|
+
export declare function DataListForEach<ItemT>({ data, keyExtractor, children: renderItem, overscanCount, estimatedItemSize, modifiers, onDelete, onMove, ...props }: ListForEachProps<ItemT>): import("react").JSX.Element;
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { requireNativeView } from 'expo';
|
|
3
|
+
import { memo, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
4
|
+
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
5
|
+
import { getSlotIndices, getWindow } from './window';
|
|
6
|
+
const NativeList = requireNativeView('ExpoUI', 'DataListForEachView');
|
|
7
|
+
export const NativeSlot = requireNativeView('ExpoUI', 'DataListForEachItemView');
|
|
8
|
+
const NativePool = requireNativeView('ExpoUI', 'DataListForEachPoolView');
|
|
9
|
+
// Skip unchanged rows when the window moves.
|
|
10
|
+
const RecycledRow = /*#__PURE__*/ memo(function RecycledRow({ item, index, itemKey, revision, renderItem }) {
|
|
11
|
+
return /*#__PURE__*/ _jsx(NativeSlot, {
|
|
12
|
+
itemKey: itemKey,
|
|
13
|
+
index: index,
|
|
14
|
+
revision: revision,
|
|
15
|
+
children: renderItem({
|
|
16
|
+
item,
|
|
17
|
+
index
|
|
18
|
+
})
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
export function useItemKeys(data, keyExtractor) {
|
|
22
|
+
const keyExtractorRef = useRef(keyExtractor);
|
|
23
|
+
keyExtractorRef.current = keyExtractor;
|
|
24
|
+
return useMemo(()=>{
|
|
25
|
+
const keys = data.map((item, index)=>keyExtractorRef.current(item, index));
|
|
26
|
+
if (keys.some((key)=>typeof key !== 'string') || new Set(keys).size !== keys.length) {
|
|
27
|
+
throw new Error('List.ForEach keyExtractor must return a unique string for every item.');
|
|
28
|
+
}
|
|
29
|
+
return keys;
|
|
30
|
+
}, [
|
|
31
|
+
data
|
|
32
|
+
]);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Renders a window of recycled rows inside List or Section.
|
|
36
|
+
* Rows show placeholders while JS prepares content. Native keys still cover the full data set.
|
|
37
|
+
* @platform ios
|
|
38
|
+
*/ export function DataListForEach({ data, keyExtractor, children: renderItem, overscanCount = 10, estimatedItemSize = 64, modifiers, onDelete, onMove, ...props }) {
|
|
39
|
+
if (!Number.isSafeInteger(overscanCount) || overscanCount < 0) {
|
|
40
|
+
throw new Error('List.ForEach overscanCount must be a non-negative integer.');
|
|
41
|
+
}
|
|
42
|
+
if (!Number.isFinite(estimatedItemSize) || estimatedItemSize <= 0) {
|
|
43
|
+
throw new Error('List.ForEach estimatedItemSize must be a positive finite number.');
|
|
44
|
+
}
|
|
45
|
+
const itemKeys = useItemKeys(data, keyExtractor);
|
|
46
|
+
const [state, setState] = useState({
|
|
47
|
+
keys: itemKeys,
|
|
48
|
+
first: 0,
|
|
49
|
+
last: 0,
|
|
50
|
+
revision: 0,
|
|
51
|
+
capacity: 0,
|
|
52
|
+
overscanCount
|
|
53
|
+
});
|
|
54
|
+
let current = state;
|
|
55
|
+
if (state.keys !== itemKeys) {
|
|
56
|
+
const previousKey = state.keys[state.first];
|
|
57
|
+
const anchor = previousKey === undefined ? 0 : Math.max(0, itemKeys.indexOf(previousKey));
|
|
58
|
+
current = {
|
|
59
|
+
...state,
|
|
60
|
+
keys: itemKeys,
|
|
61
|
+
first: Math.min(anchor, Math.max(0, data.length - 1)),
|
|
62
|
+
last: Math.min(anchor + state.last - state.first, Math.max(0, data.length - 1)),
|
|
63
|
+
revision: state.revision + 1
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
if (current.overscanCount !== overscanCount) {
|
|
67
|
+
current = {
|
|
68
|
+
...current,
|
|
69
|
+
overscanCount,
|
|
70
|
+
capacity: 0
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
if (current !== state) setState(current);
|
|
74
|
+
const { start, capacity } = getWindow(data.length, current.first, current.last, overscanCount, current.capacity);
|
|
75
|
+
const committedRevision = useRef(current.revision);
|
|
76
|
+
useLayoutEffect(()=>{
|
|
77
|
+
committedRevision.current = current.revision;
|
|
78
|
+
}, [
|
|
79
|
+
current.revision
|
|
80
|
+
]);
|
|
81
|
+
const indices = getSlotIndices(start, capacity);
|
|
82
|
+
return /*#__PURE__*/ _jsx(NativeList, {
|
|
83
|
+
...props,
|
|
84
|
+
modifiers: modifiers,
|
|
85
|
+
...modifiers ? createViewModifierEventListener(modifiers) : undefined,
|
|
86
|
+
deleteEnabled: !!onDelete,
|
|
87
|
+
moveEnabled: !!onMove,
|
|
88
|
+
onDelete: onDelete ? ({ nativeEvent })=>{
|
|
89
|
+
if (nativeEvent.revision === committedRevision.current) onDelete(nativeEvent.indices);
|
|
90
|
+
} : undefined,
|
|
91
|
+
onMove: onMove ? ({ nativeEvent })=>{
|
|
92
|
+
if (nativeEvent.revision === committedRevision.current) {
|
|
93
|
+
onMove(nativeEvent.sourceIndices, nativeEvent.destination);
|
|
94
|
+
}
|
|
95
|
+
} : undefined,
|
|
96
|
+
itemKeys: itemKeys,
|
|
97
|
+
revision: current.revision,
|
|
98
|
+
estimatedItemSize: estimatedItemSize,
|
|
99
|
+
onWindowChange: ({ nativeEvent: event })=>{
|
|
100
|
+
if (!Number.isSafeInteger(event.first) || !Number.isSafeInteger(event.last) || event.last < event.first) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
setState((previous)=>{
|
|
104
|
+
// Ignore requests from before a data change.
|
|
105
|
+
if (event.revision !== previous.revision) return previous;
|
|
106
|
+
const maximum = Math.max(0, previous.keys.length - 1);
|
|
107
|
+
const first = Math.max(0, Math.min(event.first, maximum));
|
|
108
|
+
const last = Math.max(first, Math.min(event.last, maximum));
|
|
109
|
+
const { capacity } = getWindow(previous.keys.length, first, last, previous.overscanCount, previous.capacity);
|
|
110
|
+
return first === previous.first && last === previous.last && capacity === previous.capacity ? previous : {
|
|
111
|
+
...previous,
|
|
112
|
+
first,
|
|
113
|
+
last,
|
|
114
|
+
capacity
|
|
115
|
+
};
|
|
116
|
+
});
|
|
117
|
+
},
|
|
118
|
+
children: /*#__PURE__*/ _jsx(NativePool, {
|
|
119
|
+
children: indices.map((index, slot)=>{
|
|
120
|
+
const item = data[index];
|
|
121
|
+
const itemKey = itemKeys[index];
|
|
122
|
+
if (item === undefined || itemKey === undefined) {
|
|
123
|
+
throw new Error(`List.ForEach could not resolve the item at index ${index}.`);
|
|
124
|
+
}
|
|
125
|
+
return /*#__PURE__*/ _jsx(RecycledRow, {
|
|
126
|
+
item: item,
|
|
127
|
+
index: index,
|
|
128
|
+
itemKey: itemKey,
|
|
129
|
+
revision: current.revision,
|
|
130
|
+
renderItem: renderItem
|
|
131
|
+
}, slot);
|
|
132
|
+
})
|
|
133
|
+
})
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
//# sourceMappingURL=DataListForEach.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["swift-ui/List/DataListForEach.tsx"],"sourcesContent":[null],"names":["requireNativeView","memo","useLayoutEffect","useMemo","useRef","useState","createViewModifierEventListener","getSlotIndices","getWindow","NativeList","NativeSlot","NativePool","RecycledRow","item","index","itemKey","revision","renderItem","useItemKeys","data","keyExtractor","keyExtractorRef","current","keys","map","some","key","Set","size","length","Error","DataListForEach","children","overscanCount","estimatedItemSize","modifiers","onDelete","onMove","props","Number","isSafeInteger","isFinite","itemKeys","state","setState","first","last","capacity","previousKey","anchor","undefined","Math","max","indexOf","min","start","committedRevision","indices","deleteEnabled","moveEnabled","nativeEvent","sourceIndices","destination","onWindowChange","event","previous","maximum","slot"],"mappings":";AAAA,SAASA,iBAAiB,QAAQ,OAAO;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;gBAEnB,OAAOF,UAAUoB,SAASpB,KAAK,IAC7BC,SAASmB,SAASnB,IAAI,IACtBC,aAAakB,SAASlB,QAAQ,GAC5BkB,WACA;oBAAE,GAAGA,QAAQ;oBAAEpB;oBAAOC;oBAAMC;gBAAS;YAC3C;QACF;kBACA,cAAA,KAACpC;sBACE8C,QAAQjC,GAAG,CAAC,CAACV,OAAOqD;gBACnB,MAAMtD,OAAOM,IAAI,CAACL,MAAM;gBACxB,MAAMC,UAAU2B,QAAQ,CAAC5B,MAAM;gBAC/B,IAAID,SAASqC,aAAanC,YAAYmC,WAAW;oBAC/C,MAAM,IAAIpB,MAAM,CAAC,iDAAiD,EAAEhB,MAAM,CAAC,CAAC;gBAC9E;gBACA,qBACE,KAACF;oBAECC,MAAMA;oBACNC,OAAOA;oBACPC,SAASA;oBACTC,UAAUM,QAAQN,QAAQ;oBAC1BC,YAAYA;mBALPkD;YAQX;;;AAIR"}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { type CommonViewModifierProps } from '../types';
|
|
2
|
-
|
|
2
|
+
import { type ListForEachProps } from './DataListForEach';
|
|
3
|
+
export { type ListForEachProps };
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Pass `data` and `keyExtractor`, and render each row from a `children` function.
|
|
6
|
+
*/
|
|
7
|
+
export interface ListForEachElementsProps extends CommonViewModifierProps {
|
|
8
|
+
data?: never;
|
|
9
|
+
keyExtractor?: never;
|
|
10
|
+
recycling?: never;
|
|
11
|
+
overscanCount?: never;
|
|
12
|
+
estimatedItemSize?: never;
|
|
3
13
|
/**
|
|
4
14
|
* The children elements to be rendered inside the `List.ForEach`.
|
|
5
15
|
*/
|
|
@@ -18,7 +28,8 @@ export interface ListForEachProps extends CommonViewModifierProps {
|
|
|
18
28
|
onMove?: (sourceIndices: number[], destination: number) => void;
|
|
19
29
|
}
|
|
20
30
|
/**
|
|
21
|
-
* A
|
|
22
|
-
*
|
|
31
|
+
* A group of rows inside `List`, with optional deletion and reordering.
|
|
32
|
+
* Pass `data` with `keyExtractor`, and render each row from a `children` function.
|
|
33
|
+
* Recycles rows unless `recycling` is `false`.
|
|
23
34
|
*/
|
|
24
|
-
export declare function ListForEach(
|
|
35
|
+
export declare function ListForEach<ItemT>(props: ListForEachProps<ItemT> | ListForEachElementsProps): import("react").JSX.Element;
|
|
@@ -1,16 +1,53 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { requireNativeView } from 'expo';
|
|
3
|
+
import { DataListForEach, NativeSlot, useItemKeys } from './DataListForEach';
|
|
3
4
|
const ListForEachNativeView = requireNativeView('ExpoUI', 'ListForEachView');
|
|
5
|
+
let warnedElements = false;
|
|
4
6
|
/**
|
|
5
|
-
* A
|
|
6
|
-
*
|
|
7
|
-
|
|
7
|
+
* A group of rows inside `List`, with optional deletion and reordering.
|
|
8
|
+
* Pass `data` with `keyExtractor`, and render each row from a `children` function.
|
|
9
|
+
* Recycles rows unless `recycling` is `false`.
|
|
10
|
+
*/ export function ListForEach(props) {
|
|
11
|
+
if (props.data === undefined) {
|
|
12
|
+
if (__DEV__ && !warnedElements) {
|
|
13
|
+
warnedElements = true;
|
|
14
|
+
console.warn('[@expo/ui] Passing elements as List.ForEach children is deprecated. Pass `data` and `keyExtractor`, and render each row from a `children` function: `{({ item }) => <Row item={item} />}`.');
|
|
15
|
+
}
|
|
16
|
+
return /*#__PURE__*/ _jsx(ChildrenListForEach, {
|
|
17
|
+
...props
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
const { recycling = true, ...rest } = props;
|
|
21
|
+
return recycling ? /*#__PURE__*/ _jsx(DataListForEach, {
|
|
22
|
+
...rest
|
|
23
|
+
}) : /*#__PURE__*/ _jsx(StaticListForEach, {
|
|
24
|
+
...rest
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function ChildrenListForEach({ children, onDelete, onMove, ...props }) {
|
|
8
28
|
return /*#__PURE__*/ _jsx(ListForEachNativeView, {
|
|
9
29
|
...props,
|
|
30
|
+
deleteEnabled: !!onDelete,
|
|
31
|
+
moveEnabled: !!onMove,
|
|
10
32
|
onDelete: onDelete ? ({ nativeEvent })=>onDelete(nativeEvent.indices) : undefined,
|
|
11
33
|
onMove: onMove ? ({ nativeEvent })=>onMove(nativeEvent.sourceIndices, nativeEvent.destination) : undefined,
|
|
12
34
|
children: children
|
|
13
35
|
});
|
|
14
36
|
}
|
|
37
|
+
function StaticListForEach({ data, keyExtractor, children: renderItem, overscanCount: _overscanCount, estimatedItemSize: _estimatedItemSize, ...props }) {
|
|
38
|
+
const itemKeys = useItemKeys(data, keyExtractor);
|
|
39
|
+
return /*#__PURE__*/ _jsx(ChildrenListForEach, {
|
|
40
|
+
...props,
|
|
41
|
+
children: data.map((item, index)=>/*#__PURE__*/ _jsx(NativeSlot, {
|
|
42
|
+
itemKey: itemKeys[index],
|
|
43
|
+
index: index,
|
|
44
|
+
revision: 0,
|
|
45
|
+
children: renderItem({
|
|
46
|
+
item,
|
|
47
|
+
index
|
|
48
|
+
})
|
|
49
|
+
}, itemKeys[index]))
|
|
50
|
+
});
|
|
51
|
+
}
|
|
15
52
|
|
|
16
53
|
//# sourceMappingURL=ListForEach.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["swift-ui/List/ListForEach.tsx"],"sourcesContent":[null],"names":["requireNativeView","ListForEachNativeView","ListForEach","children","onDelete","onMove","
|
|
1
|
+
{"version":3,"sources":["swift-ui/List/ListForEach.tsx"],"sourcesContent":[null],"names":["requireNativeView","DataListForEach","NativeSlot","useItemKeys","ListForEachNativeView","warnedElements","ListForEach","props","data","undefined","__DEV__","console","warn","ChildrenListForEach","recycling","rest","StaticListForEach","children","onDelete","onMove","deleteEnabled","moveEnabled","nativeEvent","indices","sourceIndices","destination","keyExtractor","renderItem","overscanCount","_overscanCount","estimatedItemSize","_estimatedItemSize","itemKeys","map","item","index","itemKey","revision"],"mappings":";AAAA,SAASA,iBAAiB,QAAQ,OAA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XH,QAAQ,CAACG,MAAM;;AAMxC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type CommonViewModifierProps } from '../types';
|
|
2
2
|
import { ListForEach } from './ListForEach';
|
|
3
|
-
export { ListForEach, type ListForEachProps } from './ListForEach';
|
|
3
|
+
export { ListForEach, type ListForEachProps, type ListForEachElementsProps } from './ListForEach';
|
|
4
4
|
export interface ListProps extends CommonViewModifierProps {
|
|
5
5
|
/**
|
|
6
6
|
* The children elements to be rendered inside the list.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["swift-ui/List/index.tsx"],"sourcesContent":[null],"names":["requireNativeView","createViewModifierEventListener","ListForEach","ListNativeView","transformListProps","props","modifiers","restProps","undefined","onSelectionChange","nativeEvent","selection","List","children","nativeProps","ForEach"],"mappings":";AAAA,SAASA,iBAAiB,QAAQ,OAAO;AAGzC,SAASC,+BAA+B,QAAQ,qBAAqB;AAErE,SAASC,WAAW,QAAQ,gBAAgB;AAE5C,SAASA,WAAW,
|
|
1
|
+
{"version":3,"sources":["swift-ui/List/index.tsx"],"sourcesContent":[null],"names":["requireNativeView","createViewModifierEventListener","ListForEach","ListNativeView","transformListProps","props","modifiers","restProps","undefined","onSelectionChange","nativeEvent","selection","List","children","nativeProps","ForEach"],"mappings":";AAAA,SAASA,iBAAiB,QAAQ,OAAO;AAGzC,SAASC,+BAA+B,QAAQ,qBAAqB;AAErE,SAASC,WAAW,QAAQ,gBAAgB;AAE5C,SAASA,WAAW,QAA8D,gBAAgB;AAElG,MAAMC,iBAAuDH,kBAC3D,UACA;AAGF,SAASI,mBAAmBC,KAAkC;IAC5D,MAAM,EAAEC,SAAS,EAAE,GAAGC,WAAW,GAAGF;IACpC,OAAO;QACLC;QACA,GAAIA,YAAYL,gCAAgCK,aAAaE,SAAS;QACtE,GAAGD,SAAS;QACZE,mBAAmB,CAAC,EAAEC,aAAa,EAAEC,SAAS,EAAE,EAAE,GAAKN,OAAOI,oBAAoBE;IACpF;AACF;AA8BA;;CAEC,GACD,OAAO,SAASC,KAAKP,KAAgB;IACnC,MAAM,EAAEQ,QAAQ,EAAE,GAAGC,aAAa,GAAGT;IACrC,qBAAO,KAACF;QAAgB,GAAGC,mBAAmBU,YAAY;kBAAGD;;AAC/D;AAEAD,KAAKG,OAAO,GAAGb"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export function getWindow(count, first, last, overscanCount, minCapacity = 0) {
|
|
2
|
+
if (count === 0) return {
|
|
3
|
+
start: 0,
|
|
4
|
+
capacity: 0
|
|
5
|
+
};
|
|
6
|
+
first = Math.max(0, Math.min(first, count - 1));
|
|
7
|
+
last = Math.max(first, Math.min(last, count - 1));
|
|
8
|
+
const start = Math.max(0, first - overscanCount);
|
|
9
|
+
const end = Math.min(count, last + 1 + overscanCount);
|
|
10
|
+
// Never shrink the pool: a stable capacity keeps `index % capacity` slot assignments stable.
|
|
11
|
+
// Grow it with headroom, because every growth re-renders the whole pool.
|
|
12
|
+
const needed = end - start;
|
|
13
|
+
let capacity = minCapacity;
|
|
14
|
+
if (needed > capacity) capacity = capacity === 0 ? needed : needed + overscanCount;
|
|
15
|
+
capacity = Math.min(count, capacity);
|
|
16
|
+
return {
|
|
17
|
+
start: Math.min(start, count - capacity),
|
|
18
|
+
capacity
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export function getSlotIndices(start, capacity) {
|
|
22
|
+
if (capacity === 0) return [];
|
|
23
|
+
return Array.from({
|
|
24
|
+
length: capacity
|
|
25
|
+
}, (_, slot)=>start + (slot - start % capacity + capacity) % capacity);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=window.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["swift-ui/List/window.ts"],"sourcesContent":[null],"names":["getWindow","count","first","last","overscanCount","minCapacity","start","capacity","Math","max","min","end","needed","getSlotIndices","Array","from","length","_","slot"],"mappings":"AAAA,OAAO,SAASA,UACdC,KAAa,EACbC,KAAa,EACbC,IAAY,EACZC,aAAqB,EACrBC,cAAc,CAAC;IAEf,IAAIJ,UAAU,GAAG,OAAO;QAAEK,OAAO;QAAGC,UAAU;IAAE;IAChDL,QAAQM,KAAKC,GAAG,CAAC,GAAGD,KAAKE,GAAG,CAACR,OAAOD,QAAQ;IAC5CE,OAAOK,KAAKC,GAAG,CAACP,OAAOM,KAAKE,GAAG,CAACP,MAAMF,QAAQ;IAC9C,MAAMK,QAAQE,KAAKC,GAAG,CAAC,GAAGP,QAAQE;IAClC,MAAMO,MAAMH,KAAKE,GAAG,CAACT,OAAOE,OAAO,IAAIC;IACvC,6FAA6F;IAC7F,yEAAyE;IACzE,MAAMQ,SAASD,MAAML;IACrB,IAAIC,WAAWF;IACf,IAAIO,SAASL,UAAUA,WAAWA,aAAa,IAAIK,SAASA,SAASR;IACrEG,WAAWC,KAAKE,GAAG,CAACT,OAAOM;IAC3B,OAAO;QAAED,OAAOE,KAAKE,GAAG,CAACJ,OAAOL,QAAQM;QAAWA;IAAS;AAC9D;AAEA,OAAO,SAASM,eAAeP,KAAa,EAAEC,QAAgB;IAC5D,IAAIA,aAAa,GAAG,OAAO,EAAE;IAC7B,OAAOO,MAAMC,IAAI,CACf;QAAEC,QAAQT;IAAS,GACnB,CAACU,GAAGC,OAASZ,QAAS,AAACY,CAAAA,OAAQZ,QAAQC,WAAYA,QAAO,IAAKA;AAEnE"}
|
|
@@ -77,22 +77,31 @@ export declare const matchedGeometryEffect: (id: string, namespaceId: string, op
|
|
|
77
77
|
* @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/geometrygroup()).
|
|
78
78
|
*/
|
|
79
79
|
export declare const geometryGroup: () => ModifierConfig;
|
|
80
|
+
type FrameAlignment = 'center' | 'leading' | 'trailing' | 'top' | 'bottom' | 'topLeading' | 'topTrailing' | 'bottomLeading' | 'bottomTrailing';
|
|
80
81
|
/**
|
|
81
|
-
*
|
|
82
|
-
* @param params - The frame parameters
|
|
82
|
+
* Positions this view within an invisible frame with the specified size.
|
|
83
|
+
* @param params - The fixed frame parameters: `width`, `height` and `alignment`.
|
|
83
84
|
* @see Official [SwiftUI documentation](https://developer.apple.com/documentation/SwiftUI/View/frame(width:height:alignment:)).
|
|
84
85
|
*/
|
|
85
|
-
export declare
|
|
86
|
+
export declare function frame(params: {
|
|
86
87
|
width?: number;
|
|
87
88
|
height?: number;
|
|
89
|
+
alignment?: FrameAlignment;
|
|
90
|
+
}): ModifierConfig;
|
|
91
|
+
/**
|
|
92
|
+
* Positions this view within an invisible frame having the specified size constraints.
|
|
93
|
+
* @param params - The flexible frame parameters: `minWidth`, `idealWidth`, `maxWidth`, `minHeight`, `idealHeight`, `maxHeight` and `alignment`.
|
|
94
|
+
* @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/frame(minwidth:idealwidth:maxwidth:minheight:idealheight:maxheight:alignment:)).
|
|
95
|
+
*/
|
|
96
|
+
export declare function frame(params: {
|
|
88
97
|
minWidth?: number;
|
|
98
|
+
idealWidth?: number;
|
|
89
99
|
maxWidth?: number;
|
|
90
100
|
minHeight?: number;
|
|
91
|
-
maxHeight?: number;
|
|
92
|
-
idealWidth?: number;
|
|
93
101
|
idealHeight?: number;
|
|
94
|
-
|
|
95
|
-
|
|
102
|
+
maxHeight?: number;
|
|
103
|
+
alignment?: FrameAlignment;
|
|
104
|
+
}): ModifierConfig;
|
|
96
105
|
/**
|
|
97
106
|
* Positions this view within an invisible frame with a size relative to the nearest container.
|
|
98
107
|
* @param params - The content relative frame parameters: `axes`, `count`, `span`, `spacing` and `alignment`.
|