@onekeyfe/react-native-native-list 3.0.158 → 3.0.159
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -5
- package/android/build.gradle +7 -0
- package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +20 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +711 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListActionRenderer.kt +169 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +179 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +264 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListAdapter.kt +20 -6
- package/android/src/main/java/com/onekey/nativelist/NativeListContainerSlotAdapter.kt +53 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +487 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListEndAlignment.kt +5 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +820 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListImageSlot.kt +147 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +453 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListMarketRenderer.kt +997 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListMediaPreviewSlot.kt +268 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListMediaTileRenderer.kt +243 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +232 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListMetricCardRenderer.kt +551 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +27 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +475 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRailRenderer.kt +143 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRegistry.kt +42 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +415 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +163 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRowHost.kt +70 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListScrollPositionTracker.kt +59 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +763 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListSystemRenderer.kt +464 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListTextView.kt +25 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +432 -124
- package/android/src/main/java/com/onekey/nativelist/NativeListWalletGroupRenderer.kt +407 -0
- package/android/src/main/res/values/native_scroll_coordinator_ids.xml +5 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListEndAlignmentTest.kt +34 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListScrollPositionTrackerTest.kt +44 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListSelectorBackgroundColorTest.kt +34 -0
- package/docs/DESIGN.md +520 -9
- package/docs/MIGRATION_BASELINE.md +117 -0
- package/docs/ROW_TEMPLATES.md +404 -0
- package/docs/SPEC.md +621 -0
- package/docs/STYLE_SPEC.md +988 -0
- package/docs/images/list-capabilities.svg +39 -0
- package/docs/images/row-action.svg +17 -0
- package/docs/images/row-activity.svg +24 -0
- package/docs/images/row-data.svg +24 -0
- package/docs/images/row-identity.svg +25 -0
- package/docs/images/row-market.svg +23 -0
- package/docs/images/row-media-tile.svg +26 -0
- package/docs/images/row-message.svg +20 -0
- package/docs/images/row-metric-card.svg +33 -0
- package/docs/images/row-rail.svg +18 -0
- package/docs/images/row-section-header.svg +19 -0
- package/docs/images/row-style-regions.svg +30 -0
- package/docs/images/row-system.svg +30 -0
- package/docs/images/row-wallet-group.svg +26 -0
- package/ios/HybridNativeList.swift +30 -0
- package/ios/NativeListAccessoryStack.swift +680 -0
- package/ios/NativeListActionRenderer.swift +108 -0
- package/ios/NativeListActivityDetailsView.swift +291 -0
- package/ios/NativeListActivityRenderer.swift +201 -0
- package/ios/NativeListDataRowRenderer.swift +444 -0
- package/ios/NativeListIdentityRenderer.swift +685 -0
- package/ios/NativeListImageSlot.swift +140 -0
- package/ios/NativeListLeadingVisual.swift +372 -0
- package/ios/NativeListMarketRenderer.swift +698 -0
- package/ios/NativeListMediaPreviewSlot.swift +259 -0
- package/ios/NativeListMediaTileRenderer.swift +190 -0
- package/ios/NativeListMessageRenderer.swift +168 -0
- package/ios/NativeListMetricCardRenderer.swift +420 -0
- package/ios/NativeListModels.swift +36 -1
- package/ios/NativeListRailRenderer.swift +152 -0
- package/ios/NativeListRendererCell.swift +311 -0
- package/ios/NativeListRendererRegistry.swift +50 -0
- package/ios/NativeListResolvedText.swift +130 -0
- package/ios/NativeListRowHost.swift +63 -0
- package/ios/NativeListScrollPositionTracker.swift +30 -0
- package/ios/NativeListSectionHeaderRenderer.swift +734 -0
- package/ios/NativeListSystemRenderer.swift +568 -0
- package/ios/NativeListTextLabel.swift +42 -0
- package/ios/NativeListTextStyles.swift +236 -0
- package/ios/NativeListWalletGroupRenderer.swift +255 -0
- package/ios/RNCNativeListView.swift +282 -184
- package/ios/tests/NativeListActivityPresentationTests.swift +97 -0
- package/ios/tests/NativeListLifecycleTests.swift +241 -0
- package/ios/tests/NativeListMediaVisibilityTests.swift +109 -0
- package/ios/tests/NativeListScrollPositionTrackerTests.swift +25 -0
- package/lib/module/NativeList.js +56 -3
- package/lib/module/NativeList.web.js +5 -0
- package/lib/module/models.js +54 -0
- package/lib/module/validation.js +386 -28
- package/lib/module/web/NativeListWebEngine.js +148 -936
- package/lib/module/web/templates/ActionRowRenderer.js +97 -0
- package/lib/module/web/templates/ActivityRowRenderer.js +95 -0
- package/lib/module/web/templates/DataRowRenderer.js +145 -0
- package/lib/module/web/templates/IdentityRowRenderer.js +289 -0
- package/lib/module/web/templates/MarketRowRenderer.js +310 -0
- package/lib/module/web/templates/MediaTileRowRenderer.js +132 -0
- package/lib/module/web/templates/MessageRowRenderer.js +165 -0
- package/lib/module/web/templates/MetricCardRowRenderer.js +172 -0
- package/lib/module/web/templates/RailRowRenderer.js +98 -0
- package/lib/module/web/templates/RowContainerStyle.js +100 -0
- package/lib/module/web/templates/RowElements.js +93 -0
- package/lib/module/web/templates/RowRendererRegistry.js +70 -0
- package/lib/module/web/templates/RowText.js +121 -0
- package/lib/module/web/templates/RowVisual.js +43 -0
- package/lib/module/web/templates/SectionHeaderRowRenderer.js +146 -0
- package/lib/module/web/templates/SystemRowRenderer.js +161 -0
- package/lib/module/web/templates/WalletGroupRowRenderer.js +96 -0
- package/lib/nitrogen/generated/android/c++/JFunc_void_bool.hpp +75 -0
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +39 -3
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +6 -0
- package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +15 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/Func_void_bool.kt +78 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +26 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/views/HybridNativeListManager.kt +24 -9
- package/lib/nitrogen/generated/android/nativelistOnLoad.cpp +2 -0
- package/lib/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Bridge.cpp +8 -0
- package/lib/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Bridge.hpp +37 -0
- package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +23 -2
- package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +32 -0
- package/lib/nitrogen/generated/ios/swift/Func_void_bool.swift +46 -0
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +3 -0
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +54 -0
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +6 -0
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +8 -2
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +6 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +11 -2
- package/lib/nitrogen/generated/shared/json/NativeListConfig.json +3 -0
- package/lib/typescript/src/NativeList.nitro.d.ts +3 -0
- package/lib/typescript/src/NativeList.types.d.ts +14 -1
- package/lib/typescript/src/models.d.ts +199 -18
- package/lib/typescript/src/web/NativeListWebEngine.d.ts +18 -16
- package/lib/typescript/src/web/templates/ActionRowRenderer.d.ts +15 -0
- package/lib/typescript/src/web/templates/ActivityRowRenderer.d.ts +15 -0
- package/lib/typescript/src/web/templates/DataRowRenderer.d.ts +15 -0
- package/lib/typescript/src/web/templates/IdentityRowRenderer.d.ts +16 -0
- package/lib/typescript/src/web/templates/MarketRowRenderer.d.ts +30 -0
- package/lib/typescript/src/web/templates/MediaTileRowRenderer.d.ts +15 -0
- package/lib/typescript/src/web/templates/MessageRowRenderer.d.ts +44 -0
- package/lib/typescript/src/web/templates/MetricCardRowRenderer.d.ts +15 -0
- package/lib/typescript/src/web/templates/RailRowRenderer.d.ts +28 -0
- package/lib/typescript/src/web/templates/RowContainerStyle.d.ts +9 -0
- package/lib/typescript/src/web/templates/RowElements.d.ts +38 -0
- package/lib/typescript/src/web/templates/RowRendererRegistry.d.ts +83 -0
- package/lib/typescript/src/web/templates/RowText.d.ts +9 -0
- package/lib/typescript/src/web/templates/RowVisual.d.ts +20 -0
- package/lib/typescript/src/web/templates/SectionHeaderRowRenderer.d.ts +15 -0
- package/lib/typescript/src/web/templates/SystemRowRenderer.d.ts +16 -0
- package/lib/typescript/src/web/templates/WalletGroupRowRenderer.d.ts +20 -0
- package/nitrogen/generated/android/c++/JFunc_void_bool.hpp +75 -0
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +39 -3
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +6 -0
- package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +15 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/Func_void_bool.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +26 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/views/HybridNativeListManager.kt +24 -9
- package/nitrogen/generated/android/nativelistOnLoad.cpp +2 -0
- package/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Bridge.cpp +8 -0
- package/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Bridge.hpp +37 -0
- package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +23 -2
- package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +32 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +3 -0
- package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +54 -0
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +6 -0
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +8 -2
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +6 -0
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +11 -2
- package/nitrogen/generated/shared/json/NativeListConfig.json +3 -0
- package/package.json +7 -6
- package/react-native-native-list.podspec +6 -0
- package/scripts/enable-container-slots.mjs +58 -0
- package/scripts/enable-container-slots.test.mjs +58 -0
- package/src/NativeList.nitro.ts +3 -0
- package/src/NativeList.tsx +84 -2
- package/src/NativeList.types.ts +14 -1
- package/src/NativeList.web.tsx +5 -0
- package/src/models.ts +320 -20
- package/src/validation.ts +641 -49
- package/src/web/NativeListWebEngine.ts +361 -1932
- package/src/web/templates/ActionRowRenderer.ts +123 -0
- package/src/web/templates/ActivityRowRenderer.ts +159 -0
- package/src/web/templates/DataRowRenderer.ts +212 -0
- package/src/web/templates/IdentityRowRenderer.ts +527 -0
- package/src/web/templates/MarketRowRenderer.ts +467 -0
- package/src/web/templates/MediaTileRowRenderer.ts +182 -0
- package/src/web/templates/MessageRowRenderer.ts +306 -0
- package/src/web/templates/MetricCardRowRenderer.ts +337 -0
- package/src/web/templates/RailRowRenderer.ts +136 -0
- package/src/web/templates/RowContainerStyle.ts +131 -0
- package/src/web/templates/RowElements.ts +160 -0
- package/src/web/templates/RowRendererRegistry.ts +111 -0
- package/src/web/templates/RowText.ts +181 -0
- package/src/web/templates/RowVisual.ts +115 -0
- package/src/web/templates/SectionHeaderRowRenderer.ts +243 -0
- package/src/web/templates/SystemRowRenderer.ts +282 -0
- package/src/web/templates/WalletGroupRowRenderer.ts +131 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRowView.kt +0 -4538
- package/ios/NativeListCell.swift +0 -4300
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { RailRow } from '../../models';
|
|
2
|
+
import type { RowPrimitives } from './RowVisual';
|
|
3
|
+
export declare function resolveRailRow(row: RailRow): {
|
|
4
|
+
horizontalPadding: number;
|
|
5
|
+
verticalPadding: number;
|
|
6
|
+
leadingGap: number;
|
|
7
|
+
badgeGap: number;
|
|
8
|
+
trailingGap: number;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
title: string;
|
|
12
|
+
badge: string;
|
|
13
|
+
status: string;
|
|
14
|
+
};
|
|
15
|
+
declare function bind(body: HTMLElement, row: RailRow, primitives: RowPrimitives): void;
|
|
16
|
+
declare function create(document: Document, row: RailRow, primitives: RowPrimitives): HTMLDivElement;
|
|
17
|
+
declare function recycle(body: HTMLElement): void;
|
|
18
|
+
export declare function measureRailWidth(row: RailRow): number;
|
|
19
|
+
export declare const railRowRenderer: {
|
|
20
|
+
key: "rail";
|
|
21
|
+
create: typeof create;
|
|
22
|
+
bind: typeof bind;
|
|
23
|
+
recycle: typeof recycle;
|
|
24
|
+
measure: (_row: RailRow, _width: number) => number;
|
|
25
|
+
measureRendered: (_body: HTMLElement, _row: RailRow) => number | undefined;
|
|
26
|
+
};
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=RailRowRenderer.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RowModel } from '../../models';
|
|
2
|
+
/**
|
|
3
|
+
* Undo the previous container pass before a renderer rebinds `body`, so the
|
|
4
|
+
* renderer always writes over its own baseline and the next
|
|
5
|
+
* `applyRowContainerStyle` records that fresh value as the value to restore.
|
|
6
|
+
*/
|
|
7
|
+
export declare function resetRowContainerStyle(body: HTMLElement): void;
|
|
8
|
+
export declare function applyRowContainerStyle(body: HTMLElement, row: RowModel): void;
|
|
9
|
+
//# sourceMappingURL=RowContainerStyle.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { NativeListActionSource } from '../../models';
|
|
2
|
+
export declare function createElement(document: Document, tag: string, className?: string, text?: string): HTMLElement;
|
|
3
|
+
export declare function setData(element: HTMLElement, name: string, value: string | number | boolean | undefined): void;
|
|
4
|
+
export declare function tagSlot<T extends HTMLElement>(element: T, slot: string): T;
|
|
5
|
+
export declare function markActionAnchorSource(element: HTMLElement, source: NativeListActionSource, slot?: number): void;
|
|
6
|
+
export declare function createTextColumn(document: Document, title: string, subtitle?: string, tertiary?: string, tertiaryTone?: 'secondary' | 'info', badges?: readonly Readonly<{
|
|
7
|
+
text: string;
|
|
8
|
+
tone?: string;
|
|
9
|
+
}>[], slots?: Readonly<{
|
|
10
|
+
title: string;
|
|
11
|
+
subtitle: string;
|
|
12
|
+
tertiary: string;
|
|
13
|
+
}>): HTMLElement;
|
|
14
|
+
export declare function createBadge(document: Document, badge: Readonly<{
|
|
15
|
+
text: string;
|
|
16
|
+
tone?: string;
|
|
17
|
+
}>): HTMLElement;
|
|
18
|
+
export declare function applyTabularNumbers(body: HTMLElement): void;
|
|
19
|
+
/**
|
|
20
|
+
* Selector presentations use their explicit-height geometry whenever the row
|
|
21
|
+
* has a resolved explicit height: the legacy `row.height` or the preferred
|
|
22
|
+
* `style.container.height`.
|
|
23
|
+
*/
|
|
24
|
+
export declare function hasExplicitRowHeight(row: Readonly<{
|
|
25
|
+
height?: number;
|
|
26
|
+
style?: Readonly<{
|
|
27
|
+
container?: Readonly<{
|
|
28
|
+
height?: number;
|
|
29
|
+
}>;
|
|
30
|
+
}>;
|
|
31
|
+
}>): boolean;
|
|
32
|
+
/** Legacy `size` preset adjustment, applied by templates that opt in. */
|
|
33
|
+
export declare function rowSizeModifier(size: string | undefined): number;
|
|
34
|
+
/** Captures factory inline styles of a template subtree. */
|
|
35
|
+
export declare function captureInlineStyles(root: HTMLElement): Map<HTMLElement, string>;
|
|
36
|
+
/** Restores captured factory styles while keeping image loading visibility. */
|
|
37
|
+
export declare function restoreInlineStyles(defaults: Map<HTMLElement, string>): void;
|
|
38
|
+
//# sourceMappingURL=RowElements.d.ts.map
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { RowModel } from '../../models';
|
|
2
|
+
export type RowRendererKey = RowModel['type'];
|
|
3
|
+
export declare function rowRenderer(row: RowModel): {
|
|
4
|
+
key: string;
|
|
5
|
+
appliesSizePreset: boolean;
|
|
6
|
+
create: (document: Document, primitives: Readonly<{
|
|
7
|
+
background: string;
|
|
8
|
+
icon: (element: HTMLElement, name: string) => void;
|
|
9
|
+
iconAction: (name: string, actionKey: string | undefined, disabled?: boolean, tintColor?: string) => HTMLElement;
|
|
10
|
+
accessory: (rowKey: string, descriptor: import("../..").TrailingAccessory, slot: number) => HTMLElement;
|
|
11
|
+
visual: (source: import("../..").LeadingVisual | undefined, presentation?: string) => HTMLElement | undefined;
|
|
12
|
+
thumbnail: (source: Readonly<{
|
|
13
|
+
uri: string;
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
headers?: Readonly<Record<string, string>>;
|
|
17
|
+
contentFit?: import("../..").ImageContentFit;
|
|
18
|
+
cachePolicy?: import("../..").ImageCachePolicy;
|
|
19
|
+
autoplay?: boolean;
|
|
20
|
+
optimizeTos?: boolean;
|
|
21
|
+
overscan?: number;
|
|
22
|
+
loadingStrategy?: import("../..").ImageLoadingStrategy;
|
|
23
|
+
fallbackUri?: string;
|
|
24
|
+
retryTimes?: number;
|
|
25
|
+
}>) => HTMLElement | undefined;
|
|
26
|
+
textStyle: (element: HTMLElement, style: Readonly<{
|
|
27
|
+
token?: import("../..").NativeListTypographyToken;
|
|
28
|
+
fontSize?: number;
|
|
29
|
+
fontWeight?: "regular" | "medium" | "semibold" | "bold";
|
|
30
|
+
color?: string;
|
|
31
|
+
lineHeight?: number;
|
|
32
|
+
lines?: 1 | 2 | 3;
|
|
33
|
+
truncate?: "tail" | "clip";
|
|
34
|
+
alignment?: "start" | "center" | "end";
|
|
35
|
+
verticalAlignment?: "top" | "center" | "bottom";
|
|
36
|
+
offsetY?: number;
|
|
37
|
+
}>, defaultLines?: number) => void;
|
|
38
|
+
dispose: (element: HTMLElement) => void;
|
|
39
|
+
}>) => HTMLElement;
|
|
40
|
+
bind: (body: HTMLElement, primitives: Readonly<{
|
|
41
|
+
background: string;
|
|
42
|
+
icon: (element: HTMLElement, name: string) => void;
|
|
43
|
+
iconAction: (name: string, actionKey: string | undefined, disabled?: boolean, tintColor?: string) => HTMLElement;
|
|
44
|
+
accessory: (rowKey: string, descriptor: import("../..").TrailingAccessory, slot: number) => HTMLElement;
|
|
45
|
+
visual: (source: import("../..").LeadingVisual | undefined, presentation?: string) => HTMLElement | undefined;
|
|
46
|
+
thumbnail: (source: Readonly<{
|
|
47
|
+
uri: string;
|
|
48
|
+
width: number;
|
|
49
|
+
height: number;
|
|
50
|
+
headers?: Readonly<Record<string, string>>;
|
|
51
|
+
contentFit?: import("../..").ImageContentFit;
|
|
52
|
+
cachePolicy?: import("../..").ImageCachePolicy;
|
|
53
|
+
autoplay?: boolean;
|
|
54
|
+
optimizeTos?: boolean;
|
|
55
|
+
overscan?: number;
|
|
56
|
+
loadingStrategy?: import("../..").ImageLoadingStrategy;
|
|
57
|
+
fallbackUri?: string;
|
|
58
|
+
retryTimes?: number;
|
|
59
|
+
}>) => HTMLElement | undefined;
|
|
60
|
+
textStyle: (element: HTMLElement, style: Readonly<{
|
|
61
|
+
token?: import("../..").NativeListTypographyToken;
|
|
62
|
+
fontSize?: number;
|
|
63
|
+
fontWeight?: "regular" | "medium" | "semibold" | "bold";
|
|
64
|
+
color?: string;
|
|
65
|
+
lineHeight?: number;
|
|
66
|
+
lines?: 1 | 2 | 3;
|
|
67
|
+
truncate?: "tail" | "clip";
|
|
68
|
+
alignment?: "start" | "center" | "end";
|
|
69
|
+
verticalAlignment?: "top" | "center" | "bottom";
|
|
70
|
+
offsetY?: number;
|
|
71
|
+
}>, defaultLines?: number) => void;
|
|
72
|
+
dispose: (element: HTMLElement) => void;
|
|
73
|
+
}>) => void;
|
|
74
|
+
measure: (width: number, layout?: string) => number;
|
|
75
|
+
measureRendered: (body: HTMLElement) => number | undefined;
|
|
76
|
+
reorderPreview: (body: HTMLElement) => {
|
|
77
|
+
element: HTMLElement;
|
|
78
|
+
height: number;
|
|
79
|
+
} | undefined;
|
|
80
|
+
};
|
|
81
|
+
export declare function rowRendererKey(row: RowModel): RowRendererKey;
|
|
82
|
+
export declare function recycleRowBody(body: HTMLElement): boolean;
|
|
83
|
+
//# sourceMappingURL=RowRendererRegistry.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { NativeListTextStyle } from '../../models';
|
|
2
|
+
export declare function applyValueSegments(element: HTMLElement, segments: readonly Readonly<{
|
|
3
|
+
text: string;
|
|
4
|
+
style?: 'subscript';
|
|
5
|
+
}>[] | undefined, fontSize?: number, lineHeight?: number, weight?: number): void;
|
|
6
|
+
export declare function applyTextLayout(element: HTMLElement, style: NativeListTextStyle, defaultLines?: number): void;
|
|
7
|
+
export declare function applyTextStyleToSlot(element: HTMLElement, style: NativeListTextStyle, defaultLines?: number): void;
|
|
8
|
+
export declare function fontWeight(value: NativeListTextStyle['fontWeight'] | undefined, fallback: number): number;
|
|
9
|
+
//# sourceMappingURL=RowText.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { TrailingAccessory, ImageSource, LeadingVisual, NativeListTextStyle, NativeListImageStyle } from '../../models';
|
|
2
|
+
export type RowPrimitives = Readonly<{
|
|
3
|
+
background: string;
|
|
4
|
+
icon: (element: HTMLElement, name: string) => void;
|
|
5
|
+
iconAction: (name: string, actionKey: string | undefined, disabled?: boolean, tintColor?: string) => HTMLElement;
|
|
6
|
+
accessory: (rowKey: string, descriptor: TrailingAccessory, slot: number) => HTMLElement;
|
|
7
|
+
visual: (source: LeadingVisual | undefined, presentation?: string) => HTMLElement | undefined;
|
|
8
|
+
thumbnail: (source: ImageSource) => HTMLElement | undefined;
|
|
9
|
+
textStyle: (element: HTMLElement, style: NativeListTextStyle, defaultLines?: number) => void;
|
|
10
|
+
dispose: (element: HTMLElement) => void;
|
|
11
|
+
}>;
|
|
12
|
+
/** Restores factory geometry without touching async loading visibility. */
|
|
13
|
+
export declare class RowVisualStyle {
|
|
14
|
+
private readonly view;
|
|
15
|
+
private readonly defaults;
|
|
16
|
+
constructor(view: HTMLElement);
|
|
17
|
+
restore(): void;
|
|
18
|
+
apply(image: NativeListImageStyle | undefined, width: number, height: number, margin: number): void;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=RowVisual.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SectionHeaderRow } from '../../models';
|
|
2
|
+
import type { RowPrimitives } from './RowVisual';
|
|
3
|
+
declare function bind(body: HTMLElement, row: SectionHeaderRow, primitives: RowPrimitives): void;
|
|
4
|
+
declare function create(document: Document, row: SectionHeaderRow, primitives: RowPrimitives): HTMLDivElement;
|
|
5
|
+
export declare const sectionHeaderRowRenderer: {
|
|
6
|
+
key: "sectionHeader";
|
|
7
|
+
create: typeof create;
|
|
8
|
+
bind: typeof bind;
|
|
9
|
+
recycle: (body: HTMLElement) => void;
|
|
10
|
+
appliesSizePreset: (row: SectionHeaderRow) => boolean;
|
|
11
|
+
measure: (row: SectionHeaderRow, _width: number, layout?: string) => 32 | 28 | 16 | 68 | 47 | 56 | 30 | 36;
|
|
12
|
+
measureRendered: (_body: HTMLElement, _row: SectionHeaderRow) => number | undefined;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=SectionHeaderRowRenderer.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SystemRow } from '../../models';
|
|
2
|
+
import type { RowPrimitives } from './RowVisual';
|
|
3
|
+
declare function bind(body: HTMLElement, row: SystemRow, primitives: RowPrimitives): void;
|
|
4
|
+
declare function create(document: Document, row: SystemRow, primitives: RowPrimitives): HTMLDivElement;
|
|
5
|
+
declare function measure(row: SystemRow, width: number): number;
|
|
6
|
+
export declare const systemRowRenderer: {
|
|
7
|
+
key: "system";
|
|
8
|
+
appliesSizePreset: (row: SystemRow) => boolean;
|
|
9
|
+
create: typeof create;
|
|
10
|
+
bind: typeof bind;
|
|
11
|
+
measure: typeof measure;
|
|
12
|
+
measureRendered: (body: HTMLElement, row: SystemRow) => number | undefined;
|
|
13
|
+
recycle: (body: HTMLElement) => void;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=SystemRowRenderer.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { WalletGroupRow } from '../../models';
|
|
2
|
+
import type { RowPrimitives } from './RowVisual';
|
|
3
|
+
declare function bind(body: HTMLElement, row: WalletGroupRow, primitives: RowPrimitives): void;
|
|
4
|
+
declare function create(document: Document, row: WalletGroupRow, primitives: RowPrimitives): HTMLDivElement;
|
|
5
|
+
declare function recycle(body: HTMLElement): void;
|
|
6
|
+
export declare const walletGroupRowRenderer: {
|
|
7
|
+
key: "walletGroup";
|
|
8
|
+
reorderPreview: (body: HTMLElement, row: WalletGroupRow) => {
|
|
9
|
+
element: HTMLElement;
|
|
10
|
+
height: number;
|
|
11
|
+
} | undefined;
|
|
12
|
+
create: typeof create;
|
|
13
|
+
bind: typeof bind;
|
|
14
|
+
recycle: typeof recycle;
|
|
15
|
+
appliesSizePreset: () => boolean;
|
|
16
|
+
measure: (row: WalletGroupRow, width: number) => number;
|
|
17
|
+
measureRendered: (_body: HTMLElement, _row: WalletGroupRow) => number | undefined;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=WalletGroupRowRenderer.d.ts.map
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JFunc_void_bool.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include <functional>
|
|
12
|
+
|
|
13
|
+
#include <functional>
|
|
14
|
+
#include <NitroModules/JNICallable.hpp>
|
|
15
|
+
|
|
16
|
+
namespace margelo::nitro::nativelist {
|
|
17
|
+
|
|
18
|
+
using namespace facebook;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Represents the Java/Kotlin callback `(isBeyondThreshold: Boolean) -> Unit`.
|
|
22
|
+
* This can be passed around between C++ and Java/Kotlin.
|
|
23
|
+
*/
|
|
24
|
+
struct JFunc_void_bool: public jni::JavaClass<JFunc_void_bool> {
|
|
25
|
+
public:
|
|
26
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nativelist/Func_void_bool;";
|
|
27
|
+
|
|
28
|
+
public:
|
|
29
|
+
/**
|
|
30
|
+
* Invokes the function this `JFunc_void_bool` instance holds through JNI.
|
|
31
|
+
*/
|
|
32
|
+
void invoke(bool isBeyondThreshold) const {
|
|
33
|
+
static const auto method = javaClassStatic()->getMethod<void(jboolean /* isBeyondThreshold */)>("invoke");
|
|
34
|
+
method(self(), isBeyondThreshold);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* An implementation of Func_void_bool that is backed by a C++ implementation (using `std::function<...>`)
|
|
40
|
+
*/
|
|
41
|
+
class JFunc_void_bool_cxx final: public jni::HybridClass<JFunc_void_bool_cxx, JFunc_void_bool> {
|
|
42
|
+
public:
|
|
43
|
+
static jni::local_ref<JFunc_void_bool::javaobject> fromCpp(const std::function<void(bool /* isBeyondThreshold */)>& func) {
|
|
44
|
+
return JFunc_void_bool_cxx::newObjectCxxArgs(func);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public:
|
|
48
|
+
/**
|
|
49
|
+
* Invokes the C++ `std::function<...>` this `JFunc_void_bool_cxx` instance holds.
|
|
50
|
+
*/
|
|
51
|
+
void invoke_cxx(jboolean isBeyondThreshold) {
|
|
52
|
+
_func(static_cast<bool>(isBeyondThreshold));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public:
|
|
56
|
+
[[nodiscard]]
|
|
57
|
+
inline const std::function<void(bool /* isBeyondThreshold */)>& getFunction() const {
|
|
58
|
+
return _func;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public:
|
|
62
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nativelist/Func_void_bool_cxx;";
|
|
63
|
+
static void registerNatives() {
|
|
64
|
+
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_bool_cxx::invoke_cxx)});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
private:
|
|
68
|
+
explicit JFunc_void_bool_cxx(const std::function<void(bool /* isBeyondThreshold */)>& func): _func(func) { }
|
|
69
|
+
|
|
70
|
+
private:
|
|
71
|
+
friend HybridBase;
|
|
72
|
+
std::function<void(bool /* isBeyondThreshold */)> _func;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
} // namespace margelo::nitro::nativelist
|
|
@@ -15,14 +15,15 @@ namespace margelo::nitro::nativelist { enum class NativeListKeyboardShouldPersis
|
|
|
15
15
|
namespace margelo::nitro::nativelist { enum class NativeListScrollAlignment; }
|
|
16
16
|
|
|
17
17
|
#include <string>
|
|
18
|
+
#include <functional>
|
|
19
|
+
#include <optional>
|
|
20
|
+
#include "JFunc_void_bool.hpp"
|
|
21
|
+
#include <NitroModules/JNICallable.hpp>
|
|
18
22
|
#include "NativeListKeyboardDismissMode.hpp"
|
|
19
23
|
#include "JNativeListKeyboardDismissMode.hpp"
|
|
20
24
|
#include "NativeListKeyboardShouldPersistTaps.hpp"
|
|
21
25
|
#include "JNativeListKeyboardShouldPersistTaps.hpp"
|
|
22
|
-
#include <functional>
|
|
23
|
-
#include <optional>
|
|
24
26
|
#include "JFunc_void_std__string.hpp"
|
|
25
|
-
#include <NitroModules/JNICallable.hpp>
|
|
26
27
|
#include "NativeListScrollAlignment.hpp"
|
|
27
28
|
#include "JNativeListScrollAlignment.hpp"
|
|
28
29
|
|
|
@@ -65,6 +66,41 @@ namespace margelo::nitro::nativelist {
|
|
|
65
66
|
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* snapshotJson */)>("setSnapshotJson");
|
|
66
67
|
method(_javaPart, jni::make_jstring(snapshotJson));
|
|
67
68
|
}
|
|
69
|
+
std::string JHybridNativeListSpec::getContainerSlotHeightsJson() {
|
|
70
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getContainerSlotHeightsJson");
|
|
71
|
+
auto __result = method(_javaPart);
|
|
72
|
+
return __result->toStdString();
|
|
73
|
+
}
|
|
74
|
+
void JHybridNativeListSpec::setContainerSlotHeightsJson(const std::string& containerSlotHeightsJson) {
|
|
75
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* containerSlotHeightsJson */)>("setContainerSlotHeightsJson");
|
|
76
|
+
method(_javaPart, jni::make_jstring(containerSlotHeightsJson));
|
|
77
|
+
}
|
|
78
|
+
std::string JHybridNativeListSpec::getScrollPositionThresholdsJson() {
|
|
79
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getScrollPositionThresholdsJson");
|
|
80
|
+
auto __result = method(_javaPart);
|
|
81
|
+
return __result->toStdString();
|
|
82
|
+
}
|
|
83
|
+
void JHybridNativeListSpec::setScrollPositionThresholdsJson(const std::string& scrollPositionThresholdsJson) {
|
|
84
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* scrollPositionThresholdsJson */)>("setScrollPositionThresholdsJson");
|
|
85
|
+
method(_javaPart, jni::make_jstring(scrollPositionThresholdsJson));
|
|
86
|
+
}
|
|
87
|
+
std::optional<std::function<void(bool /* isBeyondThreshold */)>> JHybridNativeListSpec::getOnScrollPositionThresholdChange() {
|
|
88
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JFunc_void_bool::javaobject>()>("getOnScrollPositionThresholdChange_cxx");
|
|
89
|
+
auto __result = method(_javaPart);
|
|
90
|
+
return __result != nullptr ? std::make_optional([&]() -> std::function<void(bool /* isBeyondThreshold */)> {
|
|
91
|
+
if (__result->isInstanceOf(JFunc_void_bool_cxx::javaClassStatic())) [[likely]] {
|
|
92
|
+
auto downcast = jni::static_ref_cast<JFunc_void_bool_cxx::javaobject>(__result);
|
|
93
|
+
return downcast->cthis()->getFunction();
|
|
94
|
+
} else {
|
|
95
|
+
auto __resultRef = jni::make_global(__result);
|
|
96
|
+
return JNICallable<JFunc_void_bool, void(bool)>(std::move(__resultRef));
|
|
97
|
+
}
|
|
98
|
+
}()) : std::nullopt;
|
|
99
|
+
}
|
|
100
|
+
void JHybridNativeListSpec::setOnScrollPositionThresholdChange(const std::optional<std::function<void(bool /* isBeyondThreshold */)>>& onScrollPositionThresholdChange) {
|
|
101
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_bool::javaobject> /* onScrollPositionThresholdChange */)>("setOnScrollPositionThresholdChange_cxx");
|
|
102
|
+
method(_javaPart, onScrollPositionThresholdChange.has_value() ? JFunc_void_bool_cxx::fromCpp(onScrollPositionThresholdChange.value()) : nullptr);
|
|
103
|
+
}
|
|
68
104
|
NativeListKeyboardDismissMode JHybridNativeListSpec::getKeyboardDismissMode() {
|
|
69
105
|
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JNativeListKeyboardDismissMode>()>("getKeyboardDismissMode");
|
|
70
106
|
auto __result = method(_javaPart);
|
|
@@ -52,6 +52,12 @@ namespace margelo::nitro::nativelist {
|
|
|
52
52
|
// Properties
|
|
53
53
|
std::string getSnapshotJson() override;
|
|
54
54
|
void setSnapshotJson(const std::string& snapshotJson) override;
|
|
55
|
+
std::string getContainerSlotHeightsJson() override;
|
|
56
|
+
void setContainerSlotHeightsJson(const std::string& containerSlotHeightsJson) override;
|
|
57
|
+
std::string getScrollPositionThresholdsJson() override;
|
|
58
|
+
void setScrollPositionThresholdsJson(const std::string& scrollPositionThresholdsJson) override;
|
|
59
|
+
std::optional<std::function<void(bool /* isBeyondThreshold */)>> getOnScrollPositionThresholdChange() override;
|
|
60
|
+
void setOnScrollPositionThresholdChange(const std::optional<std::function<void(bool /* isBeyondThreshold */)>>& onScrollPositionThresholdChange) override;
|
|
55
61
|
NativeListKeyboardDismissMode getKeyboardDismissMode() override;
|
|
56
62
|
void setKeyboardDismissMode(NativeListKeyboardDismissMode keyboardDismissMode) override;
|
|
57
63
|
NativeListKeyboardShouldPersistTaps getKeyboardShouldPersistTaps() override;
|
|
@@ -58,6 +58,21 @@ void JHybridNativeListStateUpdater::updateViewProps(jni::alias_ref<jni::JClass>
|
|
|
58
58
|
: !newProps->snapshotJson.hasSameValue(oldProps->snapshotJson)) {
|
|
59
59
|
hybridView->setSnapshotJson(newProps->snapshotJson.get());
|
|
60
60
|
}
|
|
61
|
+
if (oldProps == nullptr
|
|
62
|
+
? newProps->containerSlotHeightsJson.isProvided()
|
|
63
|
+
: !newProps->containerSlotHeightsJson.hasSameValue(oldProps->containerSlotHeightsJson)) {
|
|
64
|
+
hybridView->setContainerSlotHeightsJson(newProps->containerSlotHeightsJson.get());
|
|
65
|
+
}
|
|
66
|
+
if (oldProps == nullptr
|
|
67
|
+
? newProps->scrollPositionThresholdsJson.isProvided()
|
|
68
|
+
: !newProps->scrollPositionThresholdsJson.hasSameValue(oldProps->scrollPositionThresholdsJson)) {
|
|
69
|
+
hybridView->setScrollPositionThresholdsJson(newProps->scrollPositionThresholdsJson.get());
|
|
70
|
+
}
|
|
71
|
+
if (oldProps == nullptr
|
|
72
|
+
? newProps->onScrollPositionThresholdChange.isProvided()
|
|
73
|
+
: !newProps->onScrollPositionThresholdChange.hasSameValue(oldProps->onScrollPositionThresholdChange)) {
|
|
74
|
+
hybridView->setOnScrollPositionThresholdChange(newProps->onScrollPositionThresholdChange.get());
|
|
75
|
+
}
|
|
61
76
|
if (oldProps == nullptr
|
|
62
77
|
? newProps->keyboardDismissMode.isProvided()
|
|
63
78
|
: !newProps->keyboardDismissMode.hasSameValue(oldProps->keyboardDismissMode)) {
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_bool.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.nativelist
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript callback `(isBeyondThreshold: boolean) => void`.
|
|
17
|
+
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
|
18
|
+
* or in Kotlin/Java (in which case it is a native callback).
|
|
19
|
+
*/
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
@Suppress("ClassName", "RedundantUnitReturnType")
|
|
23
|
+
fun interface Func_void_bool: (Boolean) -> Unit {
|
|
24
|
+
/**
|
|
25
|
+
* Call the given JS callback.
|
|
26
|
+
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
|
|
27
|
+
*/
|
|
28
|
+
@DoNotStrip
|
|
29
|
+
@Keep
|
|
30
|
+
override fun invoke(isBeyondThreshold: Boolean): Unit
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Represents the JavaScript callback `(isBeyondThreshold: boolean) => void`.
|
|
35
|
+
* This is implemented in C++, via a `std::function<...>`.
|
|
36
|
+
* The callback might be coming from JS.
|
|
37
|
+
*/
|
|
38
|
+
@DoNotStrip
|
|
39
|
+
@Keep
|
|
40
|
+
@Suppress(
|
|
41
|
+
"KotlinJniMissingFunction", "unused",
|
|
42
|
+
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
|
43
|
+
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
|
44
|
+
)
|
|
45
|
+
class Func_void_bool_cxx: Func_void_bool {
|
|
46
|
+
@DoNotStrip
|
|
47
|
+
@Keep
|
|
48
|
+
private val mHybridData: HybridData
|
|
49
|
+
|
|
50
|
+
@DoNotStrip
|
|
51
|
+
@Keep
|
|
52
|
+
private constructor(hybridData: HybridData) {
|
|
53
|
+
mHybridData = hybridData
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@DoNotStrip
|
|
57
|
+
@Keep
|
|
58
|
+
override fun invoke(isBeyondThreshold: Boolean): Unit
|
|
59
|
+
= invoke_cxx(isBeyondThreshold)
|
|
60
|
+
|
|
61
|
+
private external fun invoke_cxx(isBeyondThreshold: Boolean): Unit
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Represents the JavaScript callback `(isBeyondThreshold: boolean) => void`.
|
|
66
|
+
* This is implemented in Java/Kotlin, via a `(Boolean) -> Unit`.
|
|
67
|
+
* The callback is always coming from native.
|
|
68
|
+
*/
|
|
69
|
+
@DoNotStrip
|
|
70
|
+
@Keep
|
|
71
|
+
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
72
|
+
class Func_void_bool_java(private val function: (Boolean) -> Unit): Func_void_bool {
|
|
73
|
+
@DoNotStrip
|
|
74
|
+
@Keep
|
|
75
|
+
override fun invoke(isBeyondThreshold: Boolean): Unit {
|
|
76
|
+
return this.function(isBeyondThreshold)
|
|
77
|
+
}
|
|
78
|
+
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt
CHANGED
|
@@ -33,6 +33,32 @@ abstract class HybridNativeListSpec: HybridView() {
|
|
|
33
33
|
@set:Keep
|
|
34
34
|
abstract var snapshotJson: String
|
|
35
35
|
|
|
36
|
+
@get:DoNotStrip
|
|
37
|
+
@get:Keep
|
|
38
|
+
@set:DoNotStrip
|
|
39
|
+
@set:Keep
|
|
40
|
+
abstract var containerSlotHeightsJson: String
|
|
41
|
+
|
|
42
|
+
@get:DoNotStrip
|
|
43
|
+
@get:Keep
|
|
44
|
+
@set:DoNotStrip
|
|
45
|
+
@set:Keep
|
|
46
|
+
abstract var scrollPositionThresholdsJson: String
|
|
47
|
+
|
|
48
|
+
abstract var onScrollPositionThresholdChange: ((isBeyondThreshold: Boolean) -> Unit)?
|
|
49
|
+
|
|
50
|
+
private var onScrollPositionThresholdChange_cxx: Func_void_bool?
|
|
51
|
+
@Keep
|
|
52
|
+
@DoNotStrip
|
|
53
|
+
get() {
|
|
54
|
+
return onScrollPositionThresholdChange?.let { Func_void_bool_java(it) }
|
|
55
|
+
}
|
|
56
|
+
@Keep
|
|
57
|
+
@DoNotStrip
|
|
58
|
+
set(value) {
|
|
59
|
+
onScrollPositionThresholdChange = value?.let { it }
|
|
60
|
+
}
|
|
61
|
+
|
|
36
62
|
@get:DoNotStrip
|
|
37
63
|
@get:Keep
|
|
38
64
|
@set:DoNotStrip
|
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
package com.margelo.nitro.nativelist.views
|
|
9
9
|
|
|
10
10
|
import android.view.View
|
|
11
|
+
import android.view.ViewGroup
|
|
11
12
|
import com.facebook.react.uimanager.ReactStylesDiffMap
|
|
12
|
-
import com.facebook.react.uimanager.
|
|
13
|
+
import com.facebook.react.uimanager.ViewGroupManager
|
|
13
14
|
import com.facebook.react.uimanager.StateWrapper
|
|
14
15
|
import com.facebook.react.uimanager.ThemedReactContext
|
|
15
16
|
import com.margelo.nitro.R.id.associated_hybrid_view_tag
|
|
@@ -19,7 +20,7 @@ import com.margelo.nitro.nativelist.*
|
|
|
19
20
|
/**
|
|
20
21
|
* Represents the React Native `ViewManager` for the "NativeList" Nitro HybridView.
|
|
21
22
|
*/
|
|
22
|
-
public class HybridNativeListManager:
|
|
23
|
+
public class HybridNativeListManager: ViewGroupManager<ViewGroup>() {
|
|
23
24
|
/**
|
|
24
25
|
* Represents the View and its last state snapshot (mutable)
|
|
25
26
|
*/
|
|
@@ -35,18 +36,32 @@ public class HybridNativeListManager: SimpleViewManager<View>() {
|
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
|
|
39
|
+
// NativeList container slot mounting
|
|
40
|
+
override fun needsCustomLayoutForChildren(): Boolean = true
|
|
41
|
+
override fun addView(parent: ViewGroup, child: View, index: Int) {
|
|
42
|
+
(parent as NativeListView).mountContainerSlot(child, index)
|
|
43
|
+
}
|
|
44
|
+
override fun getChildCount(parent: ViewGroup): Int = (parent as NativeListView).containerSlotCount()
|
|
45
|
+
override fun getChildAt(parent: ViewGroup, index: Int): View = (parent as NativeListView).containerSlotAt(index)
|
|
46
|
+
override fun removeViewAt(parent: ViewGroup, index: Int) {
|
|
47
|
+
(parent as NativeListView).unmountContainerSlot(index)
|
|
48
|
+
}
|
|
49
|
+
override fun removeAllViews(parent: ViewGroup) {
|
|
50
|
+
while (getChildCount(parent) > 0) removeViewAt(parent, getChildCount(parent) - 1)
|
|
51
|
+
}
|
|
52
|
+
|
|
38
53
|
override fun getName(): String {
|
|
39
54
|
return "NativeList"
|
|
40
55
|
}
|
|
41
56
|
|
|
42
|
-
override fun createViewInstance(reactContext: ThemedReactContext):
|
|
57
|
+
override fun createViewInstance(reactContext: ThemedReactContext): ViewGroup {
|
|
43
58
|
val hybridView = HybridNativeList(reactContext)
|
|
44
|
-
val view = hybridView.view
|
|
59
|
+
val view = hybridView.view as ViewGroup
|
|
45
60
|
view.setTag(associated_hybrid_view_tag, HybridViewHolder(hybridView))
|
|
46
61
|
return view
|
|
47
62
|
}
|
|
48
63
|
|
|
49
|
-
override fun updateState(view:
|
|
64
|
+
override fun updateState(view: ViewGroup, props: ReactStylesDiffMap, stateWrapper: StateWrapper): Any? {
|
|
50
65
|
val holder = getHybridViewHolder(view)
|
|
51
66
|
?: throw Error("Couldn't find view $view in local views table!")
|
|
52
67
|
val hybridView = holder.hybridView
|
|
@@ -63,14 +78,14 @@ public class HybridNativeListManager: SimpleViewManager<View>() {
|
|
|
63
78
|
return super.updateState(view, props, newState)
|
|
64
79
|
}
|
|
65
80
|
|
|
66
|
-
override fun onDropViewInstance(view:
|
|
81
|
+
override fun onDropViewInstance(view: ViewGroup) {
|
|
67
82
|
val holder = getHybridViewHolder(view)
|
|
68
83
|
holder?.lastState = null
|
|
69
84
|
holder?.hybridView?.onDropView()
|
|
70
85
|
return super.onDropViewInstance(view)
|
|
71
86
|
}
|
|
72
87
|
|
|
73
|
-
protected override fun prepareToRecycleView(reactContext: ThemedReactContext, view:
|
|
88
|
+
protected override fun prepareToRecycleView(reactContext: ThemedReactContext, view: ViewGroup): ViewGroup? {
|
|
74
89
|
val preparedView = super.prepareToRecycleView(reactContext, view)
|
|
75
90
|
?: return null
|
|
76
91
|
val holder = getHybridViewHolder(preparedView)
|
|
@@ -84,13 +99,13 @@ public class HybridNativeListManager: SimpleViewManager<View>() {
|
|
|
84
99
|
hybridView.prepareForRecycle()
|
|
85
100
|
|
|
86
101
|
// Maybe update the view if it changed
|
|
87
|
-
return hybridView.view
|
|
102
|
+
return hybridView.view as ViewGroup
|
|
88
103
|
} else {
|
|
89
104
|
return null
|
|
90
105
|
}
|
|
91
106
|
}
|
|
92
107
|
|
|
93
|
-
private fun getHybridViewHolder(view:
|
|
108
|
+
private fun getHybridViewHolder(view: ViewGroup): HybridViewHolder? {
|
|
94
109
|
return view.getTag(associated_hybrid_view_tag) as? HybridViewHolder
|
|
95
110
|
}
|
|
96
111
|
}
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
#include <NitroModules/HybridObjectRegistry.hpp>
|
|
17
17
|
|
|
18
18
|
#include "JHybridNativeListSpec.hpp"
|
|
19
|
+
#include "JFunc_void_bool.hpp"
|
|
19
20
|
#include "JFunc_void_std__string.hpp"
|
|
20
21
|
#include "views/JHybridNativeListStateUpdater.hpp"
|
|
21
22
|
#include <NitroModules/DefaultConstructableObject.hpp>
|
|
@@ -43,6 +44,7 @@ void registerAllNatives() {
|
|
|
43
44
|
|
|
44
45
|
// Register native JNI methods
|
|
45
46
|
margelo::nitro::nativelist::JHybridNativeListSpec::CxxPart::registerNatives();
|
|
47
|
+
margelo::nitro::nativelist::JFunc_void_bool_cxx::registerNatives();
|
|
46
48
|
margelo::nitro::nativelist::JFunc_void_std__string_cxx::registerNatives();
|
|
47
49
|
margelo::nitro::nativelist::views::JHybridNativeListStateUpdater::registerNatives();
|
|
48
50
|
|
|
@@ -14,6 +14,14 @@
|
|
|
14
14
|
|
|
15
15
|
namespace margelo::nitro::nativelist::bridge::swift {
|
|
16
16
|
|
|
17
|
+
// pragma MARK: std::function<void(bool /* isBeyondThreshold */)>
|
|
18
|
+
Func_void_bool create_Func_void_bool(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
19
|
+
auto swiftClosure = NativeListModule::Func_void_bool::fromUnsafe(swiftClosureWrapper);
|
|
20
|
+
return [swiftClosure = std::move(swiftClosure)](bool isBeyondThreshold) mutable -> void {
|
|
21
|
+
swiftClosure.call(isBeyondThreshold);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
17
25
|
// pragma MARK: std::function<void(const std::string& /* payloadJson */)>
|
|
18
26
|
Func_void_std__string create_Func_void_std__string(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
19
27
|
auto swiftClosure = NativeListModule::Func_void_std__string::fromUnsafe(swiftClosureWrapper);
|