@expo/ui 58.0.6 → 58.0.8
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 +20 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +9 -0
- package/android/src/main/java/expo/modules/ui/LazyColumnView.kt +6 -1
- package/android/src/main/java/expo/modules/ui/LazyItemsView.kt +313 -0
- package/android/src/main/java/expo/modules/ui/LazyRowView.kt +6 -1
- package/android/src/main/java/expo/modules/ui/ModifierRegistry.kt +11 -3
- package/android/src/main/java/expo/modules/ui/RNHostView.kt +18 -4
- package/android/src/main/java/expo/modules/ui/SemanticsModifier.kt +2 -1
- package/build/jetpack-compose/LazyColumn/index.d.ts +6 -0
- package/build/jetpack-compose/LazyColumn/index.js +2 -0
- package/build/jetpack-compose/LazyColumn/index.js.map +1 -1
- package/build/jetpack-compose/LazyItems/index.d.ts +54 -0
- package/build/jetpack-compose/LazyItems/index.js +63 -0
- package/build/jetpack-compose/LazyItems/index.js.map +1 -0
- package/build/jetpack-compose/LazyRow/index.d.ts +6 -0
- package/build/jetpack-compose/LazyRow/index.js +2 -0
- package/build/jetpack-compose/LazyRow/index.js.map +1 -1
- package/build/jetpack-compose/index.d.ts +1 -0
- package/build/jetpack-compose/index.js.map +1 -1
- package/build/jetpack-compose/modifiers/index.d.ts +15 -3
- package/build/jetpack-compose/modifiers/index.js.map +1 -1
- package/build/recycling/useRecycledRows.d.ts +52 -0
- package/build/recycling/useRecycledRows.js +121 -0
- package/build/recycling/useRecycledRows.js.map +1 -0
- package/build/recycling/window.js.map +1 -0
- package/build/swift-ui/List/DataListForEach.d.ts +2 -9
- package/build/swift-ui/List/DataListForEach.js +15 -106
- package/build/swift-ui/List/DataListForEach.js.map +1 -1
- package/build/swift-ui/List/ListForEach.js +3 -2
- package/build/swift-ui/List/ListForEach.js.map +1 -1
- package/build/swift-ui/modifiers/index.d.ts +5 -1
- package/build/swift-ui/modifiers/index.js.map +1 -1
- package/build/swift-ui/modifiers/presentationModifiers.d.ts +8 -0
- package/build/swift-ui/modifiers/presentationModifiers.js +9 -0
- package/build/swift-ui/modifiers/presentationModifiers.js.map +1 -1
- package/build/universal/State.android.d.ts +1 -3
- package/build/universal/State.d.ts +2 -3
- package/build/universal/State.ios.d.ts +1 -3
- package/build/universal/State.js +10 -4
- package/build/universal/State.js.map +1 -1
- package/build/universal/transformStyle.ios.js +4 -3
- package/build/universal/transformStyle.ios.js.map +1 -1
- package/build/universal/types.d.ts +24 -0
- package/build/universal/types.js +8 -2
- package/build/universal/types.js.map +1 -1
- package/expo-module.config.json +1 -1
- package/ios/Modifiers/PresentationModifiers.swift +10 -0
- package/ios/Modifiers/ViewModifierRegistry.swift +4 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.6/expo.modules.ui-58.0.6-sources.jar → 58.0.8/expo.modules.ui-58.0.8-sources.jar} +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8-sources.jar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8-sources.jar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8-sources.jar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8-sources.jar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.aar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.aar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.aar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.aar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.6/expo.modules.ui-58.0.6.module → 58.0.8/expo.modules.ui-58.0.8.module} +24 -24
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.module.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.6/expo.modules.ui-58.0.6.pom → 58.0.8/expo.modules.ui-58.0.8.pom} +3 -3
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.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 +4 -4
- package/prebuilds/output/debug/xcframeworks/ExpoUI.tar.gz +0 -0
- package/prebuilds/output/release/xcframeworks/ExpoUI.tar.gz +0 -0
- package/src/jetpack-compose/LazyColumn/index.tsx +3 -0
- package/src/jetpack-compose/LazyItems/index.tsx +121 -0
- package/src/jetpack-compose/LazyRow/index.tsx +3 -0
- package/src/jetpack-compose/index.ts +1 -0
- package/src/jetpack-compose/modifiers/index.ts +16 -1
- package/src/recycling/useRecycledRows.tsx +200 -0
- package/src/swift-ui/List/DataListForEach.tsx +21 -142
- package/src/swift-ui/List/ListForEach.tsx +3 -2
- package/src/swift-ui/modifiers/index.ts +5 -1
- package/src/swift-ui/modifiers/presentationModifiers.ts +10 -0
- package/src/universal/State.android.ts +1 -1
- package/src/universal/State.ios.ts +1 -1
- package/src/universal/State.ts +12 -4
- package/src/universal/transformStyle.ios.ts +5 -2
- package/src/universal/types.ts +27 -0
- package/build/swift-ui/List/window.js.map +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.6/expo.modules.ui-58.0.6-sources.jar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.6/expo.modules.ui-58.0.6-sources.jar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.6/expo.modules.ui-58.0.6-sources.jar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.6/expo.modules.ui-58.0.6-sources.jar.sha512 +0 -1
- 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 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.6/expo.modules.ui-58.0.6.aar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.6/expo.modules.ui-58.0.6.aar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.6/expo.modules.ui-58.0.6.aar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.6/expo.modules.ui-58.0.6.module.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.6/expo.modules.ui-58.0.6.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.6/expo.modules.ui-58.0.6.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.6/expo.modules.ui-58.0.6.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.6/expo.modules.ui-58.0.6.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.6/expo.modules.ui-58.0.6.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.6/expo.modules.ui-58.0.6.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.6/expo.modules.ui-58.0.6.pom.sha512 +0 -1
- /package/build/{swift-ui/List → recycling}/window.d.ts +0 -0
- /package/build/{swift-ui/List → recycling}/window.js +0 -0
- /package/src/{swift-ui/List → recycling}/window.ts +0 -0
|
@@ -29,3 +29,9 @@ export interface LazyRowProps {
|
|
|
29
29
|
* A lazy row component that efficiently displays a horizontally scrolling list.
|
|
30
30
|
*/
|
|
31
31
|
export declare function LazyRow(props: LazyRowProps): import("react").JSX.Element;
|
|
32
|
+
export declare namespace LazyRow {
|
|
33
|
+
var Items: {
|
|
34
|
+
<ItemT>({ recycling, ...props }: import("..").LazyItemsProps<ItemT>): import("react").JSX.Element;
|
|
35
|
+
displayName: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { requireNativeView } from 'expo';
|
|
3
|
+
import { createLazyItems } from '../LazyItems';
|
|
3
4
|
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
4
5
|
const LazyRowNativeView = requireNativeView('ExpoUI', 'LazyRowView');
|
|
5
6
|
function transformProps(props) {
|
|
@@ -17,5 +18,6 @@ function transformProps(props) {
|
|
|
17
18
|
...transformProps(props)
|
|
18
19
|
});
|
|
19
20
|
}
|
|
21
|
+
LazyRow.Items = createLazyItems('LazyRow.Items');
|
|
20
22
|
|
|
21
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["jetpack-compose/LazyRow/index.tsx"],"sourcesContent":[null],"names":["requireNativeView","createViewModifierEventListener","LazyRowNativeView","transformProps","props","modifiers","restProps","undefined","LazyRow"],"mappings":";AAAA,SAASA,iBAAiB,QAAQ,OAAO;AAIzC,SAASC,+BAA+B,QAAQ,qBAAqB;AAkCrE,MAAMC,
|
|
1
|
+
{"version":3,"sources":["jetpack-compose/LazyRow/index.tsx"],"sourcesContent":[null],"names":["requireNativeView","createLazyItems","createViewModifierEventListener","LazyRowNativeView","transformProps","props","modifiers","restProps","undefined","LazyRow","Items"],"mappings":";AAAA,SAASA,iBAAiB,QAAQ,OAAO;AAIzC,SAASC,eAAe,QAAQ,eAAe;AAC/C,SAASC,+BAA+B,QAAQ,qBAAqB;AAkCrE,MAAMC,oBAA6DH,kBACjE,UACA;AAGF,SAASI,eAAeC,KAAmB;IACzC,MAAM,EAAEC,SAAS,EAAE,GAAGC,WAAW,GAAGF;IACpC,OAAO;QACLC;QACA,GAAIA,YAAYJ,gCAAgCI,aAAaE,SAAS;QACtE,GAAGD,SAAS;IACd;AACF;AAEA;;CAEC,GACD,OAAO,SAASE,QAAQJ,KAAmB;IACzC,qBAAO,KAACF;QAAmB,GAAGC,eAAeC,MAAM;;AACrD;AAEAI,QAAQC,KAAK,GAAGT,gBAAgB"}
|
|
@@ -16,6 +16,7 @@ export * from './ExposedDropdownMenuBox';
|
|
|
16
16
|
export * from './Divider';
|
|
17
17
|
export * from './Host';
|
|
18
18
|
export * from './LazyColumn';
|
|
19
|
+
export { type LazyItemsProps } from './LazyItems';
|
|
19
20
|
export * from './LazyRow';
|
|
20
21
|
export * from './ListItem';
|
|
21
22
|
export * from './RNHostView';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["jetpack-compose/index.ts"],"sourcesContent":[null],"names":["BasicAlertDialog","TextField","OutlinedTextField","BasicTextField","HorizontalPager","Text","useNativeState"],"mappings":"AAAA,OAAO,wCAAwC;AAE/C,cAAc,gBAAgB;AAC9B,cAAc,UAAU;AACxB,cAAc,cAAc;AAC5B,SAASA,gBAAgB,QAAoC,qBAAqB;AAClF,cAAc,SAAS;AACvB,cAAc,aAAa;AAC3B,cAAc,SAAS;AACvB,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,SAAS;AACvB,cAAc,UAAU;AACxB,cAAc,eAAe;AAC7B,cAAc,iBAAiB;AAC/B,cAAc,2BAA2B;AACzC,cAAc,YAAY;AAC1B,cAAc,SAAS;AACvB,cAAc,eAAe;
|
|
1
|
+
{"version":3,"sources":["jetpack-compose/index.ts"],"sourcesContent":[null],"names":["BasicAlertDialog","TextField","OutlinedTextField","BasicTextField","HorizontalPager","Text","useNativeState"],"mappings":"AAAA,OAAO,wCAAwC;AAE/C,cAAc,gBAAgB;AAC9B,cAAc,UAAU;AACxB,cAAc,cAAc;AAC5B,SAASA,gBAAgB,QAAoC,qBAAqB;AAClF,cAAc,SAAS;AACvB,cAAc,aAAa;AAC3B,cAAc,SAAS;AACvB,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,SAAS;AACvB,cAAc,UAAU;AACxB,cAAc,eAAe;AAC7B,cAAc,iBAAiB;AAC/B,cAAc,2BAA2B;AACzC,cAAc,YAAY;AAC1B,cAAc,SAAS;AACvB,cAAc,eAAe;AAE7B,cAAc,YAAY;AAC1B,cAAc,aAAa;AAC3B,cAAc,eAAe;AAC7B,cAAc,eAAe;AAC7B,cAAc,oBAAoB;AAClC,cAAc,aAAa;AAC3B,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,eAAe;AAC7B,SACEC,SAAS,EACTC,iBAAiB,EACjBC,cAAc,QAcT,cAAc;AACrB,cAAc,iBAAiB;AAC/B,cAAc,UAAU;AACxB,cAAc,qBAAqB;AACnC,cAAc,kBAAkB;AAChC,cAAc,aAAa;AAC3B,SACEC,eAAe,QAGV,oBAAoB;AAC3B,cAAc,cAAc;AAC5B,cAAc,aAAa;AAC3B,cAAc,oBAAoB;AAClC,cAAc,8BAA8B;AAC5C,cAAc,yBAAyB;AACvC,cAAc,qBAAqB;AACnC,cAAc,gBAAgB;AAC9B,cAAc,YAAY;AAC1B,SAAyBC,IAAI,QAAQ,SAAS;AAC9C,cAAc,YAAY;AAC1B,cAAc,qBAAqB;AAEnC,cAAc,uBAAuB;AACrC,cAAc,QAAQ;AACtB,cAAc,QAAQ;AACtB,cAAc,WAAW;AACzB,cAAc,YAAY;AAC1B,SAASC,cAAc,QAAQ,WAAW"}
|
|
@@ -313,11 +313,23 @@ export declare const onGloballyPositioned: (handler: (layout: {
|
|
|
313
313
|
*/
|
|
314
314
|
export declare const testID: (tag: string) => import("./createModifier").ModifierConfig;
|
|
315
315
|
/**
|
|
316
|
-
*
|
|
316
|
+
* Options for the `semantics` modifier.
|
|
317
317
|
*/
|
|
318
|
-
export
|
|
318
|
+
export type SemanticsConfig = {
|
|
319
|
+
/**
|
|
320
|
+
* An autofill hint, such as `'email'` or `'password'`.
|
|
321
|
+
*/
|
|
319
322
|
contentType?: string;
|
|
320
|
-
|
|
323
|
+
/**
|
|
324
|
+
* What accessibility services such as TalkBack announce for the element. Useful when the visible
|
|
325
|
+
* content does not read well aloud, as with an abbreviation or a glyph.
|
|
326
|
+
*/
|
|
327
|
+
contentDescription?: string;
|
|
328
|
+
};
|
|
329
|
+
/**
|
|
330
|
+
* Applies semantic properties. Wraps `Modifier.semantics { ... }`.
|
|
331
|
+
*/
|
|
332
|
+
export declare const semantics: (params: SemanticsConfig) => import("./createModifier").ModifierConfig;
|
|
321
333
|
type MaterialShapeName = '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';
|
|
322
334
|
type CornerRadii = {
|
|
323
335
|
topStart?: number;
|
|
@@ -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","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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;;;;;CAKC,GACD,OAAO,MAAMM,aAAa,CACxBC,UACAR,SACAS,OACGvE,gCAAgC,cAAc8D,SAAS;QAAEQ;QAAUC;IAAK,GAAG;AAEhF;;;CAGC,GACD,OAAO,MAAMC,kBAAkB,IAAMzE,eAAe,mBAAmB;AAEvE;;;;;;;CAOC,GACD,OAAO,MAAM0E,aAAa,CACxBrD,OACA0C,SACAxC,UACGtB,gCAAgC,cAAc8D,SAAS;QAAE1C;QAAOmD,MAAMjD,SAASiD;IAAK,GAAG;AAE5F,gFAAgF;AAChF,sBAAsB;AACtB,gFAAgF;AAEhF;;;;;;CAMC,GACD,OAAO,MAAMG,sBAAsB,CACjCZ,SACAxC,UAEAtB,gCACE,uBACA,CAACiD,SAAmCa,QAAQb,OAAO0B,SAAS,GAC5D;QACEC,eAAetD,SAASsD;QACxBC,oBAAoBvD,SAASuD;IAC/B,GACA;AAEJ;;;CAGC,GACD,OAAO,MAAMC,gBAAgB,CAAChB,UAC5B9D,gCAAgC,iBAAiB,CAACa,OAChDiD,QAAQjD,OACR;AAEJ;;;;CAIC,GACD,OAAO,MAAMkE,uBAAuB,CAClCjB,UAEA9D,gCACE,wBACA,CAACgF,SAAoElB,QAAQkB,SAC7E;AAEJ,gFAAgF;AAChF,oBAAoB;AACpB,gFAAgF;AAEhF;;;CAGC,GACD,OAAO,MAAMC,SAAS,CAACC,MAAgBnF,eAAe,UAAU;QAAEkF,QAAQC;IAAI,GAAG;
|
|
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;;;;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,iBA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B,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,52 @@
|
|
|
1
|
+
import { type ComponentType, type ReactElement } from 'react';
|
|
2
|
+
/** Payload of the native event asking for the rows around the visible range. */
|
|
3
|
+
export type WindowChangeEvent = {
|
|
4
|
+
first: number;
|
|
5
|
+
last: number;
|
|
6
|
+
revision: number;
|
|
7
|
+
};
|
|
8
|
+
/** Props of the native view that holds one recycled row. */
|
|
9
|
+
export type RecycledSlotProps = {
|
|
10
|
+
itemKey: string;
|
|
11
|
+
index: number;
|
|
12
|
+
revision: number;
|
|
13
|
+
children: ReactElement;
|
|
14
|
+
};
|
|
15
|
+
/** Renders one row of the data set. */
|
|
16
|
+
export type RenderItem<ItemT> = (info: {
|
|
17
|
+
item: ItemT;
|
|
18
|
+
index: number;
|
|
19
|
+
}) => ReactElement;
|
|
20
|
+
export type RecycledRows = {
|
|
21
|
+
/** Keys of every item, so the native list can size and identify the full data set. */
|
|
22
|
+
itemKeys: string[];
|
|
23
|
+
/** Increases whenever the data changes, so late native events can be dropped. */
|
|
24
|
+
revision: number;
|
|
25
|
+
/** The pooled rows to mount, one per slot. */
|
|
26
|
+
rows: ReactElement[];
|
|
27
|
+
/** Applies a native window request. */
|
|
28
|
+
onWindowChange: (event: WindowChangeEvent) => void;
|
|
29
|
+
/** Whether a native event was sent for the data currently committed to native. */
|
|
30
|
+
isCurrentRevision: (revision: number) => boolean;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Returns one key per item. Keys follow `data` only: an inline `keyExtractor` changes identity on
|
|
34
|
+
* every parent render, and recomputing keys for it would bump the revision and re-render every row.
|
|
35
|
+
*/
|
|
36
|
+
export declare function useItemKeys<ItemT>(componentName: string, data: readonly ItemT[], keyExtractor: (item: ItemT, index: number) => string): string[];
|
|
37
|
+
/**
|
|
38
|
+
* Keeps a fixed pool of rows centered on the range the native list asks for.
|
|
39
|
+
* Item `index` always renders in slot `index % capacity`, so moving the window
|
|
40
|
+
* only re-renders the slots whose item changed.
|
|
41
|
+
*/
|
|
42
|
+
export declare function useRecycledRows<ItemT>({ componentName, Slot, data, keyExtractor, renderItem, overscanCount, estimatedItemSize, }: {
|
|
43
|
+
/** Name used in error messages, for example `List.ForEach`. */
|
|
44
|
+
componentName: string;
|
|
45
|
+
/** Native view that holds one recycled row. */
|
|
46
|
+
Slot: ComponentType<RecycledSlotProps>;
|
|
47
|
+
data: readonly ItemT[];
|
|
48
|
+
keyExtractor: (item: ItemT, index: number) => string;
|
|
49
|
+
renderItem: RenderItem<ItemT>;
|
|
50
|
+
overscanCount?: number;
|
|
51
|
+
estimatedItemSize?: number;
|
|
52
|
+
}): RecycledRows;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import { getSlotIndices, getWindow } from './window';
|
|
4
|
+
// Skip unchanged rows when the window moves.
|
|
5
|
+
const RecycledRow = /*#__PURE__*/ memo(function RecycledRow({ Slot, item, index, itemKey, revision, renderItem }) {
|
|
6
|
+
return /*#__PURE__*/ _jsx(Slot, {
|
|
7
|
+
itemKey: itemKey,
|
|
8
|
+
index: index,
|
|
9
|
+
revision: revision,
|
|
10
|
+
children: renderItem({
|
|
11
|
+
item,
|
|
12
|
+
index
|
|
13
|
+
})
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
/**
|
|
17
|
+
* Returns one key per item. Keys follow `data` only: an inline `keyExtractor` changes identity on
|
|
18
|
+
* every parent render, and recomputing keys for it would bump the revision and re-render every row.
|
|
19
|
+
*/ export function useItemKeys(componentName, data, keyExtractor) {
|
|
20
|
+
const keyExtractorRef = useRef(keyExtractor);
|
|
21
|
+
keyExtractorRef.current = keyExtractor;
|
|
22
|
+
return useMemo(()=>{
|
|
23
|
+
const keys = data.map((item, index)=>keyExtractorRef.current(item, index));
|
|
24
|
+
if (keys.some((key)=>typeof key !== 'string') || new Set(keys).size !== keys.length) {
|
|
25
|
+
throw new Error(`${componentName} keyExtractor must return a unique string for every item.`);
|
|
26
|
+
}
|
|
27
|
+
return keys;
|
|
28
|
+
}, [
|
|
29
|
+
data
|
|
30
|
+
]);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Keeps a fixed pool of rows centered on the range the native list asks for.
|
|
34
|
+
* Item `index` always renders in slot `index % capacity`, so moving the window
|
|
35
|
+
* only re-renders the slots whose item changed.
|
|
36
|
+
*/ export function useRecycledRows({ componentName, Slot, data, keyExtractor, renderItem, overscanCount = 10, estimatedItemSize = 64 }) {
|
|
37
|
+
if (!Number.isSafeInteger(overscanCount) || overscanCount < 0) {
|
|
38
|
+
throw new Error(`${componentName} overscanCount must be a non-negative integer.`);
|
|
39
|
+
}
|
|
40
|
+
if (!Number.isFinite(estimatedItemSize) || estimatedItemSize <= 0) {
|
|
41
|
+
throw new Error(`${componentName} estimatedItemSize must be a positive finite number.`);
|
|
42
|
+
}
|
|
43
|
+
const itemKeys = useItemKeys(componentName, data, keyExtractor);
|
|
44
|
+
const [state, setState] = useState({
|
|
45
|
+
keys: itemKeys,
|
|
46
|
+
first: 0,
|
|
47
|
+
last: 0,
|
|
48
|
+
revision: 0,
|
|
49
|
+
capacity: 0,
|
|
50
|
+
overscanCount
|
|
51
|
+
});
|
|
52
|
+
let current = state;
|
|
53
|
+
if (state.keys !== itemKeys) {
|
|
54
|
+
const previousKey = state.keys[state.first];
|
|
55
|
+
const anchor = previousKey === undefined ? 0 : Math.max(0, itemKeys.indexOf(previousKey));
|
|
56
|
+
current = {
|
|
57
|
+
...state,
|
|
58
|
+
keys: itemKeys,
|
|
59
|
+
first: Math.min(anchor, Math.max(0, data.length - 1)),
|
|
60
|
+
last: Math.min(anchor + state.last - state.first, Math.max(0, data.length - 1)),
|
|
61
|
+
revision: state.revision + 1
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
if (current.overscanCount !== overscanCount) {
|
|
65
|
+
current = {
|
|
66
|
+
...current,
|
|
67
|
+
overscanCount,
|
|
68
|
+
capacity: 0
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
if (current !== state) setState(current);
|
|
72
|
+
const { start, capacity } = getWindow(data.length, current.first, current.last, overscanCount, current.capacity);
|
|
73
|
+
const committedRevision = useRef(current.revision);
|
|
74
|
+
useLayoutEffect(()=>{
|
|
75
|
+
committedRevision.current = current.revision;
|
|
76
|
+
}, [
|
|
77
|
+
current.revision
|
|
78
|
+
]);
|
|
79
|
+
const rows = getSlotIndices(start, capacity).map((index, slot)=>{
|
|
80
|
+
const item = data[index];
|
|
81
|
+
const itemKey = itemKeys[index];
|
|
82
|
+
if (item === undefined || itemKey === undefined) {
|
|
83
|
+
throw new Error(`${componentName} could not resolve the item at index ${index}.`);
|
|
84
|
+
}
|
|
85
|
+
return /*#__PURE__*/ _jsx(RecycledRow, {
|
|
86
|
+
Slot: Slot,
|
|
87
|
+
item: item,
|
|
88
|
+
index: index,
|
|
89
|
+
itemKey: itemKey,
|
|
90
|
+
revision: current.revision,
|
|
91
|
+
renderItem: renderItem
|
|
92
|
+
}, slot);
|
|
93
|
+
});
|
|
94
|
+
return {
|
|
95
|
+
itemKeys,
|
|
96
|
+
revision: current.revision,
|
|
97
|
+
rows,
|
|
98
|
+
isCurrentRevision: (revision)=>revision === committedRevision.current,
|
|
99
|
+
onWindowChange: (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
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
//# sourceMappingURL=useRecycledRows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["recycling/useRecycledRows.tsx"],"sourcesContent":[null],"names":["memo","useLayoutEffect","useMemo","useRef","useState","getSlotIndices","getWindow","RecycledRow","Slot","item","index","itemKey","revision","renderItem","useItemKeys","componentName","data","keyExtractor","keyExtractorRef","current","keys","map","some","key","Set","size","length","Error","useRecycledRows","overscanCount","estimatedItemSize","Number","isSafeInteger","isFinite","itemKeys","state","setState","first","last","capacity","previousKey","anchor","undefined","Math","max","indexOf","min","start","committedRevision","rows","slot","isCurrentRevision","onWindowChange","event","previous","maximum"],"mappings":";AAAA,SACEA,IAAI,EACJC,eAAe,EACfC,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|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["recycling/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"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ReactElement } from 'react';
|
|
2
|
+
import { type RecycledSlotProps } from '../../recycling/useRecycledRows';
|
|
2
3
|
import { type CommonViewModifierProps } from '../types';
|
|
3
4
|
export interface ListForEachProps<ItemT> extends CommonViewModifierProps {
|
|
4
5
|
/** Called with deleted indices from this group's `data` array. */
|
|
@@ -42,18 +43,10 @@ export interface ListForEachProps<ItemT> extends CommonViewModifierProps {
|
|
|
42
43
|
*/
|
|
43
44
|
estimatedItemSize?: number;
|
|
44
45
|
}
|
|
45
|
-
|
|
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[];
|
|
46
|
+
export declare const NativeSlot: import("react").ComponentType<RecycledSlotProps>;
|
|
53
47
|
/**
|
|
54
48
|
* Renders a window of recycled rows inside List or Section.
|
|
55
49
|
* Rows show placeholders while JS prepares content. Native keys still cover the full data set.
|
|
56
50
|
* @platform ios
|
|
57
51
|
*/
|
|
58
52
|
export declare function DataListForEach<ItemT>({ data, keyExtractor, children: renderItem, overscanCount, estimatedItemSize, modifiers, onDelete, onMove, ...props }: ListForEachProps<ItemT>): import("react").JSX.Element;
|
|
59
|
-
export {};
|
|
@@ -1,84 +1,24 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { requireNativeView } from 'expo';
|
|
3
|
-
import {
|
|
3
|
+
import { useRecycledRows } from '../../recycling/useRecycledRows';
|
|
4
4
|
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
5
|
-
import { getSlotIndices, getWindow } from './window';
|
|
6
5
|
const NativeList = requireNativeView('ExpoUI', 'DataListForEachView');
|
|
7
6
|
export const NativeSlot = requireNativeView('ExpoUI', 'DataListForEachItemView');
|
|
8
7
|
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
8
|
/**
|
|
35
9
|
* Renders a window of recycled rows inside List or Section.
|
|
36
10
|
* Rows show placeholders while JS prepares content. Native keys still cover the full data set.
|
|
37
11
|
* @platform ios
|
|
38
|
-
*/ export function DataListForEach({ data, keyExtractor, children: renderItem, overscanCount
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
keys: itemKeys,
|
|
48
|
-
first: 0,
|
|
49
|
-
last: 0,
|
|
50
|
-
revision: 0,
|
|
51
|
-
capacity: 0,
|
|
52
|
-
overscanCount
|
|
12
|
+
*/ export function DataListForEach({ data, keyExtractor, children: renderItem, overscanCount, estimatedItemSize = 64, modifiers, onDelete, onMove, ...props }) {
|
|
13
|
+
const { itemKeys, revision, rows, onWindowChange, isCurrentRevision } = useRecycledRows({
|
|
14
|
+
componentName: 'List.ForEach',
|
|
15
|
+
Slot: NativeSlot,
|
|
16
|
+
data,
|
|
17
|
+
keyExtractor,
|
|
18
|
+
renderItem,
|
|
19
|
+
overscanCount,
|
|
20
|
+
estimatedItemSize
|
|
53
21
|
});
|
|
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
22
|
return /*#__PURE__*/ _jsx(NativeList, {
|
|
83
23
|
...props,
|
|
84
24
|
modifiers: modifiers,
|
|
@@ -86,50 +26,19 @@ export function useItemKeys(data, keyExtractor) {
|
|
|
86
26
|
deleteEnabled: !!onDelete,
|
|
87
27
|
moveEnabled: !!onMove,
|
|
88
28
|
onDelete: onDelete ? ({ nativeEvent })=>{
|
|
89
|
-
if (nativeEvent.revision
|
|
29
|
+
if (isCurrentRevision(nativeEvent.revision)) onDelete(nativeEvent.indices);
|
|
90
30
|
} : undefined,
|
|
91
31
|
onMove: onMove ? ({ nativeEvent })=>{
|
|
92
|
-
if (nativeEvent.revision
|
|
32
|
+
if (isCurrentRevision(nativeEvent.revision)) {
|
|
93
33
|
onMove(nativeEvent.sourceIndices, nativeEvent.destination);
|
|
94
34
|
}
|
|
95
35
|
} : undefined,
|
|
96
36
|
itemKeys: itemKeys,
|
|
97
|
-
revision:
|
|
37
|
+
revision: revision,
|
|
98
38
|
estimatedItemSize: estimatedItemSize,
|
|
99
|
-
onWindowChange: ({ nativeEvent
|
|
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
|
-
},
|
|
39
|
+
onWindowChange: ({ nativeEvent })=>onWindowChange(nativeEvent),
|
|
118
40
|
children: /*#__PURE__*/ _jsx(NativePool, {
|
|
119
|
-
children:
|
|
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
|
-
})
|
|
41
|
+
children: rows
|
|
133
42
|
})
|
|
134
43
|
});
|
|
135
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["swift-ui/List/DataListForEach.tsx"],"sourcesContent":[null],"names":["requireNativeView","
|
|
1
|
+
{"version":3,"sources":["swift-ui/List/DataListForEach.tsx"],"sourcesContent":[null],"names":["requireNativeView","useRecycledRows","createViewModifierEventListener","NativeList","NativeSlot","NativePool","DataListForEach","data","keyExtractor","children","renderItem","overscanCount","estimatedItemSize","modifiers","onDelete","onMove","props","itemKeys","revision","rows","onWindowChange","isCurrentRevision","componentName","Slot","undefined","deleteEnabled","moveEnabled","nativeEvent","indices","sourceIndices","destination"],"mappings":";AAAA,SAASA,iBAAiB,QAAQ,OAAO;AAGzC,SACEC,eAAe,QAGV,kCAAkC;AAEzC,SAASC,+BAA+B,QAAQ,qBAAqB;AAuDrE,MAAMC,aAAaH,kBAA+B,UAAU;AAC5D,OAAO,MAAMI,aAAaJ,kBAAqC,UAAU,2BAA2B;AACpG,MAAMK,aAAaL,kBACjB,UACA;AAGF;;;;CAIC,GACD,OAAO,SAASM,gBAAuB,EACrCC,IAAI,EACJC,YAAY,EACZC,UAAUC,UAAU,EACpBC,aAAa,EACbC,oBAAoB,EAAE,EACtBC,SAAS,EACTC,QAAQ,EACRC,MAAM,EACN,GAAGC,OACqB;IACxB,MAAM,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,IAAI,EAAEC,cAAc,EAAEC,iBAAiB,EAAE,GAAGpB,gBAAgB;QACtFqB,eAAe;QACfC,MAAMnB;QACNG;QACAC;QACAE;QACAC;QACAC;IACF;IAEA,qBACE,KAACT;QACE,GAAGa,KAAK;QACTH,WAAWA;QACV,GAAIA,YAAYX,gCAAgCW,aAAaW,SAAS;QACvEC,eAAe,CAAC,CAACX;QACjBY,aAAa,CAAC,CAACX;QACfD,UACEA,WACI,CAAC,EAAEa,WAAW,EAAE;YACd,IAAIN,kBAAkBM,YAAYT,QAAQ,GAAGJ,SAASa,YAAYC,OAAO;QAC3E,IACAJ;QAENT,QACEA,SACI,CAAC,EAAEY,WAAW,EAAE;YACd,IAAIN,kBAAkBM,YAAYT,QAAQ,GAAG;gBAC3CH,OAAOY,YAAYE,aAAa,EAAEF,YAAYG,WAAW;YAC3D;QACF,IACAN;QAENP,UAAUA;QACVC,UAAUA;QACVN,mBAAmBA;QACnBQ,gBAAgB,CAAC,EAAEO,WAAW,EAAE,GAAKP,eAAeO;kBACpD,cAAA,KAACtB;sBAAYc;;;AAGnB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { requireNativeView } from 'expo';
|
|
3
|
-
import {
|
|
3
|
+
import { useItemKeys } from '../../recycling/useRecycledRows';
|
|
4
|
+
import { DataListForEach, NativeSlot } from './DataListForEach';
|
|
4
5
|
const ListForEachNativeView = requireNativeView('ExpoUI', 'ListForEachView');
|
|
5
6
|
let warnedElements = false;
|
|
6
7
|
/**
|
|
@@ -35,7 +36,7 @@ function ChildrenListForEach({ children, onDelete, onMove, ...props }) {
|
|
|
35
36
|
});
|
|
36
37
|
}
|
|
37
38
|
function StaticListForEach({ data, keyExtractor, children: renderItem, overscanCount: _overscanCount, estimatedItemSize: _estimatedItemSize, ...props }) {
|
|
38
|
-
const itemKeys = useItemKeys(data, keyExtractor);
|
|
39
|
+
const itemKeys = useItemKeys('List.ForEach', data, keyExtractor);
|
|
39
40
|
return /*#__PURE__*/ _jsx(ChildrenListForEach, {
|
|
40
41
|
...props,
|
|
41
42
|
children: data.map((item, index)=>/*#__PURE__*/ _jsx(NativeSlot, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["swift-ui/List/ListForEach.tsx"],"sourcesContent":[null],"names":["requireNativeView","
|
|
1
|
+
{"version":3,"sources":["swift-ui/List/ListForEach.tsx"],"sourcesContent":[null],"names":["requireNativeView","useItemKeys","DataListForEach","NativeSlot","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,OAAO;AAEzC,SAASC,WAAW,QAAQ,kCAAkC;AAG9D,SAASC,eAAe,EAAEC,UAAU,QAA+B,oBAAoB;AAIvF,MAAMC,wBACJJ,kBAA0C,UAAU;AAyCtD,IAAIK,iBAAiB;AAErB;;;;CAIC,GACD,OAAO,SAASC,YAAmBC,KAAyD;IAC1F,IAAIA,MAAMC,IAAI,KAAKC,WAAW;QAC5B,IAAIC,WAAW,CAACL,gBAAgB;YAC9BA,iBAAiB;YACjBM,QAAQC,IAAI,CACV;QAEJ;QACA,qBAAO,KAACC;YAAqB,GAAGN,KAAK;;IACvC;IACA,MAAM,EAAEO,YAAY,IAAI,EAAE,GAAGC,MAAM,GAAGR;IACtC,OAAOO,0BAAY,KAACZ;QAAiB,GAAGa,IAAI;uBAAO,KAACC;QAAmB,GAAGD,IAAI;;AAChF;AAEA,SAASF,oBAAoB,EAAEI,QAAQ,EAAEC,QAAQ,EAAEC,MAAM,EAAE,GAAGZ,OAAiC;IAC7F,qBACE,KAACH;QACE,GAAGG,KAAK;QACTa,eAAe,CAAC,CAACF;QACjBG,aAAa,CAAC,CAACF;QACfD,UAAUA,WAAW,CAAC,EAAEI,WAAW,EAAE,GAAKJ,SAASI,YAAYC,OAAO,IAAId;QAC1EU,QACEA,SACI,CAAC,EAAEG,WAAW,EAAE,GAAKH,OAAOG,YAAYE,aAAa,EAAEF,YAAYG,WAAW,IAC9EhB;kBAELQ;;AAGP;AAEA,SAASD,kBAAyB,EAChCR,IAAI,EACJkB,YAAY,EACZT,UAAUU,UAAU,EACpBC,eAAeC,cAAc,EAC7BC,mBAAmBC,kBAAkB,EACrC,GAAGxB,OACwC;IAC3C,MAAMyB,WAAW/B,YAAY,gBAAgBO,MAAMkB;IACnD,qBACE,KAACb;QAAqB,GAAGN,KAAK;kBAC3BC,KAAKyB,GAAG,CAAC,CAACC,MAAMC,sBACf,KAAChC;gBAAiCiC,SAASJ,QAAQ,CAACG,MAAM;gBAAGA,OAAOA;gBAAOE,UAAU;0BAClFV,WAAW;oBAAEO;oBAAMC;gBAAM;eADXH,QAAQ,CAACG,MAAM;;AAMxC"}
|
|
@@ -77,7 +77,11 @@ 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
|
-
|
|
80
|
+
/**
|
|
81
|
+
* The alignment of a view inside the frame that `frame()` creates.
|
|
82
|
+
* Most values have no visible effect when the frame is the same size as the view.
|
|
83
|
+
*/
|
|
84
|
+
export type FrameAlignment = 'center' | 'leading' | 'trailing' | 'top' | 'bottom' | 'topLeading' | 'topTrailing' | 'bottomLeading' | 'bottomTrailing';
|
|
81
85
|
/**
|
|
82
86
|
* Positions this view within an invisible frame with the specified size.
|
|
83
87
|
* @param params - The fixed frame parameters: `width`, `height` and `alignment`.
|