@onekeyfe/react-native-native-list 3.0.129 → 3.0.131
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/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +15 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRowView.kt +18 -11
- package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +169 -10
- package/ios/HybridNativeList.swift +20 -0
- package/ios/RNCNativeListView.swift +106 -3
- package/lib/module/NativeList.js +6 -1
- package/lib/module/NativeList.web.js +2 -0
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
- package/lib/nitrogen/generated/android/c++/JNativeListKeyboardDismissMode.hpp +61 -0
- package/lib/nitrogen/generated/android/c++/JNativeListKeyboardShouldPersistTaps.hpp +61 -0
- package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +12 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/NativeListKeyboardDismissMode.kt +24 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/NativeListKeyboardShouldPersistTaps.kt +24 -0
- package/lib/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Umbrella.hpp +6 -0
- package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +20 -0
- package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +22 -0
- package/lib/nitrogen/generated/ios/swift/NativeListKeyboardDismissMode.swift +44 -0
- package/lib/nitrogen/generated/ios/swift/NativeListKeyboardShouldPersistTaps.swift +44 -0
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +10 -0
- package/lib/nitrogen/generated/shared/c++/NativeListKeyboardDismissMode.hpp +80 -0
- package/lib/nitrogen/generated/shared/c++/NativeListKeyboardShouldPersistTaps.hpp +80 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +8 -0
- package/lib/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
- package/lib/typescript/src/NativeList.d.ts +1 -1
- package/lib/typescript/src/NativeList.nitro.d.ts +4 -0
- package/lib/typescript/src/NativeList.types.d.ts +9 -0
- package/lib/typescript/src/NativeList.web.d.ts +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
- package/nitrogen/generated/android/c++/JNativeListKeyboardDismissMode.hpp +61 -0
- package/nitrogen/generated/android/c++/JNativeListKeyboardShouldPersistTaps.hpp +61 -0
- package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +12 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/NativeListKeyboardDismissMode.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/NativeListKeyboardShouldPersistTaps.kt +24 -0
- package/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Umbrella.hpp +6 -0
- package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +20 -0
- package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
- package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
- package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +22 -0
- package/nitrogen/generated/ios/swift/NativeListKeyboardDismissMode.swift +44 -0
- package/nitrogen/generated/ios/swift/NativeListKeyboardShouldPersistTaps.swift +44 -0
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +10 -0
- package/nitrogen/generated/shared/c++/NativeListKeyboardDismissMode.hpp +80 -0
- package/nitrogen/generated/shared/c++/NativeListKeyboardShouldPersistTaps.hpp +80 -0
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +8 -0
- package/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
- package/package.json +3 -3
- package/src/NativeList.nitro.ts +9 -0
- package/src/NativeList.tsx +12 -0
- package/src/NativeList.types.ts +14 -0
- package/src/NativeList.web.tsx +4 -0
- package/src/index.ts +2 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NativeListKeyboardShouldPersistTaps.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
|
+
/**
|
|
9
|
+
* Represents the JS union `NativeListKeyboardShouldPersistTaps`, backed by a C++ enum.
|
|
10
|
+
*/
|
|
11
|
+
public typealias NativeListKeyboardShouldPersistTaps = margelo.nitro.nativelist.NativeListKeyboardShouldPersistTaps
|
|
12
|
+
|
|
13
|
+
public extension NativeListKeyboardShouldPersistTaps {
|
|
14
|
+
/**
|
|
15
|
+
* Get a NativeListKeyboardShouldPersistTaps for the given String value, or
|
|
16
|
+
* return `nil` if the given value was invalid/unknown.
|
|
17
|
+
*/
|
|
18
|
+
init?(fromString string: String) {
|
|
19
|
+
switch string {
|
|
20
|
+
case "never":
|
|
21
|
+
self = .never
|
|
22
|
+
case "always":
|
|
23
|
+
self = .always
|
|
24
|
+
case "handled":
|
|
25
|
+
self = .handled
|
|
26
|
+
default:
|
|
27
|
+
return nil
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Get the String value this NativeListKeyboardShouldPersistTaps represents.
|
|
33
|
+
*/
|
|
34
|
+
var stringValue: String {
|
|
35
|
+
switch self {
|
|
36
|
+
case .never:
|
|
37
|
+
return "never"
|
|
38
|
+
case .always:
|
|
39
|
+
return "always"
|
|
40
|
+
case .handled:
|
|
41
|
+
return "handled"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -16,6 +16,10 @@ namespace margelo::nitro::nativelist {
|
|
|
16
16
|
registerHybrids(this, [](Prototype& prototype) {
|
|
17
17
|
prototype.registerHybridGetter("snapshotJson", &HybridNativeListSpec::getSnapshotJson);
|
|
18
18
|
prototype.registerHybridSetter("snapshotJson", &HybridNativeListSpec::setSnapshotJson);
|
|
19
|
+
prototype.registerHybridGetter("keyboardDismissMode", &HybridNativeListSpec::getKeyboardDismissMode);
|
|
20
|
+
prototype.registerHybridSetter("keyboardDismissMode", &HybridNativeListSpec::setKeyboardDismissMode);
|
|
21
|
+
prototype.registerHybridGetter("keyboardShouldPersistTaps", &HybridNativeListSpec::getKeyboardShouldPersistTaps);
|
|
22
|
+
prototype.registerHybridSetter("keyboardShouldPersistTaps", &HybridNativeListSpec::setKeyboardShouldPersistTaps);
|
|
19
23
|
prototype.registerHybridGetter("onRowAction", &HybridNativeListSpec::getOnRowAction);
|
|
20
24
|
prototype.registerHybridSetter("onRowAction", &HybridNativeListSpec::setOnRowAction);
|
|
21
25
|
prototype.registerHybridGetter("onActionAnchorInvalidated", &HybridNativeListSpec::getOnActionAnchorInvalidated);
|
|
@@ -13,10 +13,16 @@
|
|
|
13
13
|
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
14
|
#endif
|
|
15
15
|
|
|
16
|
+
// Forward declaration of `NativeListKeyboardDismissMode` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::nativelist { enum class NativeListKeyboardDismissMode; }
|
|
18
|
+
// Forward declaration of `NativeListKeyboardShouldPersistTaps` to properly resolve imports.
|
|
19
|
+
namespace margelo::nitro::nativelist { enum class NativeListKeyboardShouldPersistTaps; }
|
|
16
20
|
// Forward declaration of `NativeListScrollAlignment` to properly resolve imports.
|
|
17
21
|
namespace margelo::nitro::nativelist { enum class NativeListScrollAlignment; }
|
|
18
22
|
|
|
19
23
|
#include <string>
|
|
24
|
+
#include "NativeListKeyboardDismissMode.hpp"
|
|
25
|
+
#include "NativeListKeyboardShouldPersistTaps.hpp"
|
|
20
26
|
#include <functional>
|
|
21
27
|
#include <optional>
|
|
22
28
|
#include "NativeListScrollAlignment.hpp"
|
|
@@ -50,6 +56,10 @@ namespace margelo::nitro::nativelist {
|
|
|
50
56
|
// Properties
|
|
51
57
|
virtual std::string getSnapshotJson() = 0;
|
|
52
58
|
virtual void setSnapshotJson(const std::string& snapshotJson) = 0;
|
|
59
|
+
virtual NativeListKeyboardDismissMode getKeyboardDismissMode() = 0;
|
|
60
|
+
virtual void setKeyboardDismissMode(NativeListKeyboardDismissMode keyboardDismissMode) = 0;
|
|
61
|
+
virtual NativeListKeyboardShouldPersistTaps getKeyboardShouldPersistTaps() = 0;
|
|
62
|
+
virtual void setKeyboardShouldPersistTaps(NativeListKeyboardShouldPersistTaps keyboardShouldPersistTaps) = 0;
|
|
53
63
|
virtual std::optional<std::function<void(const std::string& /* payloadJson */)>> getOnRowAction() = 0;
|
|
54
64
|
virtual void setOnRowAction(const std::optional<std::function<void(const std::string& /* payloadJson */)>>& onRowAction) = 0;
|
|
55
65
|
virtual std::optional<std::function<void(const std::string& /* payloadJson */)>> getOnActionAnchorInvalidated() = 0;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NativeListKeyboardDismissMode.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 (NativeListKeyboardDismissMode).
|
|
30
|
+
*/
|
|
31
|
+
enum class NativeListKeyboardDismissMode {
|
|
32
|
+
NONE SWIFT_NAME(none) = 0,
|
|
33
|
+
ON_DRAG SWIFT_NAME(onDrag) = 1,
|
|
34
|
+
INTERACTIVE SWIFT_NAME(interactive) = 2,
|
|
35
|
+
} CLOSED_ENUM;
|
|
36
|
+
|
|
37
|
+
} // namespace margelo::nitro::nativelist
|
|
38
|
+
|
|
39
|
+
namespace margelo::nitro {
|
|
40
|
+
|
|
41
|
+
// C++ NativeListKeyboardDismissMode <> JS NativeListKeyboardDismissMode (union)
|
|
42
|
+
template <>
|
|
43
|
+
struct JSIConverter<margelo::nitro::nativelist::NativeListKeyboardDismissMode> final {
|
|
44
|
+
static inline margelo::nitro::nativelist::NativeListKeyboardDismissMode fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
45
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
46
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
47
|
+
case hashString("none"): return margelo::nitro::nativelist::NativeListKeyboardDismissMode::NONE;
|
|
48
|
+
case hashString("on-drag"): return margelo::nitro::nativelist::NativeListKeyboardDismissMode::ON_DRAG;
|
|
49
|
+
case hashString("interactive"): return margelo::nitro::nativelist::NativeListKeyboardDismissMode::INTERACTIVE;
|
|
50
|
+
default: [[unlikely]]
|
|
51
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum NativeListKeyboardDismissMode - invalid value!");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::nativelist::NativeListKeyboardDismissMode arg) {
|
|
55
|
+
switch (arg) {
|
|
56
|
+
case margelo::nitro::nativelist::NativeListKeyboardDismissMode::NONE: return JSIConverter<std::string>::toJSI(runtime, "none");
|
|
57
|
+
case margelo::nitro::nativelist::NativeListKeyboardDismissMode::ON_DRAG: return JSIConverter<std::string>::toJSI(runtime, "on-drag");
|
|
58
|
+
case margelo::nitro::nativelist::NativeListKeyboardDismissMode::INTERACTIVE: return JSIConverter<std::string>::toJSI(runtime, "interactive");
|
|
59
|
+
default: [[unlikely]]
|
|
60
|
+
throw std::invalid_argument("Cannot convert NativeListKeyboardDismissMode to JS - invalid value: "
|
|
61
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
65
|
+
if (!value.isString()) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
69
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
70
|
+
case hashString("none"):
|
|
71
|
+
case hashString("on-drag"):
|
|
72
|
+
case hashString("interactive"):
|
|
73
|
+
return true;
|
|
74
|
+
default:
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NativeListKeyboardShouldPersistTaps.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 (NativeListKeyboardShouldPersistTaps).
|
|
30
|
+
*/
|
|
31
|
+
enum class NativeListKeyboardShouldPersistTaps {
|
|
32
|
+
NEVER SWIFT_NAME(never) = 0,
|
|
33
|
+
ALWAYS SWIFT_NAME(always) = 1,
|
|
34
|
+
HANDLED SWIFT_NAME(handled) = 2,
|
|
35
|
+
} CLOSED_ENUM;
|
|
36
|
+
|
|
37
|
+
} // namespace margelo::nitro::nativelist
|
|
38
|
+
|
|
39
|
+
namespace margelo::nitro {
|
|
40
|
+
|
|
41
|
+
// C++ NativeListKeyboardShouldPersistTaps <> JS NativeListKeyboardShouldPersistTaps (union)
|
|
42
|
+
template <>
|
|
43
|
+
struct JSIConverter<margelo::nitro::nativelist::NativeListKeyboardShouldPersistTaps> final {
|
|
44
|
+
static inline margelo::nitro::nativelist::NativeListKeyboardShouldPersistTaps fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
45
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
46
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
47
|
+
case hashString("never"): return margelo::nitro::nativelist::NativeListKeyboardShouldPersistTaps::NEVER;
|
|
48
|
+
case hashString("always"): return margelo::nitro::nativelist::NativeListKeyboardShouldPersistTaps::ALWAYS;
|
|
49
|
+
case hashString("handled"): return margelo::nitro::nativelist::NativeListKeyboardShouldPersistTaps::HANDLED;
|
|
50
|
+
default: [[unlikely]]
|
|
51
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum NativeListKeyboardShouldPersistTaps - invalid value!");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::nativelist::NativeListKeyboardShouldPersistTaps arg) {
|
|
55
|
+
switch (arg) {
|
|
56
|
+
case margelo::nitro::nativelist::NativeListKeyboardShouldPersistTaps::NEVER: return JSIConverter<std::string>::toJSI(runtime, "never");
|
|
57
|
+
case margelo::nitro::nativelist::NativeListKeyboardShouldPersistTaps::ALWAYS: return JSIConverter<std::string>::toJSI(runtime, "always");
|
|
58
|
+
case margelo::nitro::nativelist::NativeListKeyboardShouldPersistTaps::HANDLED: return JSIConverter<std::string>::toJSI(runtime, "handled");
|
|
59
|
+
default: [[unlikely]]
|
|
60
|
+
throw std::invalid_argument("Cannot convert NativeListKeyboardShouldPersistTaps to JS - invalid value: "
|
|
61
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
65
|
+
if (!value.isString()) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
69
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
70
|
+
case hashString("never"):
|
|
71
|
+
case hashString("always"):
|
|
72
|
+
case hashString("handled"):
|
|
73
|
+
return true;
|
|
74
|
+
default:
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
} // namespace margelo::nitro
|
|
@@ -21,6 +21,8 @@ namespace margelo::nitro::nativelist::views {
|
|
|
21
21
|
const react::RawProps& rawProps):
|
|
22
22
|
react::ViewProps(context, sourceProps, rawProps, filterObjectKeys),
|
|
23
23
|
snapshotJson(nitro::ReactProp<std::string>::fromRawValue("NativeList", "snapshotJson", rawProps, sourceProps.snapshotJson)),
|
|
24
|
+
keyboardDismissMode(nitro::ReactProp<NativeListKeyboardDismissMode>::fromRawValue("NativeList", "keyboardDismissMode", rawProps, sourceProps.keyboardDismissMode)),
|
|
25
|
+
keyboardShouldPersistTaps(nitro::ReactProp<NativeListKeyboardShouldPersistTaps>::fromRawValue("NativeList", "keyboardShouldPersistTaps", rawProps, sourceProps.keyboardShouldPersistTaps)),
|
|
24
26
|
onRowAction(nitro::ReactProp<std::optional<std::function<void(const std::string& /* payloadJson */)>>>::fromRawValue("NativeList", "onRowAction", rawProps, sourceProps.onRowAction)),
|
|
25
27
|
onActionAnchorInvalidated(nitro::ReactProp<std::optional<std::function<void(const std::string& /* payloadJson */)>>>::fromRawValue("NativeList", "onActionAnchorInvalidated", rawProps, sourceProps.onActionAnchorInvalidated)),
|
|
26
28
|
onSelectionDelta(nitro::ReactProp<std::optional<std::function<void(const std::string& /* payloadJson */)>>>::fromRawValue("NativeList", "onSelectionDelta", rawProps, sourceProps.onSelectionDelta)),
|
|
@@ -32,6 +34,8 @@ namespace margelo::nitro::nativelist::views {
|
|
|
32
34
|
bool HybridNativeListProps::filterObjectKeys(const std::string& propName) {
|
|
33
35
|
switch (hashString(propName)) {
|
|
34
36
|
case hashString("snapshotJson"): return true;
|
|
37
|
+
case hashString("keyboardDismissMode"): return true;
|
|
38
|
+
case hashString("keyboardShouldPersistTaps"): return true;
|
|
35
39
|
case hashString("onRowAction"): return true;
|
|
36
40
|
case hashString("onActionAnchorInvalidated"): return true;
|
|
37
41
|
case hashString("onSelectionDelta"): return true;
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
#include <string>
|
|
19
19
|
|
|
20
20
|
#include <string>
|
|
21
|
+
#include "NativeListKeyboardDismissMode.hpp"
|
|
22
|
+
#include "NativeListKeyboardShouldPersistTaps.hpp"
|
|
21
23
|
#include <functional>
|
|
22
24
|
#include <optional>
|
|
23
25
|
#include <memory>
|
|
@@ -44,6 +46,8 @@ namespace margelo::nitro::nativelist::views {
|
|
|
44
46
|
|
|
45
47
|
public:
|
|
46
48
|
nitro::ReactProp<std::string> snapshotJson;
|
|
49
|
+
nitro::ReactProp<NativeListKeyboardDismissMode> keyboardDismissMode;
|
|
50
|
+
nitro::ReactProp<NativeListKeyboardShouldPersistTaps> keyboardShouldPersistTaps;
|
|
47
51
|
nitro::ReactProp<std::optional<std::function<void(const std::string& /* payloadJson */)>>> onRowAction;
|
|
48
52
|
nitro::ReactProp<std::optional<std::function<void(const std::string& /* payloadJson */)>>> onActionAnchorInvalidated;
|
|
49
53
|
nitro::ReactProp<std::optional<std::function<void(const std::string& /* payloadJson */)>>> onSelectionDelta;
|
|
@@ -55,6 +59,8 @@ namespace margelo::nitro::nativelist::views {
|
|
|
55
59
|
[[nodiscard]]
|
|
56
60
|
bool hasSameProps(const HybridNativeListProps& other) const noexcept {
|
|
57
61
|
return snapshotJson.hasSameValue(other.snapshotJson) &&
|
|
62
|
+
keyboardDismissMode.hasSameValue(other.keyboardDismissMode) &&
|
|
63
|
+
keyboardShouldPersistTaps.hasSameValue(other.keyboardShouldPersistTaps) &&
|
|
58
64
|
onRowAction.hasSameValue(other.onRowAction) &&
|
|
59
65
|
onActionAnchorInvalidated.hasSameValue(other.onActionAnchorInvalidated) &&
|
|
60
66
|
onSelectionDelta.hasSameValue(other.onSelectionDelta) &&
|
|
@@ -67,6 +73,8 @@ namespace margelo::nitro::nativelist::views {
|
|
|
67
73
|
[[nodiscard]]
|
|
68
74
|
bool hasAnyProvidedProps() const noexcept {
|
|
69
75
|
return snapshotJson.isProvided() ||
|
|
76
|
+
keyboardDismissMode.isProvided() ||
|
|
77
|
+
keyboardShouldPersistTaps.isProvided() ||
|
|
70
78
|
onRowAction.isProvided() ||
|
|
71
79
|
onActionAnchorInvalidated.isProvided() ||
|
|
72
80
|
onSelectionDelta.isProvided() ||
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/react-native-native-list",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.131",
|
|
4
4
|
"description": "Template-driven native RecyclerView and UICollectionView for React Native",
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
6
|
"main": "./lib/module/index.js",
|
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
"typescript": "^5.9.2"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
|
-
"@onekeyfe/react-native-image": "3.0.
|
|
87
|
-
"@onekeyfe/react-native-native-logger": "3.0.
|
|
86
|
+
"@onekeyfe/react-native-image": "3.0.131",
|
|
87
|
+
"@onekeyfe/react-native-native-logger": "3.0.131",
|
|
88
88
|
"react": "*",
|
|
89
89
|
"react-native": "*",
|
|
90
90
|
"react-native-nitro-modules": "0.37.0"
|
package/src/NativeList.nitro.ts
CHANGED
|
@@ -11,6 +11,8 @@ import type {
|
|
|
11
11
|
*/
|
|
12
12
|
export interface NativeListNativeProps extends HybridViewProps {
|
|
13
13
|
snapshotJson: string;
|
|
14
|
+
keyboardDismissMode: NativeListKeyboardDismissMode;
|
|
15
|
+
keyboardShouldPersistTaps: NativeListKeyboardShouldPersistTaps;
|
|
14
16
|
onRowAction?: (payloadJson: string) => void;
|
|
15
17
|
onActionAnchorInvalidated?: (payloadJson: string) => void;
|
|
16
18
|
onSelectionDelta?: (payloadJson: string) => void;
|
|
@@ -19,6 +21,13 @@ export interface NativeListNativeProps extends HybridViewProps {
|
|
|
19
21
|
onVisibleRangeChanged?: (payloadJson: string) => void;
|
|
20
22
|
}
|
|
21
23
|
|
|
24
|
+
export type NativeListKeyboardDismissMode = 'none' | 'on-drag' | 'interactive';
|
|
25
|
+
|
|
26
|
+
export type NativeListKeyboardShouldPersistTaps =
|
|
27
|
+
| 'never'
|
|
28
|
+
| 'always'
|
|
29
|
+
| 'handled';
|
|
30
|
+
|
|
22
31
|
export type NativeListScrollAlignment = 'start' | 'center' | 'end' | 'nearest';
|
|
23
32
|
|
|
24
33
|
export interface NativeListMethods extends HybridViewMethods {
|
package/src/NativeList.tsx
CHANGED
|
@@ -47,6 +47,8 @@ import {
|
|
|
47
47
|
export type { NativeListProps, NativeListRef } from './NativeList.types';
|
|
48
48
|
export type {
|
|
49
49
|
ActionAnchorState,
|
|
50
|
+
NativeListKeyboardDismissMode,
|
|
51
|
+
NativeListKeyboardShouldPersistTaps,
|
|
50
52
|
ScrollAlignment,
|
|
51
53
|
ScrollPositionOptions,
|
|
52
54
|
ScrollToEndParams,
|
|
@@ -95,6 +97,8 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
95
97
|
{
|
|
96
98
|
snapshot,
|
|
97
99
|
webVirtualizationEnabled: _webVirtualizationEnabled,
|
|
100
|
+
keyboardDismissMode = 'none',
|
|
101
|
+
keyboardShouldPersistTaps = 'never',
|
|
98
102
|
onRowAction,
|
|
99
103
|
onActionAnchorInvalidated,
|
|
100
104
|
onSelectionDelta,
|
|
@@ -111,6 +115,12 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
111
115
|
},
|
|
112
116
|
forwardedRef
|
|
113
117
|
) {
|
|
118
|
+
const normalizedKeyboardShouldPersistTaps =
|
|
119
|
+
keyboardShouldPersistTaps === true
|
|
120
|
+
? 'always'
|
|
121
|
+
: keyboardShouldPersistTaps === false
|
|
122
|
+
? 'never'
|
|
123
|
+
: keyboardShouldPersistTaps;
|
|
114
124
|
const nativeRef = useRef<NativeListMethods | null>(null);
|
|
115
125
|
const callbacksRef = useRef({
|
|
116
126
|
onRowAction,
|
|
@@ -439,6 +449,8 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
439
449
|
{...viewProps}
|
|
440
450
|
{...nativeCallbacks}
|
|
441
451
|
snapshotJson={snapshotJson}
|
|
452
|
+
keyboardDismissMode={keyboardDismissMode}
|
|
453
|
+
keyboardShouldPersistTaps={normalizedKeyboardShouldPersistTaps}
|
|
442
454
|
/>
|
|
443
455
|
);
|
|
444
456
|
}
|
package/src/NativeList.types.ts
CHANGED
|
@@ -19,6 +19,13 @@ export type ActionAnchorState = Readonly<{
|
|
|
19
19
|
|
|
20
20
|
export type ScrollAlignment = 'start' | 'center' | 'end' | 'nearest';
|
|
21
21
|
|
|
22
|
+
export type NativeListKeyboardDismissMode = 'none' | 'on-drag' | 'interactive';
|
|
23
|
+
|
|
24
|
+
export type NativeListKeyboardShouldPersistTaps =
|
|
25
|
+
| 'never'
|
|
26
|
+
| 'always'
|
|
27
|
+
| 'handled';
|
|
28
|
+
|
|
22
29
|
export type ScrollPositionOptions = Readonly<{
|
|
23
30
|
animated?: boolean;
|
|
24
31
|
alignment?: ScrollAlignment;
|
|
@@ -113,6 +120,13 @@ export type NativeListProps = Omit<ViewProps, 'children'> &
|
|
|
113
120
|
snapshot: NativeListSnapshot;
|
|
114
121
|
/** Web only. Defaults to true and is ignored by the native host. */
|
|
115
122
|
webVirtualizationEnabled?: boolean;
|
|
123
|
+
/** Defaults to `none`. `interactive` behaves as `none` on Android. */
|
|
124
|
+
keyboardDismissMode?: NativeListKeyboardDismissMode;
|
|
125
|
+
/**
|
|
126
|
+
* Defaults to `never`. Boolean values are deprecated compatibility aliases:
|
|
127
|
+
* `true` maps to `always` and `false` maps to `never`.
|
|
128
|
+
*/
|
|
129
|
+
keyboardShouldPersistTaps?: NativeListKeyboardShouldPersistTaps | boolean;
|
|
116
130
|
onRowAction?: (event: RowActionEvent) => void;
|
|
117
131
|
onActionAnchorInvalidated?: (event: ActionAnchorInvalidatedEvent) => void;
|
|
118
132
|
onSelectionDelta?: (event: SelectionDeltaEvent) => void;
|
package/src/NativeList.web.tsx
CHANGED
|
@@ -32,6 +32,8 @@ import {
|
|
|
32
32
|
export type { NativeListProps, NativeListRef } from './NativeList.types';
|
|
33
33
|
export type {
|
|
34
34
|
ActionAnchorState,
|
|
35
|
+
NativeListKeyboardDismissMode,
|
|
36
|
+
NativeListKeyboardShouldPersistTaps,
|
|
35
37
|
ScrollAlignment,
|
|
36
38
|
ScrollPositionOptions,
|
|
37
39
|
ScrollToEndParams,
|
|
@@ -81,6 +83,8 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
81
83
|
{
|
|
82
84
|
snapshot,
|
|
83
85
|
webVirtualizationEnabled = true,
|
|
86
|
+
keyboardDismissMode: _keyboardDismissMode,
|
|
87
|
+
keyboardShouldPersistTaps: _keyboardShouldPersistTaps,
|
|
84
88
|
onRowAction,
|
|
85
89
|
onActionAnchorInvalidated,
|
|
86
90
|
onSelectionDelta,
|
package/src/index.ts
CHANGED