@expo/ui 58.0.6 → 58.0.7
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 +12 -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/RNHostView.kt +18 -4
- 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/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/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/transformStyle.ios.js +4 -3
- package/build/universal/transformStyle.ios.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.7/expo.modules.ui-58.0.7-sources.jar} +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.7/expo.modules.ui-58.0.7-sources.jar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.7/expo.modules.ui-58.0.7-sources.jar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.7/expo.modules.ui-58.0.7-sources.jar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.7/expo.modules.ui-58.0.7-sources.jar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.7/expo.modules.ui-58.0.7.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.7/expo.modules.ui-58.0.7.aar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.7/expo.modules.ui-58.0.7.aar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.7/expo.modules.ui-58.0.7.aar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.7/expo.modules.ui-58.0.7.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.7/expo.modules.ui-58.0.7.module} +23 -23
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.7/expo.modules.ui-58.0.7.module.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.7/expo.modules.ui-58.0.7.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.7/expo.modules.ui-58.0.7.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.7/expo.modules.ui-58.0.7.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.7/expo.modules.ui-58.0.7.pom} +2 -2
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.7/expo.modules.ui-58.0.7.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.7/expo.modules.ui-58.0.7.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.7/expo.modules.ui-58.0.7.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.7/expo.modules.ui-58.0.7.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/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/presentationModifiers.ts +10 -0
- package/src/universal/transformStyle.ios.ts +5 -2
- 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
|
@@ -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,OAAO,EACPC,MAAM,EACNC,QAAQ,QAGH,QAAQ;AAEf,SAASC,cAAc,EAAEC,SAAS,QAAQ,WAAW;AAsBrD,6CAA6C;AAC7C,MAAMC,4BAAcP,KAAK,SAASO,YAAmB,EACnDC,IAAI,EACJC,IAAI,EACJC,KAAK,EACLC,OAAO,EACPC,QAAQ,EACRC,UAAU,EACc;IACxB,qBACE,KAACL;QAAKG,SAASA;QAASD,OAAOA;QAAOE,UAAUA;kBAC7CC,WAAW;YAAEJ;YAAMC;QAAM;;AAGhC;AAeA;;;CAGC,GACD,OAAO,SAASI,YACdC,aAAqB,EACrBC,IAAsB,EACtBC,YAAoD;IAEpD,MAAMC,kBAAkBf,OAAOc;IAC/BC,gBAAgBC,OAAO,GAAGF;IAC1B,OAAOf,QAAQ;QACb,MAAMkB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,MAAMf,IAAI,GAAGe,MAAMhB,KAAK,EACxB;gBACA;YACF;YACAD,SAAS,CAACkB;gBACR,6CAA6C;gBAC7C,IAAID,MAAMzC,QAAQ,KAAK0C,SAAS1C,QAAQ,EAAE,OAAO0C;gBACjD,MAAMC,UAAUZ,KAAKC,GAAG,CAAC,GAAGU,SAASlC,IAAI,CAACM,MAAM,GAAG;gBACnD,MAAMW,QAAQM,KAAKC,GAAG,CAAC,GAAGD,KAAKG,GAAG,CAACO,MAAMhB,KAAK,EAAEkB;gBAChD,MAAMjB,OAAOK,KAAKC,GAAG,CAACP,OAAOM,KAAKG,GAAG,CAACO,MAAMf,IAAI,EAAEiB;gBAClD,MAAM,EAAEhB,QAAQ,EAAE,GAAGjC,UACnBgD,SAASlC,IAAI,CAACM,MAAM,EACpBW,OACAC,MACAgB,SAASzB,aAAa,EACtByB,SAASf,QAAQ;gBAEnB,OAAOF,UAAUiB,SAASjB,KAAK,IAAIC,SAASgB,SAAShB,IAAI,IAAIC,aAAae,SAASf,QAAQ,GACvFe,WACA;oBAAE,GAAGA,QAAQ;oBAAEjB;oBAAOC;oBAAMC;gBAAS;YAC3C;QACF;IACF;AACF"}
|
|
@@ -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"}
|
|
@@ -34,6 +34,14 @@ export declare const presentationDetents: (detents: PresentationDetent[], option
|
|
|
34
34
|
* @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/presentationdragindicator(_:)).
|
|
35
35
|
*/
|
|
36
36
|
export declare const presentationDragIndicator: (visibility: "automatic" | "visible" | "hidden") => ModifierConfig;
|
|
37
|
+
/**
|
|
38
|
+
* Sets the corner radius of a sheet presentation.
|
|
39
|
+
* @param cornerRadius - The corner radius in points, or `null` to use the system default.
|
|
40
|
+
* @platform ios 16.4+
|
|
41
|
+
* @platform tvos 16.4+
|
|
42
|
+
* @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/presentationcornerradius(_:)).
|
|
43
|
+
*/
|
|
44
|
+
export declare const presentationCornerRadius: (cornerRadius: number | null) => ModifierConfig;
|
|
37
45
|
/**
|
|
38
46
|
* Presentation background interaction type.
|
|
39
47
|
*/
|
|
@@ -31,6 +31,15 @@ import { resolveShapeStyle } from './shapeStyle';
|
|
|
31
31
|
*/ export const presentationDragIndicator = (visibility)=>createModifier('presentationDragIndicator', {
|
|
32
32
|
visibility
|
|
33
33
|
});
|
|
34
|
+
/**
|
|
35
|
+
* Sets the corner radius of a sheet presentation.
|
|
36
|
+
* @param cornerRadius - The corner radius in points, or `null` to use the system default.
|
|
37
|
+
* @platform ios 16.4+
|
|
38
|
+
* @platform tvos 16.4+
|
|
39
|
+
* @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/presentationcornerradius(_:)).
|
|
40
|
+
*/ export const presentationCornerRadius = (cornerRadius)=>createModifier('presentationCornerRadius', {
|
|
41
|
+
cornerRadius
|
|
42
|
+
});
|
|
34
43
|
/**
|
|
35
44
|
* Controls interaction with the content behind a sheet.
|
|
36
45
|
* @param interaction - The background interaction behavior.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["swift-ui/modifiers/presentationModifiers.ts"],"sourcesContent":[null],"names":["createModifier","createModifierWithEventListener","resolveShapeStyle","presentationDetents","detents","options","params","selection","onSelectionChange","args","detent","presentationDragIndicator","visibility","presentationBackgroundInteraction","interaction","interactionType","presentationBackground","style","interactiveDismissDisabled","isDisabled","presentationSizing","sizing"],"mappings":"AAAA,SACEA,cAAc,EACdC,+BAA+B,QAE1B,mBAAmB;AAC1B,SAASC,iBAAiB,QAAyB,eAAe;AAWlE;;;;;;;;;CASC,GACD,OAAO,MAAMC,sBAAsB,CACjCC,SACAC;IAKA,MAAMC,SAAS;QAAEF;QAASG,WAAWF,SAASE;IAAU;IAExD,MAAM,EAAEC,iBAAiB,EAAE,GAAGH,WAAW,CAAC;IAC1C,IAAIG,mBAAmB;QACrB,OAAOP,gCACL,uBACA,CAACQ;YACCD,kBAAkBC,KAAKC,MAAM;QAC/B,GACAJ;IAEJ;IAEA,OAAON,eAAe,uBAAuBM;AAC/C,EAAE;AAEF;;;;;;CAMC,GACD,OAAO,MAAMK,4BAA4B,CAACC,aACxCZ,eAAe,6BAA6B;QAAEY;IAAW,GAAG;
|
|
1
|
+
{"version":3,"sources":["swift-ui/modifiers/presentationModifiers.ts"],"sourcesContent":[null],"names":["createModifier","createModifierWithEventListener","resolveShapeStyle","presentationDetents","detents","options","params","selection","onSelectionChange","args","detent","presentationDragIndicator","visibility","presentationCornerRadius","cornerRadius","presentationBackgroundInteraction","interaction","interactionType","presentationBackground","style","interactiveDismissDisabled","isDisabled","presentationSizing","sizing"],"mappings":"AAAA,SACEA,cAAc,EACdC,+BAA+B,QAE1B,mBAAmB;AAC1B,SAASC,iBAAiB,QAAyB,eAAe;AAWlE;;;;;;;;;CASC,GACD,OAAO,MAAMC,sBAAsB,CACjCC,SACAC;IAKA,MAAMC,SAAS;QAAEF;QAASG,WAAWF,SAASE;IAAU;IAExD,MAAM,EAAEC,iBAAiB,EAAE,GAAGH,WAAW,CAAC;IAC1C,IAAIG,mBAAmB;QACrB,OAAOP,gCACL,uBACA,CAACQ;YACCD,kBAAkBC,KAAKC,MAAM;QAC/B,GACAJ;IAEJ;IAEA,OAAON,eAAe,uBAAuBM;AAC/C,EAAE;AAEF;;;;;;CAMC,GACD,OAAO,MAAMK,4BAA4B,CAACC,aACxCZ,eAAe,6BAA6B;QAAEY;IAAW,GAAG;AAE9D;;;;;;CAMC,GACD,OAAO,MAAMC,2BAA2B,CAACC,eACvCd,eAAe,4BAA4B;QAAEc;IAAa,GAAG;AAW/D;;;;;;CAMC,GACD,OAAO,MAAMC,oCAAoC,CAC/CC;IAEA,IAAI,OAAOA,gBAAgB,UAAU;QACnC,OAAOhB,eAAe,qCAAqC;YAAEiB,iBAAiBD;QAAY;IAC5F;IACA,OAAOhB,eAAe,qCAAqC;QACzDiB,iBAAiB;QACjBP,QAAQM,YAAYN,MAAM;IAC5B;AACF,EAAE;AAEF;;;;;;;;;;;CAWC,GACD,OAAO,MAAMQ,yBAAyB,CAACC,QACrCnB,eAAe,0BAA0B;QAAEmB,OAAOjB,kBAAkBiB;IAAO,GAAG;AAEhF;;;;CAIC,GACD,OAAO,MAAMC,6BAA6B,CAACC,aAAsB,IAAI,GACnErB,eAAe,8BAA8B;QAAEqB;IAAW,GAAG;AAc/D;;;;;;CAMC,GACD,OAAO,MAAMC,qBAAqB,CAACC,SACjCvB,eAAe,sBAAsB;QAAEuB;IAAO,GAAG"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { background, border, clipShape, disabled as disabledMod, font, foregroundStyle, frame, hidden as hiddenMod, kerning, lineSpacing, multilineTextAlignment, onAppear, onDisappear, onTapGesture, opacity, padding } from '@expo/ui/swift-ui/modifiers';
|
|
1
|
+
import { background, border, clipShape, contentShape, disabled as disabledMod, font, foregroundStyle, frame, hidden as hiddenMod, kerning, lineSpacing, multilineTextAlignment, onAppear, onDisappear, onTapGesture, opacity, padding, shapes } from '@expo/ui/swift-ui/modifiers';
|
|
2
2
|
import { omitUserOverridden } from './modifierUtils';
|
|
3
3
|
const FONT_WEIGHT_MAP = {
|
|
4
4
|
'100': 'ultraLight',
|
|
@@ -93,8 +93,9 @@ const FONT_WEIGHT_MAP = {
|
|
|
93
93
|
// A user-supplied modifier replaces any style-derived modifier of the same
|
|
94
94
|
// type. The event, lifecycle, and behavior modifiers below are never dropped.
|
|
95
95
|
mods = omitUserOverridden(mods, extraModifiers);
|
|
96
|
-
// Events
|
|
97
|
-
|
|
96
|
+
// Events. SwiftUI only hit-tests drawn content, so the `contentShape` lets
|
|
97
|
+
// taps on empty space (for example a `Spacer` in a `Row`) reach `onPress`.
|
|
98
|
+
if (props.onPress) mods.push(contentShape(shapes.rectangle()), onTapGesture(props.onPress));
|
|
98
99
|
// Lifecycle
|
|
99
100
|
if (props.onAppear) mods.push(onAppear(props.onAppear));
|
|
100
101
|
if (props.onDisappear) mods.push(onDisappear(props.onDisappear));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["universal/transformStyle.ios.ts"],"sourcesContent":[null],"names":["background","border","clipShape","disabled","disabledMod","font","foregroundStyle","frame","hidden","hiddenMod","kerning","lineSpacing","multilineTextAlignment","onAppear","onDisappear","onTapGesture","opacity","padding","omitUserOverridden","FONT_WEIGHT_MAP","normal","bold","transformToModifiers","style","props","extraModifiers","options","mods","textStyle","fontFamily","fontSize","fontWeight","push","family","size","weight","undefined","color","letterSpacing","lineHeight","baseFontSize","Math","max","textAlign","hasPadding","paddingHorizontal","paddingVertical","paddingTop","paddingBottom","paddingLeft","paddingRight","all","horizontal","vertical","top","bottom","leading","trailing","width","height","alignment","frameAlignment","backgroundColor","borderWidth","borderColor","content","borderRadius","onPress"],"mappings":"AAAA,SACEA,UAAU,EACVC,MAAM,EACNC,SAAS,EACTC,YAAYC,WAAW,EACvBC,IAAI,EACJC,eAAe,EACfC,KAAK,EACLC,UAAUC,SAAS,EACnBC,OAAO,EACPC,WAAW,EACXC,sBAAsB,EACtBC,QAAQ,EACRC,WAAW,EACXC,YAAY,EACZC,OAAO,EACPC,OAAO,
|
|
1
|
+
{"version":3,"sources":["universal/transformStyle.ios.ts"],"sourcesContent":[null],"names":["background","border","clipShape","contentShape","disabled","disabledMod","font","foregroundStyle","frame","hidden","hiddenMod","kerning","lineSpacing","multilineTextAlignment","onAppear","onDisappear","onTapGesture","opacity","padding","shapes","omitUserOverridden","FONT_WEIGHT_MAP","normal","bold","transformToModifiers","style","props","extraModifiers","options","mods","textStyle","fontFamily","fontSize","fontWeight","push","family","size","weight","undefined","color","letterSpacing","lineHeight","baseFontSize","Math","max","textAlign","hasPadding","paddingHorizontal","paddingVertical","paddingTop","paddingBottom","paddingLeft","paddingRight","all","horizontal","vertical","top","bottom","leading","trailing","width","height","alignment","frameAlignment","backgroundColor","borderWidth","borderColor","content","borderRadius","onPress","rectangle"],"mappings":"AAAA,SACEA,UAAU,EACVC,MAAM,EACNC,SAAS,EACTC,YAAY,EACZC,YAAYC,WAAW,EACvBC,IAAI,EACJC,eAAe,EACfC,KAAK,EACLC,UAAUC,SAAS,EACnBC,OAAO,EACPC,WAAW,EACXC,sBAAsB,EACtBC,QAAQ,EACRC,WAAW,EACXC,YAAY,EACZC,OAAO,EACPC,OAAO,EACPC,MAAM,QAED,8BAA8B;AAGrC,SAASC,kBAAkB,QAAQ,kBAAkB;AAGrD,MAAMC,kBAAwE;IAC5E,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACPC,QAAQ;IACRC,MAAM;AACR;AAEA;;;;;;;;;;;CAWC,GACD,OAAO,SAASC,qBACdC,KAAiC,EACjCC,KAGC,EACDC,cAAiC,EACjCC,OAKC;IAED,IAAIC,OAAyB,EAAE;IAE/B,gFAAgF;IAChF,MAAMC,YAAYF,SAASE;IAC3B,IAAIA,WAAW;QACb,IACEA,UAAUC,UAAU,IAAI,QACxBD,UAAUE,QAAQ,IAAI,QACtBF,UAAUG,UAAU,IAAI,MACxB;YACAJ,KAAKK,IAAI,CACP5B,KAAK;gBACH6B,QAAQL,UAAUC,UAAU;gBAC5BK,MAAMN,UAAUE,QAAQ;gBACxBK,QAAQP,UAAUG,UAAU,GAAGZ,eAAe,CAACS,UAAUG,UAAU,CAAC,GAAGK;YACzE;QAEJ;QACA,IAAIR,UAAUS,KAAK,IAAI,MAAMV,KAAKK,IAAI,CAAC3B,gBAAgBuB,UA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ct PresentationDragIndicatorModifier: ViewModifier, Record {
|
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
+
// MARK: - Presentation Corner Radius
|
|
164
|
+
|
|
165
|
+
internal struct PresentationCornerRadiusModifier: ViewModifier, Record {
|
|
166
|
+
@Field var cornerRadius: Double?
|
|
167
|
+
|
|
168
|
+
func body(content: Content) -> some View {
|
|
169
|
+
content.presentationCornerRadius(cornerRadius.map { CGFloat($0) })
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
163
173
|
// MARK: - Presentation Background Interaction
|
|
164
174
|
|
|
165
175
|
internal enum PresentationBackgroundInteractionTypeModifier: String, Enumerable {
|
|
@@ -2353,6 +2353,10 @@ extension ViewModifierRegistry {
|
|
|
2353
2353
|
return try PresentationDragIndicatorModifier(from: params, appContext: appContext)
|
|
2354
2354
|
}
|
|
2355
2355
|
|
|
2356
|
+
register("presentationCornerRadius") { params, appContext, _ in
|
|
2357
|
+
return try PresentationCornerRadiusModifier(from: params, appContext: appContext)
|
|
2358
|
+
}
|
|
2359
|
+
|
|
2356
2360
|
register("presentationBackgroundInteraction") { params, appContext, _ in
|
|
2357
2361
|
return try PresentationBackgroundInteractionModifier(from: params, appContext: appContext)
|
|
2358
2362
|
}
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
bbdad22fa84c26c5a5b649ed116f1fcb
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
21cb93383a49b039772df3cbd1a14c3cd821886c
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
5645728c21cb9bd3183045c4208434114a1372ed0a367dadc545a2555294748b
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
c1f94d22a03f47ec553960cf5a44936e26992755aebc5f3583484c41ee224f9637620571022ae95f0687e5701632d93a1752f817dca5923b07aa10a2697c4776
|
|
Binary file
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.7/expo.modules.ui-58.0.7.aar.md5
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
b4a6d6acd9603febf32c95c833b1405f
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.7/expo.modules.ui-58.0.7.aar.sha1
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
955cc1dcde621dc0ad9d70588bff46adfedc1129
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.7/expo.modules.ui-58.0.7.aar.sha256
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
db4b84c7879a230cb83fb791d8f9a8f86a282f5c93751bc267dd8a648ed141af
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.7/expo.modules.ui-58.0.7.aar.sha512
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
58f2fa2376432db80f54bf406250ceb0c07fd16f2dd693dcb9aa784c078a18e5044bd224896e2112237b52f6169eeda86f3cfa4edae36be61fec24ffaa6ea1ac
|