@onekeyfe/react-native-native-list 3.0.105
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 +342 -0
- package/android/CMakeLists.txt +20 -0
- package/android/build.gradle +105 -0
- package/android/gradle.properties +4 -0
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +125 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListAdapter.kt +165 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +147 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListPackage.kt +25 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRowView.kt +2939 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +1794 -0
- package/common/fonts/Roobert-Bold.ttf +0 -0
- package/common/fonts/Roobert-Medium.ttf +0 -0
- package/common/fonts/Roobert-Regular.ttf +0 -0
- package/common/fonts/Roobert-SemiBold.ttf +0 -0
- package/docs/DESIGN.md +129 -0
- package/ios/HybridNativeList.swift +131 -0
- package/ios/NativeListCell.swift +2858 -0
- package/ios/NativeListDesignAssets.swift +110 -0
- package/ios/NativeListModels.swift +215 -0
- package/ios/RNCNativeListView.swift +1737 -0
- package/ios/Resources/NativeListIcons.xcassets/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_bottom.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_bottom.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_top.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_top.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_chart_trending_up.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_chart_trending_up.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_checked.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_checked.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_indeterminate.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_indeterminate.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_bottom.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_bottom.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_grabber_ver.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_grabber_ver.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_right_small.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_right_small.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_top.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_top.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_dot_hor.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_dot_hor.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_drag.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_drag.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_error_solid.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_error_solid.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_image_square_waves.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_image_square_waves.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_info_circle.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_info_circle.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle_solid.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle_solid.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_pencil.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_pencil.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_circle.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_circle.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_small.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_small.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_questionmark_solid.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_questionmark_solid.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_shield_exclamation.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_shield_exclamation.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_speaker_promote.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_speaker_promote.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_star.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_star.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_star_solid.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_star_solid.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_swap_hor.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_swap_hor.imageset/icon.svg +1 -0
- package/lib/module/NativeList.js +183 -0
- package/lib/module/NativeList.nitro.js +4 -0
- package/lib/module/NativeList.types.js +4 -0
- package/lib/module/NativeList.web.js +167 -0
- package/lib/module/index.js +6 -0
- package/lib/module/models.js +2 -0
- package/lib/module/package.json +1 -0
- package/lib/module/scrolling.js +121 -0
- package/lib/module/selection.js +85 -0
- package/lib/module/validation.js +562 -0
- package/lib/module/web/NativeListWebEngine.js +2238 -0
- package/lib/nitrogen/generated/.gitattributes +1 -0
- package/lib/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +76 -0
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +201 -0
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +84 -0
- package/lib/nitrogen/generated/android/c++/JNativeListScrollAlignment.hpp +64 -0
- package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +104 -0
- package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.hpp +54 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/Func_void_std__string.kt +78 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +177 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/NativeListScrollAlignment.kt +25 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/nativelistOnLoad.kt +35 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/views/HybridNativeListManager.kt +96 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/views/HybridNativeListStateUpdater.kt +23 -0
- package/lib/nitrogen/generated/android/nativelist+autolinking.cmake +83 -0
- package/lib/nitrogen/generated/android/nativelist+autolinking.gradle +27 -0
- package/lib/nitrogen/generated/android/nativelistOnLoad.cpp +58 -0
- package/lib/nitrogen/generated/android/nativelistOnLoad.hpp +34 -0
- package/lib/nitrogen/generated/ios/NativeListModule+autolinking.rb +62 -0
- package/lib/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Bridge.cpp +41 -0
- package/lib/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Bridge.hpp +91 -0
- package/lib/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Umbrella.hpp +49 -0
- package/lib/nitrogen/generated/ios/NativeListModuleAutolinking.mm +33 -0
- package/lib/nitrogen/generated/ios/NativeListModuleAutolinking.swift +26 -0
- package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.cpp +11 -0
- package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +180 -0
- package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +180 -0
- package/lib/nitrogen/generated/ios/swift/Func_void_std__string.swift +46 -0
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +69 -0
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +447 -0
- package/lib/nitrogen/generated/ios/swift/NativeListScrollAlignment.swift +48 -0
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +43 -0
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +87 -0
- package/lib/nitrogen/generated/shared/c++/NativeListScrollAlignment.hpp +84 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +46 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +103 -0
- package/lib/nitrogen/generated/shared/json/NativeListConfig.json +16 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/NativeList.d.ts +18 -0
- package/lib/typescript/src/NativeList.nitro.d.ts +29 -0
- package/lib/typescript/src/NativeList.types.d.ts +87 -0
- package/lib/typescript/src/NativeList.web.d.ts +19 -0
- package/lib/typescript/src/index.d.ts +7 -0
- package/lib/typescript/src/models.d.ts +456 -0
- package/lib/typescript/src/scrolling.d.ts +32 -0
- package/lib/typescript/src/selection.d.ts +27 -0
- package/lib/typescript/src/validation.d.ts +7 -0
- package/lib/typescript/src/web/NativeListWebEngine.d.ts +203 -0
- package/nitro.json +23 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +76 -0
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +201 -0
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +84 -0
- package/nitrogen/generated/android/c++/JNativeListScrollAlignment.hpp +64 -0
- package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +104 -0
- package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.hpp +54 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/Func_void_std__string.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +177 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/NativeListScrollAlignment.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/nativelistOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/views/HybridNativeListManager.kt +96 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/views/HybridNativeListStateUpdater.kt +23 -0
- package/nitrogen/generated/android/nativelist+autolinking.cmake +83 -0
- package/nitrogen/generated/android/nativelist+autolinking.gradle +27 -0
- package/nitrogen/generated/android/nativelistOnLoad.cpp +58 -0
- package/nitrogen/generated/android/nativelistOnLoad.hpp +34 -0
- package/nitrogen/generated/ios/NativeListModule+autolinking.rb +62 -0
- package/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Bridge.cpp +41 -0
- package/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Bridge.hpp +91 -0
- package/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Umbrella.hpp +49 -0
- package/nitrogen/generated/ios/NativeListModuleAutolinking.mm +33 -0
- package/nitrogen/generated/ios/NativeListModuleAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +180 -0
- package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +180 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +69 -0
- package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +447 -0
- package/nitrogen/generated/ios/swift/NativeListScrollAlignment.swift +48 -0
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +43 -0
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +87 -0
- package/nitrogen/generated/shared/c++/NativeListScrollAlignment.hpp +84 -0
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +46 -0
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +103 -0
- package/nitrogen/generated/shared/json/NativeListConfig.json +16 -0
- package/package.json +126 -0
- package/react-native-native-list.podspec +38 -0
- package/react-native.config.js +19 -0
- package/src/NativeList.nitro.ts +48 -0
- package/src/NativeList.tsx +298 -0
- package/src/NativeList.types.ts +125 -0
- package/src/NativeList.web.tsx +258 -0
- package/src/index.ts +35 -0
- package/src/models.ts +604 -0
- package/src/scrolling.ts +189 -0
- package/src/selection.ts +159 -0
- package/src/validation.ts +877 -0
- package/src/web/NativeListWebEngine.ts +3767 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNativeListComponent.mm
|
|
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
|
+
#import "HybridNativeListComponent.hpp"
|
|
9
|
+
#import <memory>
|
|
10
|
+
#import <react/renderer/componentregistry/ComponentDescriptorProvider.h>
|
|
11
|
+
#import <React/RCTViewComponentView.h>
|
|
12
|
+
#import <React/RCTComponentViewFactory.h>
|
|
13
|
+
#import <React/UIView+ComponentViewProtocol.h>
|
|
14
|
+
#import <NitroModules/NitroDefines.hpp>
|
|
15
|
+
#import <UIKit/UIKit.h>
|
|
16
|
+
|
|
17
|
+
#import "HybridNativeListSpecSwift.hpp"
|
|
18
|
+
#import "NativeListModule-Swift-Cxx-Umbrella.hpp"
|
|
19
|
+
|
|
20
|
+
#if __has_include(<cxxreact/ReactNativeVersion.h>)
|
|
21
|
+
#include <cxxreact/ReactNativeVersion.h>
|
|
22
|
+
#if REACT_NATIVE_VERSION_MINOR >= 82
|
|
23
|
+
#define ENABLE_RCT_COMPONENT_VIEW_INVALIDATE
|
|
24
|
+
#endif
|
|
25
|
+
#endif
|
|
26
|
+
|
|
27
|
+
using namespace facebook;
|
|
28
|
+
using namespace margelo::nitro::nativelist;
|
|
29
|
+
using namespace margelo::nitro::nativelist::views;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Represents the React Native View holder for the Nitro "NativeList" HybridView.
|
|
33
|
+
*/
|
|
34
|
+
@interface HybridNativeListComponent: RCTViewComponentView
|
|
35
|
+
+ (BOOL)shouldBeRecycled;
|
|
36
|
+
@end
|
|
37
|
+
|
|
38
|
+
@implementation HybridNativeListComponent {
|
|
39
|
+
std::shared_ptr<HybridNativeListSpecSwift> _hybridView;
|
|
40
|
+
BOOL _didDropView;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
+ (void) load {
|
|
44
|
+
[super load];
|
|
45
|
+
[RCTComponentViewFactory.currentComponentViewFactory registerComponentViewClass:[HybridNativeListComponent class]];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
+ (react::ComponentDescriptorProvider) componentDescriptorProvider {
|
|
49
|
+
return react::concreteComponentDescriptorProvider<HybridNativeListComponentDescriptor>();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
- (instancetype) init {
|
|
53
|
+
if (self = [super init]) {
|
|
54
|
+
_props = HybridNativeListShadowNode::defaultSharedProps();
|
|
55
|
+
std::shared_ptr<HybridNativeListSpec> hybridView = NativeListModule::NativeListModuleAutolinking::createNativeList();
|
|
56
|
+
_hybridView = std::dynamic_pointer_cast<HybridNativeListSpecSwift>(hybridView);
|
|
57
|
+
[self updateView];
|
|
58
|
+
}
|
|
59
|
+
return self;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
- (void) updateView {
|
|
63
|
+
// 1. Get Swift part
|
|
64
|
+
NativeListModule::HybridNativeListSpec_cxx& swiftPart = _hybridView->getSwiftPart();
|
|
65
|
+
|
|
66
|
+
// 2. Get UIView*
|
|
67
|
+
void* viewUnsafe = swiftPart.getView();
|
|
68
|
+
UIView* view = (__bridge_transfer UIView*) viewUnsafe;
|
|
69
|
+
|
|
70
|
+
// 3. Update RCTViewComponentView's [contentView]
|
|
71
|
+
[self setContentView:view];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
- (void) notifyOnDropView {
|
|
75
|
+
// A recycled component can later be invalidated. Notify only once per mount.
|
|
76
|
+
if (_didDropView) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
NativeListModule::HybridNativeListSpec_cxx& swiftPart = _hybridView->getSwiftPart();
|
|
80
|
+
swiftPart.onDropView();
|
|
81
|
+
_didDropView = YES;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
- (void) updateProps:(const std::shared_ptr<const react::Props>&)props
|
|
85
|
+
oldProps:(const std::shared_ptr<const react::Props>&)oldProps {
|
|
86
|
+
// A props update marks a newly mounted or still-active component.
|
|
87
|
+
_didDropView = NO;
|
|
88
|
+
|
|
89
|
+
// 1. Downcast props
|
|
90
|
+
const auto& newViewProps = *std::static_pointer_cast<const HybridNativeListProps>(props);
|
|
91
|
+
const auto* oldViewProps = static_cast<const HybridNativeListProps*>(oldProps.get());
|
|
92
|
+
NativeListModule::HybridNativeListSpec_cxx& swiftPart = _hybridView->getSwiftPart();
|
|
93
|
+
|
|
94
|
+
// 2. Update only props that differ from the previous Props snapshot.
|
|
95
|
+
const bool hasTransactionPropChanges = oldViewProps == nullptr
|
|
96
|
+
? newViewProps.hasAnyProvidedProps()
|
|
97
|
+
: !newViewProps.hasSameProps(*oldViewProps);
|
|
98
|
+
if (hasTransactionPropChanges) {
|
|
99
|
+
swiftPart.beforeUpdate();
|
|
100
|
+
|
|
101
|
+
// snapshotJson: string
|
|
102
|
+
if (oldViewProps == nullptr
|
|
103
|
+
? newViewProps.snapshotJson.isProvided()
|
|
104
|
+
: !newViewProps.snapshotJson.hasSameValue(oldViewProps->snapshotJson)) {
|
|
105
|
+
swiftPart.setSnapshotJson(newViewProps.snapshotJson.get());
|
|
106
|
+
}
|
|
107
|
+
// onRowAction: optional
|
|
108
|
+
if (oldViewProps == nullptr
|
|
109
|
+
? newViewProps.onRowAction.isProvided()
|
|
110
|
+
: !newViewProps.onRowAction.hasSameValue(oldViewProps->onRowAction)) {
|
|
111
|
+
swiftPart.setOnRowAction(newViewProps.onRowAction.get());
|
|
112
|
+
}
|
|
113
|
+
// onActionAnchorInvalidated: optional
|
|
114
|
+
if (oldViewProps == nullptr
|
|
115
|
+
? newViewProps.onActionAnchorInvalidated.isProvided()
|
|
116
|
+
: !newViewProps.onActionAnchorInvalidated.hasSameValue(oldViewProps->onActionAnchorInvalidated)) {
|
|
117
|
+
swiftPart.setOnActionAnchorInvalidated(newViewProps.onActionAnchorInvalidated.get());
|
|
118
|
+
}
|
|
119
|
+
// onSelectionDelta: optional
|
|
120
|
+
if (oldViewProps == nullptr
|
|
121
|
+
? newViewProps.onSelectionDelta.isProvided()
|
|
122
|
+
: !newViewProps.onSelectionDelta.hasSameValue(oldViewProps->onSelectionDelta)) {
|
|
123
|
+
swiftPart.setOnSelectionDelta(newViewProps.onSelectionDelta.get());
|
|
124
|
+
}
|
|
125
|
+
// onReorder: optional
|
|
126
|
+
if (oldViewProps == nullptr
|
|
127
|
+
? newViewProps.onReorder.isProvided()
|
|
128
|
+
: !newViewProps.onReorder.hasSameValue(oldViewProps->onReorder)) {
|
|
129
|
+
swiftPart.setOnReorder(newViewProps.onReorder.get());
|
|
130
|
+
}
|
|
131
|
+
// onEndReached: optional
|
|
132
|
+
if (oldViewProps == nullptr
|
|
133
|
+
? newViewProps.onEndReached.isProvided()
|
|
134
|
+
: !newViewProps.onEndReached.hasSameValue(oldViewProps->onEndReached)) {
|
|
135
|
+
swiftPart.setOnEndReached(newViewProps.onEndReached.get());
|
|
136
|
+
}
|
|
137
|
+
// onVisibleRangeChanged: optional
|
|
138
|
+
if (oldViewProps == nullptr
|
|
139
|
+
? newViewProps.onVisibleRangeChanged.isProvided()
|
|
140
|
+
: !newViewProps.onVisibleRangeChanged.hasSameValue(oldViewProps->onVisibleRangeChanged)) {
|
|
141
|
+
swiftPart.setOnVisibleRangeChanged(newViewProps.onVisibleRangeChanged.get());
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Update hybridRef if it changed
|
|
145
|
+
if (oldViewProps == nullptr
|
|
146
|
+
? newViewProps.hybridRef.isProvided()
|
|
147
|
+
: !newViewProps.hybridRef.hasSameValue(oldViewProps->hybridRef)) {
|
|
148
|
+
// hybridRef changed - call it with new this
|
|
149
|
+
const auto& maybeFunc = newViewProps.hybridRef.get();
|
|
150
|
+
if (maybeFunc.has_value()) {
|
|
151
|
+
maybeFunc.value()(_hybridView);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
swiftPart.afterUpdate();
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// 3. Continue in base class
|
|
159
|
+
[super updateProps:props oldProps:oldProps];
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
+ (BOOL)shouldBeRecycled {
|
|
163
|
+
return NativeListModule::NativeListModuleAutolinking::isNativeListRecyclable();
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
- (void)prepareForRecycle {
|
|
167
|
+
[self notifyOnDropView];
|
|
168
|
+
[super prepareForRecycle];
|
|
169
|
+
NativeListModule::HybridNativeListSpec_cxx& swiftPart = _hybridView->getSwiftPart();
|
|
170
|
+
swiftPart.maybePrepareForRecycle();
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
#ifdef ENABLE_RCT_COMPONENT_VIEW_INVALIDATE
|
|
174
|
+
- (void)invalidate {
|
|
175
|
+
[self notifyOnDropView];
|
|
176
|
+
[super invalidate];
|
|
177
|
+
}
|
|
178
|
+
#endif
|
|
179
|
+
|
|
180
|
+
@end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__string.swift
|
|
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
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ payloadJson: String) -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void_std__string {
|
|
15
|
+
public typealias bridge = margelo.nitro.nativelist.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ payloadJson: String) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ payloadJson: String) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(payloadJson: std.string) -> Void {
|
|
25
|
+
self.closure(String(payloadJson))
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
+
* This acquires one additional strong reference on the object!
|
|
31
|
+
*/
|
|
32
|
+
@inline(__always)
|
|
33
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void_std__string`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__string>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__string {
|
|
44
|
+
return Unmanaged<Func_void_std__string>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNativeListSpec.swift
|
|
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
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/// See ``HybridNativeListSpec``
|
|
11
|
+
public protocol HybridNativeListSpec_protocol: HybridObject, HybridView {
|
|
12
|
+
// Properties
|
|
13
|
+
var snapshotJson: String { get set }
|
|
14
|
+
var onRowAction: ((_ payloadJson: String) -> Void)? { get set }
|
|
15
|
+
var onActionAnchorInvalidated: ((_ payloadJson: String) -> Void)? { get set }
|
|
16
|
+
var onSelectionDelta: ((_ payloadJson: String) -> Void)? { get set }
|
|
17
|
+
var onReorder: ((_ payloadJson: String) -> Void)? { get set }
|
|
18
|
+
var onEndReached: ((_ payloadJson: String) -> Void)? { get set }
|
|
19
|
+
var onVisibleRangeChanged: ((_ payloadJson: String) -> Void)? { get set }
|
|
20
|
+
|
|
21
|
+
// Methods
|
|
22
|
+
func applySnapshot(snapshotJson: String) throws -> Void
|
|
23
|
+
func applyPatches(patchesJson: String) throws -> Void
|
|
24
|
+
func reconcileSelection(selectedKeysJson: String) throws -> Void
|
|
25
|
+
func scrollToKey(key: String, animated: Bool, alignment: NativeListScrollAlignment, viewPosition: Double, viewOffset: Double) throws -> Void
|
|
26
|
+
func scrollToIndex(index: Double, animated: Bool, alignment: NativeListScrollAlignment, viewPosition: Double, viewOffset: Double) throws -> Void
|
|
27
|
+
func scrollToOffset(offset: Double, animated: Bool) throws -> Void
|
|
28
|
+
func scrollToEnd(animated: Bool) throws -> Void
|
|
29
|
+
func setActionAnchorState(stateJson: String) throws -> Void
|
|
30
|
+
func setRefreshing(refreshing: Bool) throws -> Void
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public extension HybridNativeListSpec_protocol {
|
|
34
|
+
/// Default implementation of ``HybridObject.toString``
|
|
35
|
+
func toString() -> String {
|
|
36
|
+
return "[HybridObject NativeList]"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/// See ``HybridNativeListSpec``
|
|
41
|
+
open class HybridNativeListSpec_base {
|
|
42
|
+
private weak var cxxWrapper: HybridNativeListSpec_cxx? = nil
|
|
43
|
+
public init() { }
|
|
44
|
+
public func getCxxWrapper() -> HybridNativeListSpec_cxx {
|
|
45
|
+
#if DEBUG
|
|
46
|
+
guard self is any HybridNativeListSpec else {
|
|
47
|
+
fatalError("`self` is not a `HybridNativeListSpec`! Did you accidentally inherit from `HybridNativeListSpec_base` instead of `HybridNativeListSpec`?")
|
|
48
|
+
}
|
|
49
|
+
#endif
|
|
50
|
+
if let cxxWrapper = self.cxxWrapper {
|
|
51
|
+
return cxxWrapper
|
|
52
|
+
} else {
|
|
53
|
+
let cxxWrapper = HybridNativeListSpec_cxx(self as! any HybridNativeListSpec)
|
|
54
|
+
self.cxxWrapper = cxxWrapper
|
|
55
|
+
return cxxWrapper
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* A Swift base-protocol representing the NativeList HybridObject.
|
|
62
|
+
* Implement this protocol to create Swift-based instances of NativeList.
|
|
63
|
+
* ```swift
|
|
64
|
+
* class HybridNativeList : HybridNativeListSpec {
|
|
65
|
+
* // ...
|
|
66
|
+
* }
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
public typealias HybridNativeListSpec = HybridNativeListSpec_protocol & HybridNativeListSpec_base
|