@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,91 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NativeListModule-Swift-Cxx-Bridge.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
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `HybridNativeListSpec` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::nativelist { class HybridNativeListSpec; }
|
|
13
|
+
|
|
14
|
+
// Forward declarations of Swift defined types
|
|
15
|
+
// Forward declaration of `HybridNativeListSpec_cxx` to properly resolve imports.
|
|
16
|
+
namespace NativeListModule { class HybridNativeListSpec_cxx; }
|
|
17
|
+
|
|
18
|
+
// Include C++ defined types
|
|
19
|
+
#include "HybridNativeListSpec.hpp"
|
|
20
|
+
#include <NitroModules/Result.hpp>
|
|
21
|
+
#include <exception>
|
|
22
|
+
#include <functional>
|
|
23
|
+
#include <memory>
|
|
24
|
+
#include <optional>
|
|
25
|
+
#include <string>
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Contains specialized versions of C++ templated types so they can be accessed from Swift,
|
|
29
|
+
* as well as helper functions to interact with those C++ types from Swift.
|
|
30
|
+
*/
|
|
31
|
+
namespace margelo::nitro::nativelist::bridge::swift {
|
|
32
|
+
|
|
33
|
+
// pragma MARK: std::function<void(const std::string& /* payloadJson */)>
|
|
34
|
+
/**
|
|
35
|
+
* Specialized version of `std::function<void(const std::string&)>`.
|
|
36
|
+
*/
|
|
37
|
+
using Func_void_std__string = std::function<void(const std::string& /* payloadJson */)>;
|
|
38
|
+
/**
|
|
39
|
+
* Wrapper class for a `std::function<void(const std::string& / * payloadJson * /)>`, this can be used from Swift.
|
|
40
|
+
*/
|
|
41
|
+
class Func_void_std__string_Wrapper final {
|
|
42
|
+
public:
|
|
43
|
+
explicit Func_void_std__string_Wrapper(std::function<void(const std::string& /* payloadJson */)>&& func): _function(std::make_unique<std::function<void(const std::string& /* payloadJson */)>>(std::move(func))) {}
|
|
44
|
+
inline void call(std::string payloadJson) const noexcept {
|
|
45
|
+
_function->operator()(payloadJson);
|
|
46
|
+
}
|
|
47
|
+
private:
|
|
48
|
+
std::unique_ptr<std::function<void(const std::string& /* payloadJson */)>> _function;
|
|
49
|
+
} SWIFT_NONCOPYABLE;
|
|
50
|
+
Func_void_std__string create_Func_void_std__string(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
51
|
+
inline Func_void_std__string_Wrapper wrap_Func_void_std__string(Func_void_std__string value) noexcept {
|
|
52
|
+
return Func_void_std__string_Wrapper(std::move(value));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// pragma MARK: std::optional<std::function<void(const std::string& /* payloadJson */)>>
|
|
56
|
+
/**
|
|
57
|
+
* Specialized version of `std::optional<std::function<void(const std::string& / * payloadJson * /)>>`.
|
|
58
|
+
*/
|
|
59
|
+
using std__optional_std__function_void_const_std__string_____payloadJson______ = std::optional<std::function<void(const std::string& /* payloadJson */)>>;
|
|
60
|
+
inline std::optional<std::function<void(const std::string& /* payloadJson */)>> create_std__optional_std__function_void_const_std__string_____payloadJson______(const std::function<void(const std::string& /* payloadJson */)>& value) noexcept {
|
|
61
|
+
return std::optional<std::function<void(const std::string& /* payloadJson */)>>(value);
|
|
62
|
+
}
|
|
63
|
+
inline bool has_value_std__optional_std__function_void_const_std__string_____payloadJson______(const std::optional<std::function<void(const std::string& /* payloadJson */)>>& optional) noexcept {
|
|
64
|
+
return optional.has_value();
|
|
65
|
+
}
|
|
66
|
+
inline std::function<void(const std::string& /* payloadJson */)> get_std__optional_std__function_void_const_std__string_____payloadJson______(const std::optional<std::function<void(const std::string& /* payloadJson */)>>& optional) noexcept {
|
|
67
|
+
return optional.value();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// pragma MARK: std::shared_ptr<HybridNativeListSpec>
|
|
71
|
+
/**
|
|
72
|
+
* Specialized version of `std::shared_ptr<HybridNativeListSpec>`.
|
|
73
|
+
*/
|
|
74
|
+
using std__shared_ptr_HybridNativeListSpec_ = std::shared_ptr<HybridNativeListSpec>;
|
|
75
|
+
std::shared_ptr<HybridNativeListSpec> create_std__shared_ptr_HybridNativeListSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
|
76
|
+
void* NON_NULL get_std__shared_ptr_HybridNativeListSpec_(std__shared_ptr_HybridNativeListSpec_ cppType);
|
|
77
|
+
|
|
78
|
+
// pragma MARK: std::weak_ptr<HybridNativeListSpec>
|
|
79
|
+
using std__weak_ptr_HybridNativeListSpec_ = std::weak_ptr<HybridNativeListSpec>;
|
|
80
|
+
inline std__weak_ptr_HybridNativeListSpec_ weakify_std__shared_ptr_HybridNativeListSpec_(const std::shared_ptr<HybridNativeListSpec>& strong) noexcept { return strong; }
|
|
81
|
+
|
|
82
|
+
// pragma MARK: Result<void>
|
|
83
|
+
using Result_void_ = Result<void>;
|
|
84
|
+
inline Result_void_ create_Result_void_() noexcept {
|
|
85
|
+
return Result<void>::withValue();
|
|
86
|
+
}
|
|
87
|
+
inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
|
|
88
|
+
return Result<void>::withError(error);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
} // namespace margelo::nitro::nativelist::bridge::swift
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NativeListModule-Swift-Cxx-Umbrella.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
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `HybridNativeListSpec` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::nativelist { class HybridNativeListSpec; }
|
|
13
|
+
// Forward declaration of `NativeListScrollAlignment` to properly resolve imports.
|
|
14
|
+
namespace margelo::nitro::nativelist { enum class NativeListScrollAlignment; }
|
|
15
|
+
|
|
16
|
+
// Include C++ defined types
|
|
17
|
+
#include "HybridNativeListSpec.hpp"
|
|
18
|
+
#include "NativeListScrollAlignment.hpp"
|
|
19
|
+
#include <NitroModules/Result.hpp>
|
|
20
|
+
#include <exception>
|
|
21
|
+
#include <functional>
|
|
22
|
+
#include <memory>
|
|
23
|
+
#include <optional>
|
|
24
|
+
#include <string>
|
|
25
|
+
|
|
26
|
+
// C++ helpers for Swift
|
|
27
|
+
#include "NativeListModule-Swift-Cxx-Bridge.hpp"
|
|
28
|
+
|
|
29
|
+
// Common C++ types used in Swift
|
|
30
|
+
#include <NitroModules/ArrayBufferHolder.hpp>
|
|
31
|
+
#include <NitroModules/AnyMapUtils.hpp>
|
|
32
|
+
#include <NitroModules/RuntimeError.hpp>
|
|
33
|
+
#include <NitroModules/DateToChronoDate.hpp>
|
|
34
|
+
|
|
35
|
+
// Forward declarations of Swift defined types
|
|
36
|
+
// Forward declaration of `HybridNativeListSpec_cxx` to properly resolve imports.
|
|
37
|
+
namespace NativeListModule { class HybridNativeListSpec_cxx; }
|
|
38
|
+
|
|
39
|
+
// Include Swift defined types
|
|
40
|
+
#if __has_include("NativeListModule-Swift.h")
|
|
41
|
+
// This header is generated by Xcode/Swift on every app build.
|
|
42
|
+
// If it cannot be found, make sure the Swift module's name (= podspec name) is actually "NativeListModule".
|
|
43
|
+
#include "NativeListModule-Swift.h"
|
|
44
|
+
// Same as above, but used when building with frameworks (`use_frameworks`)
|
|
45
|
+
#elif __has_include(<NativeListModule/NativeListModule-Swift.h>)
|
|
46
|
+
#include <NativeListModule/NativeListModule-Swift.h>
|
|
47
|
+
#else
|
|
48
|
+
#error NativeListModule's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "NativeListModule", and try building the app first.
|
|
49
|
+
#endif
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NativeListModuleAutolinking.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 <Foundation/Foundation.h>
|
|
9
|
+
#import <NitroModules/HybridObjectRegistry.hpp>
|
|
10
|
+
#import "NativeListModule-Swift-Cxx-Umbrella.hpp"
|
|
11
|
+
#import <type_traits>
|
|
12
|
+
|
|
13
|
+
#include "HybridNativeListSpecSwift.hpp"
|
|
14
|
+
|
|
15
|
+
@interface NativeListModuleAutolinking : NSObject
|
|
16
|
+
@end
|
|
17
|
+
|
|
18
|
+
@implementation NativeListModuleAutolinking
|
|
19
|
+
|
|
20
|
+
+ (void) load {
|
|
21
|
+
using namespace margelo::nitro;
|
|
22
|
+
using namespace margelo::nitro::nativelist;
|
|
23
|
+
|
|
24
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
25
|
+
"NativeList",
|
|
26
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
27
|
+
std::shared_ptr<HybridNativeListSpec> hybridObject = NativeListModule::NativeListModuleAutolinking::createNativeList();
|
|
28
|
+
return hybridObject;
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NativeListModuleAutolinking.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
|
+
// TODO: Use empty enums once Swift supports exporting them as namespaces
|
|
11
|
+
// See: https://github.com/swiftlang/swift/pull/83616
|
|
12
|
+
public final class NativeListModuleAutolinking {
|
|
13
|
+
public typealias bridge = margelo.nitro.nativelist.bridge.swift
|
|
14
|
+
|
|
15
|
+
public static func createNativeList() -> bridge.std__shared_ptr_HybridNativeListSpec_ {
|
|
16
|
+
let hybridObject = HybridNativeList()
|
|
17
|
+
return { () -> bridge.std__shared_ptr_HybridNativeListSpec_ in
|
|
18
|
+
let __cxxWrapped = hybridObject.getCxxWrapper()
|
|
19
|
+
return __cxxWrapped.getCxxPart()
|
|
20
|
+
}()
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public static func isNativeListRecyclable() -> Bool {
|
|
24
|
+
return HybridNativeList.self is any RecyclableView.Type
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNativeListSpecSwift.cpp
|
|
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
|
+
#include "HybridNativeListSpecSwift.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::nativelist {
|
|
11
|
+
} // namespace margelo::nitro::nativelist
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNativeListSpecSwift.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 "HybridNativeListSpec.hpp"
|
|
11
|
+
|
|
12
|
+
// Forward declaration of `HybridNativeListSpec_cxx` to properly resolve imports.
|
|
13
|
+
namespace NativeListModule { class HybridNativeListSpec_cxx; }
|
|
14
|
+
|
|
15
|
+
// Forward declaration of `NativeListScrollAlignment` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::nativelist { enum class NativeListScrollAlignment; }
|
|
17
|
+
|
|
18
|
+
#include <string>
|
|
19
|
+
#include <functional>
|
|
20
|
+
#include <optional>
|
|
21
|
+
#include "NativeListScrollAlignment.hpp"
|
|
22
|
+
|
|
23
|
+
#include "NativeListModule-Swift-Cxx-Umbrella.hpp"
|
|
24
|
+
|
|
25
|
+
namespace margelo::nitro::nativelist {
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The C++ part of HybridNativeListSpec_cxx.swift.
|
|
29
|
+
*
|
|
30
|
+
* HybridNativeListSpecSwift (C++) accesses HybridNativeListSpec_cxx (Swift), and might
|
|
31
|
+
* contain some additional bridging code for C++ <> Swift interop.
|
|
32
|
+
*
|
|
33
|
+
* Since this obviously introduces an overhead, I hope at some point in
|
|
34
|
+
* the future, HybridNativeListSpec_cxx can directly inherit from the C++ class HybridNativeListSpec
|
|
35
|
+
* to simplify the whole structure and memory management.
|
|
36
|
+
*/
|
|
37
|
+
class HybridNativeListSpecSwift: public virtual HybridNativeListSpec {
|
|
38
|
+
public:
|
|
39
|
+
// Constructor from a Swift instance
|
|
40
|
+
explicit HybridNativeListSpecSwift(const NativeListModule::HybridNativeListSpec_cxx& swiftPart):
|
|
41
|
+
HybridObject(HybridNativeListSpec::TAG),
|
|
42
|
+
_swiftPart(swiftPart) { }
|
|
43
|
+
|
|
44
|
+
public:
|
|
45
|
+
// Get the Swift part
|
|
46
|
+
inline NativeListModule::HybridNativeListSpec_cxx& getSwiftPart() noexcept {
|
|
47
|
+
return _swiftPart;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
inline size_t getExternalMemorySize() noexcept override {
|
|
52
|
+
return _swiftPart.getMemorySize();
|
|
53
|
+
}
|
|
54
|
+
bool equals(const std::shared_ptr<HybridObject>& other) override {
|
|
55
|
+
if (auto otherCast = std::dynamic_pointer_cast<HybridNativeListSpecSwift>(other)) {
|
|
56
|
+
return _swiftPart.equals(otherCast->_swiftPart);
|
|
57
|
+
}
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
void dispose() noexcept override {
|
|
61
|
+
_swiftPart.dispose();
|
|
62
|
+
}
|
|
63
|
+
std::string toString() override {
|
|
64
|
+
return _swiftPart.toString();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
public:
|
|
68
|
+
// Properties
|
|
69
|
+
inline std::string getSnapshotJson() noexcept override {
|
|
70
|
+
auto __result = _swiftPart.getSnapshotJson();
|
|
71
|
+
return __result;
|
|
72
|
+
}
|
|
73
|
+
inline void setSnapshotJson(const std::string& snapshotJson) noexcept override {
|
|
74
|
+
_swiftPart.setSnapshotJson(snapshotJson);
|
|
75
|
+
}
|
|
76
|
+
inline std::optional<std::function<void(const std::string& /* payloadJson */)>> getOnRowAction() noexcept override {
|
|
77
|
+
auto __result = _swiftPart.getOnRowAction();
|
|
78
|
+
return __result;
|
|
79
|
+
}
|
|
80
|
+
inline void setOnRowAction(const std::optional<std::function<void(const std::string& /* payloadJson */)>>& onRowAction) noexcept override {
|
|
81
|
+
_swiftPart.setOnRowAction(onRowAction);
|
|
82
|
+
}
|
|
83
|
+
inline std::optional<std::function<void(const std::string& /* payloadJson */)>> getOnActionAnchorInvalidated() noexcept override {
|
|
84
|
+
auto __result = _swiftPart.getOnActionAnchorInvalidated();
|
|
85
|
+
return __result;
|
|
86
|
+
}
|
|
87
|
+
inline void setOnActionAnchorInvalidated(const std::optional<std::function<void(const std::string& /* payloadJson */)>>& onActionAnchorInvalidated) noexcept override {
|
|
88
|
+
_swiftPart.setOnActionAnchorInvalidated(onActionAnchorInvalidated);
|
|
89
|
+
}
|
|
90
|
+
inline std::optional<std::function<void(const std::string& /* payloadJson */)>> getOnSelectionDelta() noexcept override {
|
|
91
|
+
auto __result = _swiftPart.getOnSelectionDelta();
|
|
92
|
+
return __result;
|
|
93
|
+
}
|
|
94
|
+
inline void setOnSelectionDelta(const std::optional<std::function<void(const std::string& /* payloadJson */)>>& onSelectionDelta) noexcept override {
|
|
95
|
+
_swiftPart.setOnSelectionDelta(onSelectionDelta);
|
|
96
|
+
}
|
|
97
|
+
inline std::optional<std::function<void(const std::string& /* payloadJson */)>> getOnReorder() noexcept override {
|
|
98
|
+
auto __result = _swiftPart.getOnReorder();
|
|
99
|
+
return __result;
|
|
100
|
+
}
|
|
101
|
+
inline void setOnReorder(const std::optional<std::function<void(const std::string& /* payloadJson */)>>& onReorder) noexcept override {
|
|
102
|
+
_swiftPart.setOnReorder(onReorder);
|
|
103
|
+
}
|
|
104
|
+
inline std::optional<std::function<void(const std::string& /* payloadJson */)>> getOnEndReached() noexcept override {
|
|
105
|
+
auto __result = _swiftPart.getOnEndReached();
|
|
106
|
+
return __result;
|
|
107
|
+
}
|
|
108
|
+
inline void setOnEndReached(const std::optional<std::function<void(const std::string& /* payloadJson */)>>& onEndReached) noexcept override {
|
|
109
|
+
_swiftPart.setOnEndReached(onEndReached);
|
|
110
|
+
}
|
|
111
|
+
inline std::optional<std::function<void(const std::string& /* payloadJson */)>> getOnVisibleRangeChanged() noexcept override {
|
|
112
|
+
auto __result = _swiftPart.getOnVisibleRangeChanged();
|
|
113
|
+
return __result;
|
|
114
|
+
}
|
|
115
|
+
inline void setOnVisibleRangeChanged(const std::optional<std::function<void(const std::string& /* payloadJson */)>>& onVisibleRangeChanged) noexcept override {
|
|
116
|
+
_swiftPart.setOnVisibleRangeChanged(onVisibleRangeChanged);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
public:
|
|
120
|
+
// Methods
|
|
121
|
+
inline void applySnapshot(const std::string& snapshotJson) override {
|
|
122
|
+
auto __result = _swiftPart.applySnapshot(snapshotJson);
|
|
123
|
+
if (__result.hasError()) [[unlikely]] {
|
|
124
|
+
std::rethrow_exception(__result.error());
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
inline void applyPatches(const std::string& patchesJson) override {
|
|
128
|
+
auto __result = _swiftPart.applyPatches(patchesJson);
|
|
129
|
+
if (__result.hasError()) [[unlikely]] {
|
|
130
|
+
std::rethrow_exception(__result.error());
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
inline void reconcileSelection(const std::string& selectedKeysJson) override {
|
|
134
|
+
auto __result = _swiftPart.reconcileSelection(selectedKeysJson);
|
|
135
|
+
if (__result.hasError()) [[unlikely]] {
|
|
136
|
+
std::rethrow_exception(__result.error());
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
inline void scrollToKey(const std::string& key, bool animated, NativeListScrollAlignment alignment, double viewPosition, double viewOffset) override {
|
|
140
|
+
auto __result = _swiftPart.scrollToKey(key, std::forward<decltype(animated)>(animated), static_cast<int>(alignment), std::forward<decltype(viewPosition)>(viewPosition), std::forward<decltype(viewOffset)>(viewOffset));
|
|
141
|
+
if (__result.hasError()) [[unlikely]] {
|
|
142
|
+
std::rethrow_exception(__result.error());
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
inline void scrollToIndex(double index, bool animated, NativeListScrollAlignment alignment, double viewPosition, double viewOffset) override {
|
|
146
|
+
auto __result = _swiftPart.scrollToIndex(std::forward<decltype(index)>(index), std::forward<decltype(animated)>(animated), static_cast<int>(alignment), std::forward<decltype(viewPosition)>(viewPosition), std::forward<decltype(viewOffset)>(viewOffset));
|
|
147
|
+
if (__result.hasError()) [[unlikely]] {
|
|
148
|
+
std::rethrow_exception(__result.error());
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
inline void scrollToOffset(double offset, bool animated) override {
|
|
152
|
+
auto __result = _swiftPart.scrollToOffset(std::forward<decltype(offset)>(offset), std::forward<decltype(animated)>(animated));
|
|
153
|
+
if (__result.hasError()) [[unlikely]] {
|
|
154
|
+
std::rethrow_exception(__result.error());
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
inline void scrollToEnd(bool animated) override {
|
|
158
|
+
auto __result = _swiftPart.scrollToEnd(std::forward<decltype(animated)>(animated));
|
|
159
|
+
if (__result.hasError()) [[unlikely]] {
|
|
160
|
+
std::rethrow_exception(__result.error());
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
inline void setActionAnchorState(const std::string& stateJson) override {
|
|
164
|
+
auto __result = _swiftPart.setActionAnchorState(stateJson);
|
|
165
|
+
if (__result.hasError()) [[unlikely]] {
|
|
166
|
+
std::rethrow_exception(__result.error());
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
inline void setRefreshing(bool refreshing) override {
|
|
170
|
+
auto __result = _swiftPart.setRefreshing(std::forward<decltype(refreshing)>(refreshing));
|
|
171
|
+
if (__result.hasError()) [[unlikely]] {
|
|
172
|
+
std::rethrow_exception(__result.error());
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
private:
|
|
177
|
+
NativeListModule::HybridNativeListSpec_cxx _swiftPart;
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
} // namespace margelo::nitro::nativelist
|
|
@@ -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
|
+
}
|