@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,84 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NativeListScrollAlignment.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
|
+
#if __has_include(<NitroModules/NitroHash.hpp>)
|
|
11
|
+
#include <NitroModules/NitroHash.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
16
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
21
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::nativelist {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An enum which can be represented as a JavaScript union (NativeListScrollAlignment).
|
|
30
|
+
*/
|
|
31
|
+
enum class NativeListScrollAlignment {
|
|
32
|
+
START SWIFT_NAME(start) = 0,
|
|
33
|
+
CENTER SWIFT_NAME(center) = 1,
|
|
34
|
+
END SWIFT_NAME(end) = 2,
|
|
35
|
+
NEAREST SWIFT_NAME(nearest) = 3,
|
|
36
|
+
} CLOSED_ENUM;
|
|
37
|
+
|
|
38
|
+
} // namespace margelo::nitro::nativelist
|
|
39
|
+
|
|
40
|
+
namespace margelo::nitro {
|
|
41
|
+
|
|
42
|
+
// C++ NativeListScrollAlignment <> JS NativeListScrollAlignment (union)
|
|
43
|
+
template <>
|
|
44
|
+
struct JSIConverter<margelo::nitro::nativelist::NativeListScrollAlignment> final {
|
|
45
|
+
static inline margelo::nitro::nativelist::NativeListScrollAlignment fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
46
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
47
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
48
|
+
case hashString("start"): return margelo::nitro::nativelist::NativeListScrollAlignment::START;
|
|
49
|
+
case hashString("center"): return margelo::nitro::nativelist::NativeListScrollAlignment::CENTER;
|
|
50
|
+
case hashString("end"): return margelo::nitro::nativelist::NativeListScrollAlignment::END;
|
|
51
|
+
case hashString("nearest"): return margelo::nitro::nativelist::NativeListScrollAlignment::NEAREST;
|
|
52
|
+
default: [[unlikely]]
|
|
53
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum NativeListScrollAlignment - invalid value!");
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::nativelist::NativeListScrollAlignment arg) {
|
|
57
|
+
switch (arg) {
|
|
58
|
+
case margelo::nitro::nativelist::NativeListScrollAlignment::START: return JSIConverter<std::string>::toJSI(runtime, "start");
|
|
59
|
+
case margelo::nitro::nativelist::NativeListScrollAlignment::CENTER: return JSIConverter<std::string>::toJSI(runtime, "center");
|
|
60
|
+
case margelo::nitro::nativelist::NativeListScrollAlignment::END: return JSIConverter<std::string>::toJSI(runtime, "end");
|
|
61
|
+
case margelo::nitro::nativelist::NativeListScrollAlignment::NEAREST: return JSIConverter<std::string>::toJSI(runtime, "nearest");
|
|
62
|
+
default: [[unlikely]]
|
|
63
|
+
throw std::invalid_argument("Cannot convert NativeListScrollAlignment to JS - invalid value: "
|
|
64
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
68
|
+
if (!value.isString()) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
72
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
73
|
+
case hashString("start"):
|
|
74
|
+
case hashString("center"):
|
|
75
|
+
case hashString("end"):
|
|
76
|
+
case hashString("nearest"):
|
|
77
|
+
return true;
|
|
78
|
+
default:
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNativeListComponent.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 "HybridNativeListComponent.hpp"
|
|
9
|
+
|
|
10
|
+
#include <NitroModules/NitroHash.hpp>
|
|
11
|
+
#include <NitroModules/ReactProp.hpp>
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro::nativelist::views {
|
|
14
|
+
|
|
15
|
+
using namespace facebook;
|
|
16
|
+
|
|
17
|
+
extern const char HybridNativeListComponentName[] = "NativeList";
|
|
18
|
+
|
|
19
|
+
HybridNativeListProps::HybridNativeListProps(const react::PropsParserContext& context,
|
|
20
|
+
const HybridNativeListProps& sourceProps,
|
|
21
|
+
const react::RawProps& rawProps):
|
|
22
|
+
react::ViewProps(context, sourceProps, rawProps, filterObjectKeys),
|
|
23
|
+
snapshotJson(nitro::ReactProp<std::string>::fromRawValue("NativeList", "snapshotJson", rawProps, sourceProps.snapshotJson)),
|
|
24
|
+
onRowAction(nitro::ReactProp<std::optional<std::function<void(const std::string& /* payloadJson */)>>>::fromRawValue("NativeList", "onRowAction", rawProps, sourceProps.onRowAction)),
|
|
25
|
+
onActionAnchorInvalidated(nitro::ReactProp<std::optional<std::function<void(const std::string& /* payloadJson */)>>>::fromRawValue("NativeList", "onActionAnchorInvalidated", rawProps, sourceProps.onActionAnchorInvalidated)),
|
|
26
|
+
onSelectionDelta(nitro::ReactProp<std::optional<std::function<void(const std::string& /* payloadJson */)>>>::fromRawValue("NativeList", "onSelectionDelta", rawProps, sourceProps.onSelectionDelta)),
|
|
27
|
+
onReorder(nitro::ReactProp<std::optional<std::function<void(const std::string& /* payloadJson */)>>>::fromRawValue("NativeList", "onReorder", rawProps, sourceProps.onReorder)),
|
|
28
|
+
onEndReached(nitro::ReactProp<std::optional<std::function<void(const std::string& /* payloadJson */)>>>::fromRawValue("NativeList", "onEndReached", rawProps, sourceProps.onEndReached)),
|
|
29
|
+
onVisibleRangeChanged(nitro::ReactProp<std::optional<std::function<void(const std::string& /* payloadJson */)>>>::fromRawValue("NativeList", "onVisibleRangeChanged", rawProps, sourceProps.onVisibleRangeChanged)),
|
|
30
|
+
hybridRef(nitro::ReactProp<std::optional<std::function<void(const std::shared_ptr<HybridNativeListSpec>& /* ref */)>>>::fromRawValue("NativeList", "hybridRef", rawProps, sourceProps.hybridRef)) { }
|
|
31
|
+
|
|
32
|
+
bool HybridNativeListProps::filterObjectKeys(const std::string& propName) {
|
|
33
|
+
switch (hashString(propName)) {
|
|
34
|
+
case hashString("snapshotJson"): return true;
|
|
35
|
+
case hashString("onRowAction"): return true;
|
|
36
|
+
case hashString("onActionAnchorInvalidated"): return true;
|
|
37
|
+
case hashString("onSelectionDelta"): return true;
|
|
38
|
+
case hashString("onReorder"): return true;
|
|
39
|
+
case hashString("onEndReached"): return true;
|
|
40
|
+
case hashString("onVisibleRangeChanged"): return true;
|
|
41
|
+
case hashString("hybridRef"): return true;
|
|
42
|
+
default: return false;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
} // namespace margelo::nitro::nativelist::views
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNativeListComponent.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 <NitroModules/ReactProp.hpp>
|
|
11
|
+
#include <NitroModules/ViewComponentDescriptor.hpp>
|
|
12
|
+
#include <NitroModules/ViewPropsHolderState.hpp>
|
|
13
|
+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
14
|
+
#include <react/renderer/components/view/ViewProps.h>
|
|
15
|
+
#include <react/renderer/core/PropsParserContext.h>
|
|
16
|
+
#include <react/renderer/core/RawProps.h>
|
|
17
|
+
|
|
18
|
+
#include <string>
|
|
19
|
+
|
|
20
|
+
#include <string>
|
|
21
|
+
#include <functional>
|
|
22
|
+
#include <optional>
|
|
23
|
+
#include <memory>
|
|
24
|
+
#include "HybridNativeListSpec.hpp"
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::nativelist::views {
|
|
27
|
+
|
|
28
|
+
using namespace facebook;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The name of the actual native View.
|
|
32
|
+
*/
|
|
33
|
+
extern const char HybridNativeListComponentName[];
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Props for the "NativeList" View.
|
|
37
|
+
*/
|
|
38
|
+
class HybridNativeListProps final: public react::ViewProps {
|
|
39
|
+
public:
|
|
40
|
+
HybridNativeListProps() = default;
|
|
41
|
+
HybridNativeListProps(const react::PropsParserContext& context,
|
|
42
|
+
const HybridNativeListProps& sourceProps,
|
|
43
|
+
const react::RawProps& rawProps);
|
|
44
|
+
|
|
45
|
+
public:
|
|
46
|
+
nitro::ReactProp<std::string> snapshotJson;
|
|
47
|
+
nitro::ReactProp<std::optional<std::function<void(const std::string& /* payloadJson */)>>> onRowAction;
|
|
48
|
+
nitro::ReactProp<std::optional<std::function<void(const std::string& /* payloadJson */)>>> onActionAnchorInvalidated;
|
|
49
|
+
nitro::ReactProp<std::optional<std::function<void(const std::string& /* payloadJson */)>>> onSelectionDelta;
|
|
50
|
+
nitro::ReactProp<std::optional<std::function<void(const std::string& /* payloadJson */)>>> onReorder;
|
|
51
|
+
nitro::ReactProp<std::optional<std::function<void(const std::string& /* payloadJson */)>>> onEndReached;
|
|
52
|
+
nitro::ReactProp<std::optional<std::function<void(const std::string& /* payloadJson */)>>> onVisibleRangeChanged;
|
|
53
|
+
nitro::ReactProp<std::optional<std::function<void(const std::shared_ptr<HybridNativeListSpec>& /* ref */)>>> hybridRef;
|
|
54
|
+
|
|
55
|
+
[[nodiscard]]
|
|
56
|
+
bool hasSameProps(const HybridNativeListProps& other) const noexcept {
|
|
57
|
+
return snapshotJson.hasSameValue(other.snapshotJson) &&
|
|
58
|
+
onRowAction.hasSameValue(other.onRowAction) &&
|
|
59
|
+
onActionAnchorInvalidated.hasSameValue(other.onActionAnchorInvalidated) &&
|
|
60
|
+
onSelectionDelta.hasSameValue(other.onSelectionDelta) &&
|
|
61
|
+
onReorder.hasSameValue(other.onReorder) &&
|
|
62
|
+
onEndReached.hasSameValue(other.onEndReached) &&
|
|
63
|
+
onVisibleRangeChanged.hasSameValue(other.onVisibleRangeChanged) &&
|
|
64
|
+
hybridRef.hasSameValue(other.hybridRef);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
[[nodiscard]]
|
|
68
|
+
bool hasAnyProvidedProps() const noexcept {
|
|
69
|
+
return snapshotJson.isProvided() ||
|
|
70
|
+
onRowAction.isProvided() ||
|
|
71
|
+
onActionAnchorInvalidated.isProvided() ||
|
|
72
|
+
onSelectionDelta.isProvided() ||
|
|
73
|
+
onReorder.isProvided() ||
|
|
74
|
+
onEndReached.isProvided() ||
|
|
75
|
+
onVisibleRangeChanged.isProvided() ||
|
|
76
|
+
hybridRef.isProvided();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
private:
|
|
80
|
+
static bool filterObjectKeys(const std::string& propName);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* State for the "NativeList" View.
|
|
85
|
+
*/
|
|
86
|
+
using HybridNativeListState = nitro::ViewPropsHolderState<HybridNativeListProps>;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* The Shadow Node for the "NativeList" View.
|
|
90
|
+
*/
|
|
91
|
+
using HybridNativeListShadowNode = react::ConcreteViewShadowNode<HybridNativeListComponentName /* "HybridNativeList" */,
|
|
92
|
+
HybridNativeListProps /* custom props */,
|
|
93
|
+
react::ViewEventEmitter /* default */,
|
|
94
|
+
HybridNativeListState /* custom state */>;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* The Component Descriptor for the "NativeList" View.
|
|
98
|
+
*/
|
|
99
|
+
using HybridNativeListComponentDescriptor = nitro::ViewComponentDescriptor<HybridNativeListShadowNode>;
|
|
100
|
+
|
|
101
|
+
/* The actual view for "NativeList" needs to be implemented in platform-specific code. */
|
|
102
|
+
|
|
103
|
+
} // namespace margelo::nitro::nativelist::views
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"uiViewClassName": "NativeList",
|
|
3
|
+
"supportsRawText": false,
|
|
4
|
+
"bubblingEventTypes": {},
|
|
5
|
+
"directEventTypes": {},
|
|
6
|
+
"validAttributes": {
|
|
7
|
+
"snapshotJson": true,
|
|
8
|
+
"onRowAction": true,
|
|
9
|
+
"onActionAnchorInvalidated": true,
|
|
10
|
+
"onSelectionDelta": true,
|
|
11
|
+
"onReorder": true,
|
|
12
|
+
"onEndReached": true,
|
|
13
|
+
"onVisibleRangeChanged": true,
|
|
14
|
+
"hybridRef": true
|
|
15
|
+
}
|
|
16
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@onekeyfe/react-native-native-list",
|
|
3
|
+
"version": "3.0.105",
|
|
4
|
+
"description": "Template-driven native RecyclerView and UICollectionView for React Native",
|
|
5
|
+
"source": "./src/index.ts",
|
|
6
|
+
"main": "./lib/module/index.js",
|
|
7
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
8
|
+
"sideEffects": false,
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"source": "./src/index.ts",
|
|
12
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
13
|
+
"default": "./lib/module/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./package.json": "./package.json"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"src",
|
|
19
|
+
"lib",
|
|
20
|
+
"android",
|
|
21
|
+
"ios",
|
|
22
|
+
"common",
|
|
23
|
+
"cpp",
|
|
24
|
+
"nitrogen",
|
|
25
|
+
"nitro.json",
|
|
26
|
+
"docs",
|
|
27
|
+
"react-native.config.js",
|
|
28
|
+
"*.podspec",
|
|
29
|
+
"!ios/build",
|
|
30
|
+
"!android/build",
|
|
31
|
+
"!android/app/build",
|
|
32
|
+
"!**/__tests__",
|
|
33
|
+
"!**/*.map"
|
|
34
|
+
],
|
|
35
|
+
"scripts": {
|
|
36
|
+
"clean": "del-cli lib",
|
|
37
|
+
"prepare": "del-cli lib && bob build && cp -r nitrogen lib/nitrogen",
|
|
38
|
+
"nitrogen": "nitrogen",
|
|
39
|
+
"typecheck": "tsc -b",
|
|
40
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
41
|
+
"test": "jest --runInBand",
|
|
42
|
+
"release": "yarn prepare && npm whoami && npm publish --access public"
|
|
43
|
+
},
|
|
44
|
+
"keywords": [
|
|
45
|
+
"react-native",
|
|
46
|
+
"ios",
|
|
47
|
+
"android",
|
|
48
|
+
"recyclerview",
|
|
49
|
+
"uicollectionview"
|
|
50
|
+
],
|
|
51
|
+
"repository": {
|
|
52
|
+
"type": "git",
|
|
53
|
+
"url": "git+https://github.com/OneKeyHQ/app-modules.git",
|
|
54
|
+
"directory": "native-views/react-native-native-list"
|
|
55
|
+
},
|
|
56
|
+
"author": "OneKey",
|
|
57
|
+
"homepage": "https://github.com/OneKeyHQ/app-modules",
|
|
58
|
+
"license": "MIT",
|
|
59
|
+
"publishConfig": {
|
|
60
|
+
"registry": "https://registry.npmjs.org/",
|
|
61
|
+
"access": "public"
|
|
62
|
+
},
|
|
63
|
+
"devDependencies": {
|
|
64
|
+
"@eslint/compat": "^1.3.2",
|
|
65
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
66
|
+
"@eslint/js": "^9.35.0",
|
|
67
|
+
"@react-native/babel-preset": "0.86.2",
|
|
68
|
+
"@react-native/eslint-config": "0.86.2",
|
|
69
|
+
"@types/jest": "^29.5.14",
|
|
70
|
+
"@types/react": "^19.2.0",
|
|
71
|
+
"del-cli": "^6.0.0",
|
|
72
|
+
"eslint": "^9.35.0",
|
|
73
|
+
"eslint-config-prettier": "^10.1.8",
|
|
74
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
75
|
+
"jest": "^29.7.0",
|
|
76
|
+
"nitrogen": "0.37.0",
|
|
77
|
+
"prettier": "^2.8.8",
|
|
78
|
+
"react": "19.2.3",
|
|
79
|
+
"react-native": "patch:react-native@npm%3A0.86.2#~/.yarn/patches/react-native-npm-0.86.2-c9d546616f.patch",
|
|
80
|
+
"react-native-builder-bob": "^0.40.13",
|
|
81
|
+
"react-native-nitro-modules": "0.37.0",
|
|
82
|
+
"typescript": "^5.9.2"
|
|
83
|
+
},
|
|
84
|
+
"peerDependencies": {
|
|
85
|
+
"@onekeyfe/react-native-image": "3.0.105",
|
|
86
|
+
"react": "*",
|
|
87
|
+
"react-native": "*",
|
|
88
|
+
"react-native-nitro-modules": "0.37.0"
|
|
89
|
+
},
|
|
90
|
+
"react-native-builder-bob": {
|
|
91
|
+
"source": "src",
|
|
92
|
+
"output": "lib",
|
|
93
|
+
"targets": [
|
|
94
|
+
[
|
|
95
|
+
"custom",
|
|
96
|
+
{
|
|
97
|
+
"script": "nitrogen",
|
|
98
|
+
"clean": "nitrogen/"
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
[
|
|
102
|
+
"module",
|
|
103
|
+
{
|
|
104
|
+
"esm": true
|
|
105
|
+
}
|
|
106
|
+
],
|
|
107
|
+
[
|
|
108
|
+
"typescript",
|
|
109
|
+
{
|
|
110
|
+
"project": "tsconfig.build.json"
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
]
|
|
114
|
+
},
|
|
115
|
+
"jest": {
|
|
116
|
+
"preset": "react-native",
|
|
117
|
+
"modulePathIgnorePatterns": [
|
|
118
|
+
"<rootDir>/lib/"
|
|
119
|
+
]
|
|
120
|
+
},
|
|
121
|
+
"prettier": {
|
|
122
|
+
"singleQuote": true,
|
|
123
|
+
"tabWidth": 2,
|
|
124
|
+
"trailingComma": "es5"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = "react-native-native-list"
|
|
7
|
+
s.version = package["version"]
|
|
8
|
+
s.summary = package["description"]
|
|
9
|
+
s.homepage = package["homepage"]
|
|
10
|
+
s.license = package["license"]
|
|
11
|
+
s.authors = package["author"]
|
|
12
|
+
s.ios.deployment_target = "15.5"
|
|
13
|
+
s.module_name = "NativeListModule"
|
|
14
|
+
s.source = { :git => "https://github.com/OneKeyHQ/app-modules.git", :tag => "#{s.version}" }
|
|
15
|
+
s.source_files = ["ios/**/*.{swift,h,m,mm,cpp}"]
|
|
16
|
+
s.resource_bundles = {
|
|
17
|
+
"NativeListResources" => [
|
|
18
|
+
"common/fonts/*.ttf",
|
|
19
|
+
"ios/Resources/NativeListIcons.xcassets"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
s.static_framework = true
|
|
23
|
+
|
|
24
|
+
s.pod_target_xcconfig = {
|
|
25
|
+
"PRODUCT_MODULE_NAME" => "NativeListModule",
|
|
26
|
+
"DEFINES_MODULE" => "YES",
|
|
27
|
+
"SWIFT_OBJC_INTEROP_MODE" => "objcxx",
|
|
28
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++20"
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
s.dependency "OneKeyImage", package["peerDependencies"]["@onekeyfe/react-native-image"]
|
|
32
|
+
s.dependency "React-jsi"
|
|
33
|
+
s.dependency "React-callinvoker"
|
|
34
|
+
|
|
35
|
+
load "nitrogen/generated/ios/NativeListModule+autolinking.rb"
|
|
36
|
+
add_nitrogen_files(s)
|
|
37
|
+
install_modules_dependencies(s)
|
|
38
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const { android } = require('./nitro.json');
|
|
2
|
+
|
|
3
|
+
const androidPackage = [
|
|
4
|
+
'com',
|
|
5
|
+
'margelo',
|
|
6
|
+
'nitro',
|
|
7
|
+
...android.androidNamespace,
|
|
8
|
+
].join('.');
|
|
9
|
+
|
|
10
|
+
module.exports = {
|
|
11
|
+
dependency: {
|
|
12
|
+
platforms: {
|
|
13
|
+
android: {
|
|
14
|
+
packageImportPath: `import ${androidPackage}.NativeListPackage;`,
|
|
15
|
+
packageInstance: 'new NativeListPackage()',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
HybridView,
|
|
3
|
+
HybridViewMethods,
|
|
4
|
+
HybridViewProps,
|
|
5
|
+
} from 'react-native-nitro-modules';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Nitro owns only the React Native host boundary. Snapshot diffing, layout,
|
|
9
|
+
* recycling, selection, and scrolling remain native UICollectionView /
|
|
10
|
+
* RecyclerView work.
|
|
11
|
+
*/
|
|
12
|
+
export interface NativeListNativeProps extends HybridViewProps {
|
|
13
|
+
snapshotJson: string;
|
|
14
|
+
onRowAction?: (payloadJson: string) => void;
|
|
15
|
+
onActionAnchorInvalidated?: (payloadJson: string) => void;
|
|
16
|
+
onSelectionDelta?: (payloadJson: string) => void;
|
|
17
|
+
onReorder?: (payloadJson: string) => void;
|
|
18
|
+
onEndReached?: (payloadJson: string) => void;
|
|
19
|
+
onVisibleRangeChanged?: (payloadJson: string) => void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type NativeListScrollAlignment = 'start' | 'center' | 'end' | 'nearest';
|
|
23
|
+
|
|
24
|
+
export interface NativeListMethods extends HybridViewMethods {
|
|
25
|
+
applySnapshot(snapshotJson: string): void;
|
|
26
|
+
applyPatches(patchesJson: string): void;
|
|
27
|
+
reconcileSelection(selectedKeysJson: string): void;
|
|
28
|
+
scrollToKey(
|
|
29
|
+
key: string,
|
|
30
|
+
animated: boolean,
|
|
31
|
+
alignment: NativeListScrollAlignment,
|
|
32
|
+
viewPosition: number,
|
|
33
|
+
viewOffset: number
|
|
34
|
+
): void;
|
|
35
|
+
scrollToIndex(
|
|
36
|
+
index: number,
|
|
37
|
+
animated: boolean,
|
|
38
|
+
alignment: NativeListScrollAlignment,
|
|
39
|
+
viewPosition: number,
|
|
40
|
+
viewOffset: number
|
|
41
|
+
): void;
|
|
42
|
+
scrollToOffset(offset: number, animated: boolean): void;
|
|
43
|
+
scrollToEnd(animated: boolean): void;
|
|
44
|
+
setActionAnchorState(stateJson: string): void;
|
|
45
|
+
setRefreshing(refreshing: boolean): void;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type NativeList = HybridView<NativeListNativeProps, NativeListMethods>;
|