@onekeyfe/react-native-native-list 3.0.129 → 3.0.130
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
|
@@ -7,10 +7,18 @@
|
|
|
7
7
|
|
|
8
8
|
#include "JHybridNativeListSpec.hpp"
|
|
9
9
|
|
|
10
|
+
// Forward declaration of `NativeListKeyboardDismissMode` to properly resolve imports.
|
|
11
|
+
namespace margelo::nitro::nativelist { enum class NativeListKeyboardDismissMode; }
|
|
12
|
+
// Forward declaration of `NativeListKeyboardShouldPersistTaps` to properly resolve imports.
|
|
13
|
+
namespace margelo::nitro::nativelist { enum class NativeListKeyboardShouldPersistTaps; }
|
|
10
14
|
// Forward declaration of `NativeListScrollAlignment` to properly resolve imports.
|
|
11
15
|
namespace margelo::nitro::nativelist { enum class NativeListScrollAlignment; }
|
|
12
16
|
|
|
13
17
|
#include <string>
|
|
18
|
+
#include "NativeListKeyboardDismissMode.hpp"
|
|
19
|
+
#include "JNativeListKeyboardDismissMode.hpp"
|
|
20
|
+
#include "NativeListKeyboardShouldPersistTaps.hpp"
|
|
21
|
+
#include "JNativeListKeyboardShouldPersistTaps.hpp"
|
|
14
22
|
#include <functional>
|
|
15
23
|
#include <optional>
|
|
16
24
|
#include "JFunc_void_std__string.hpp"
|
|
@@ -57,6 +65,24 @@ namespace margelo::nitro::nativelist {
|
|
|
57
65
|
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* snapshotJson */)>("setSnapshotJson");
|
|
58
66
|
method(_javaPart, jni::make_jstring(snapshotJson));
|
|
59
67
|
}
|
|
68
|
+
NativeListKeyboardDismissMode JHybridNativeListSpec::getKeyboardDismissMode() {
|
|
69
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JNativeListKeyboardDismissMode>()>("getKeyboardDismissMode");
|
|
70
|
+
auto __result = method(_javaPart);
|
|
71
|
+
return __result->toCpp();
|
|
72
|
+
}
|
|
73
|
+
void JHybridNativeListSpec::setKeyboardDismissMode(NativeListKeyboardDismissMode keyboardDismissMode) {
|
|
74
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JNativeListKeyboardDismissMode> /* keyboardDismissMode */)>("setKeyboardDismissMode");
|
|
75
|
+
method(_javaPart, JNativeListKeyboardDismissMode::fromCpp(keyboardDismissMode));
|
|
76
|
+
}
|
|
77
|
+
NativeListKeyboardShouldPersistTaps JHybridNativeListSpec::getKeyboardShouldPersistTaps() {
|
|
78
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JNativeListKeyboardShouldPersistTaps>()>("getKeyboardShouldPersistTaps");
|
|
79
|
+
auto __result = method(_javaPart);
|
|
80
|
+
return __result->toCpp();
|
|
81
|
+
}
|
|
82
|
+
void JHybridNativeListSpec::setKeyboardShouldPersistTaps(NativeListKeyboardShouldPersistTaps keyboardShouldPersistTaps) {
|
|
83
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JNativeListKeyboardShouldPersistTaps> /* keyboardShouldPersistTaps */)>("setKeyboardShouldPersistTaps");
|
|
84
|
+
method(_javaPart, JNativeListKeyboardShouldPersistTaps::fromCpp(keyboardShouldPersistTaps));
|
|
85
|
+
}
|
|
60
86
|
std::optional<std::function<void(const std::string& /* payloadJson */)>> JHybridNativeListSpec::getOnRowAction() {
|
|
61
87
|
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JFunc_void_std__string::javaobject>()>("getOnRowAction_cxx");
|
|
62
88
|
auto __result = method(_javaPart);
|
|
@@ -52,6 +52,10 @@ namespace margelo::nitro::nativelist {
|
|
|
52
52
|
// Properties
|
|
53
53
|
std::string getSnapshotJson() override;
|
|
54
54
|
void setSnapshotJson(const std::string& snapshotJson) override;
|
|
55
|
+
NativeListKeyboardDismissMode getKeyboardDismissMode() override;
|
|
56
|
+
void setKeyboardDismissMode(NativeListKeyboardDismissMode keyboardDismissMode) override;
|
|
57
|
+
NativeListKeyboardShouldPersistTaps getKeyboardShouldPersistTaps() override;
|
|
58
|
+
void setKeyboardShouldPersistTaps(NativeListKeyboardShouldPersistTaps keyboardShouldPersistTaps) override;
|
|
55
59
|
std::optional<std::function<void(const std::string& /* payloadJson */)>> getOnRowAction() override;
|
|
56
60
|
void setOnRowAction(const std::optional<std::function<void(const std::string& /* payloadJson */)>>& onRowAction) override;
|
|
57
61
|
std::optional<std::function<void(const std::string& /* payloadJson */)>> getOnActionAnchorInvalidated() override;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JNativeListKeyboardDismissMode.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "NativeListKeyboardDismissMode.hpp"
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro::nativelist {
|
|
14
|
+
|
|
15
|
+
using namespace facebook;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The C++ JNI bridge between the C++ enum "NativeListKeyboardDismissMode" and the Kotlin enum "NativeListKeyboardDismissMode".
|
|
19
|
+
*/
|
|
20
|
+
struct JNativeListKeyboardDismissMode final: public jni::JavaClass<JNativeListKeyboardDismissMode> {
|
|
21
|
+
public:
|
|
22
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nativelist/NativeListKeyboardDismissMode;";
|
|
23
|
+
|
|
24
|
+
public:
|
|
25
|
+
/**
|
|
26
|
+
* Convert this Java/Kotlin-based enum to the C++ enum NativeListKeyboardDismissMode.
|
|
27
|
+
*/
|
|
28
|
+
[[maybe_unused]]
|
|
29
|
+
[[nodiscard]]
|
|
30
|
+
NativeListKeyboardDismissMode toCpp() const {
|
|
31
|
+
static const auto clazz = javaClassStatic();
|
|
32
|
+
static const auto fieldOrdinal = clazz->getField<int>("value");
|
|
33
|
+
int ordinal = this->getFieldValue(fieldOrdinal);
|
|
34
|
+
return static_cast<NativeListKeyboardDismissMode>(ordinal);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public:
|
|
38
|
+
/**
|
|
39
|
+
* Create a Java/Kotlin-based enum with the given C++ enum's value.
|
|
40
|
+
*/
|
|
41
|
+
[[maybe_unused]]
|
|
42
|
+
static jni::alias_ref<JNativeListKeyboardDismissMode> fromCpp(NativeListKeyboardDismissMode value) {
|
|
43
|
+
static const auto clazz = javaClassStatic();
|
|
44
|
+
switch (value) {
|
|
45
|
+
case NativeListKeyboardDismissMode::NONE:
|
|
46
|
+
static const auto fieldNONE = clazz->getStaticField<JNativeListKeyboardDismissMode>("NONE");
|
|
47
|
+
return clazz->getStaticFieldValue(fieldNONE);
|
|
48
|
+
case NativeListKeyboardDismissMode::ON_DRAG:
|
|
49
|
+
static const auto fieldON_DRAG = clazz->getStaticField<JNativeListKeyboardDismissMode>("ON_DRAG");
|
|
50
|
+
return clazz->getStaticFieldValue(fieldON_DRAG);
|
|
51
|
+
case NativeListKeyboardDismissMode::INTERACTIVE:
|
|
52
|
+
static const auto fieldINTERACTIVE = clazz->getStaticField<JNativeListKeyboardDismissMode>("INTERACTIVE");
|
|
53
|
+
return clazz->getStaticFieldValue(fieldINTERACTIVE);
|
|
54
|
+
default:
|
|
55
|
+
std::string stringValue = std::to_string(static_cast<int>(value));
|
|
56
|
+
throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
} // namespace margelo::nitro::nativelist
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JNativeListKeyboardShouldPersistTaps.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "NativeListKeyboardShouldPersistTaps.hpp"
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro::nativelist {
|
|
14
|
+
|
|
15
|
+
using namespace facebook;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The C++ JNI bridge between the C++ enum "NativeListKeyboardShouldPersistTaps" and the Kotlin enum "NativeListKeyboardShouldPersistTaps".
|
|
19
|
+
*/
|
|
20
|
+
struct JNativeListKeyboardShouldPersistTaps final: public jni::JavaClass<JNativeListKeyboardShouldPersistTaps> {
|
|
21
|
+
public:
|
|
22
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nativelist/NativeListKeyboardShouldPersistTaps;";
|
|
23
|
+
|
|
24
|
+
public:
|
|
25
|
+
/**
|
|
26
|
+
* Convert this Java/Kotlin-based enum to the C++ enum NativeListKeyboardShouldPersistTaps.
|
|
27
|
+
*/
|
|
28
|
+
[[maybe_unused]]
|
|
29
|
+
[[nodiscard]]
|
|
30
|
+
NativeListKeyboardShouldPersistTaps toCpp() const {
|
|
31
|
+
static const auto clazz = javaClassStatic();
|
|
32
|
+
static const auto fieldOrdinal = clazz->getField<int>("value");
|
|
33
|
+
int ordinal = this->getFieldValue(fieldOrdinal);
|
|
34
|
+
return static_cast<NativeListKeyboardShouldPersistTaps>(ordinal);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public:
|
|
38
|
+
/**
|
|
39
|
+
* Create a Java/Kotlin-based enum with the given C++ enum's value.
|
|
40
|
+
*/
|
|
41
|
+
[[maybe_unused]]
|
|
42
|
+
static jni::alias_ref<JNativeListKeyboardShouldPersistTaps> fromCpp(NativeListKeyboardShouldPersistTaps value) {
|
|
43
|
+
static const auto clazz = javaClassStatic();
|
|
44
|
+
switch (value) {
|
|
45
|
+
case NativeListKeyboardShouldPersistTaps::NEVER:
|
|
46
|
+
static const auto fieldNEVER = clazz->getStaticField<JNativeListKeyboardShouldPersistTaps>("NEVER");
|
|
47
|
+
return clazz->getStaticFieldValue(fieldNEVER);
|
|
48
|
+
case NativeListKeyboardShouldPersistTaps::ALWAYS:
|
|
49
|
+
static const auto fieldALWAYS = clazz->getStaticField<JNativeListKeyboardShouldPersistTaps>("ALWAYS");
|
|
50
|
+
return clazz->getStaticFieldValue(fieldALWAYS);
|
|
51
|
+
case NativeListKeyboardShouldPersistTaps::HANDLED:
|
|
52
|
+
static const auto fieldHANDLED = clazz->getStaticField<JNativeListKeyboardShouldPersistTaps>("HANDLED");
|
|
53
|
+
return clazz->getStaticFieldValue(fieldHANDLED);
|
|
54
|
+
default:
|
|
55
|
+
std::string stringValue = std::to_string(static_cast<int>(value));
|
|
56
|
+
throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
} // namespace margelo::nitro::nativelist
|
|
@@ -58,6 +58,16 @@ void JHybridNativeListStateUpdater::updateViewProps(jni::alias_ref<jni::JClass>
|
|
|
58
58
|
: !newProps->snapshotJson.hasSameValue(oldProps->snapshotJson)) {
|
|
59
59
|
hybridView->setSnapshotJson(newProps->snapshotJson.get());
|
|
60
60
|
}
|
|
61
|
+
if (oldProps == nullptr
|
|
62
|
+
? newProps->keyboardDismissMode.isProvided()
|
|
63
|
+
: !newProps->keyboardDismissMode.hasSameValue(oldProps->keyboardDismissMode)) {
|
|
64
|
+
hybridView->setKeyboardDismissMode(newProps->keyboardDismissMode.get());
|
|
65
|
+
}
|
|
66
|
+
if (oldProps == nullptr
|
|
67
|
+
? newProps->keyboardShouldPersistTaps.isProvided()
|
|
68
|
+
: !newProps->keyboardShouldPersistTaps.hasSameValue(oldProps->keyboardShouldPersistTaps)) {
|
|
69
|
+
hybridView->setKeyboardShouldPersistTaps(newProps->keyboardShouldPersistTaps.get());
|
|
70
|
+
}
|
|
61
71
|
if (oldProps == nullptr
|
|
62
72
|
? newProps->onRowAction.isProvided()
|
|
63
73
|
: !newProps->onRowAction.hasSameValue(oldProps->onRowAction)) {
|
package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt
CHANGED
|
@@ -33,6 +33,18 @@ abstract class HybridNativeListSpec: HybridView() {
|
|
|
33
33
|
@set:Keep
|
|
34
34
|
abstract var snapshotJson: String
|
|
35
35
|
|
|
36
|
+
@get:DoNotStrip
|
|
37
|
+
@get:Keep
|
|
38
|
+
@set:DoNotStrip
|
|
39
|
+
@set:Keep
|
|
40
|
+
abstract var keyboardDismissMode: NativeListKeyboardDismissMode
|
|
41
|
+
|
|
42
|
+
@get:DoNotStrip
|
|
43
|
+
@get:Keep
|
|
44
|
+
@set:DoNotStrip
|
|
45
|
+
@set:Keep
|
|
46
|
+
abstract var keyboardShouldPersistTaps: NativeListKeyboardShouldPersistTaps
|
|
47
|
+
|
|
36
48
|
abstract var onRowAction: ((payloadJson: String) -> Unit)?
|
|
37
49
|
|
|
38
50
|
private var onRowAction_cxx: Func_void_std__string?
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NativeListKeyboardDismissMode.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.nativelist
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Represents the JavaScript enum/union "NativeListKeyboardDismissMode".
|
|
15
|
+
*/
|
|
16
|
+
@DoNotStrip
|
|
17
|
+
@Keep
|
|
18
|
+
enum class NativeListKeyboardDismissMode(@DoNotStrip @Keep val value: Int) {
|
|
19
|
+
NONE(0),
|
|
20
|
+
ON_DRAG(1),
|
|
21
|
+
INTERACTIVE(2);
|
|
22
|
+
|
|
23
|
+
companion object
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NativeListKeyboardShouldPersistTaps.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.nativelist
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Represents the JavaScript enum/union "NativeListKeyboardShouldPersistTaps".
|
|
15
|
+
*/
|
|
16
|
+
@DoNotStrip
|
|
17
|
+
@Keep
|
|
18
|
+
enum class NativeListKeyboardShouldPersistTaps(@DoNotStrip @Keep val value: Int) {
|
|
19
|
+
NEVER(0),
|
|
20
|
+
ALWAYS(1),
|
|
21
|
+
HANDLED(2);
|
|
22
|
+
|
|
23
|
+
companion object
|
|
24
|
+
}
|
|
@@ -10,11 +10,17 @@
|
|
|
10
10
|
// Forward declarations of C++ defined types
|
|
11
11
|
// Forward declaration of `HybridNativeListSpec` to properly resolve imports.
|
|
12
12
|
namespace margelo::nitro::nativelist { class HybridNativeListSpec; }
|
|
13
|
+
// Forward declaration of `NativeListKeyboardDismissMode` to properly resolve imports.
|
|
14
|
+
namespace margelo::nitro::nativelist { enum class NativeListKeyboardDismissMode; }
|
|
15
|
+
// Forward declaration of `NativeListKeyboardShouldPersistTaps` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::nativelist { enum class NativeListKeyboardShouldPersistTaps; }
|
|
13
17
|
// Forward declaration of `NativeListScrollAlignment` to properly resolve imports.
|
|
14
18
|
namespace margelo::nitro::nativelist { enum class NativeListScrollAlignment; }
|
|
15
19
|
|
|
16
20
|
// Include C++ defined types
|
|
17
21
|
#include "HybridNativeListSpec.hpp"
|
|
22
|
+
#include "NativeListKeyboardDismissMode.hpp"
|
|
23
|
+
#include "NativeListKeyboardShouldPersistTaps.hpp"
|
|
18
24
|
#include "NativeListScrollAlignment.hpp"
|
|
19
25
|
#include <NitroModules/Result.hpp>
|
|
20
26
|
#include <exception>
|
|
@@ -12,10 +12,16 @@
|
|
|
12
12
|
// Forward declaration of `HybridNativeListSpec_cxx` to properly resolve imports.
|
|
13
13
|
namespace NativeListModule { class HybridNativeListSpec_cxx; }
|
|
14
14
|
|
|
15
|
+
// Forward declaration of `NativeListKeyboardDismissMode` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::nativelist { enum class NativeListKeyboardDismissMode; }
|
|
17
|
+
// Forward declaration of `NativeListKeyboardShouldPersistTaps` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::nativelist { enum class NativeListKeyboardShouldPersistTaps; }
|
|
15
19
|
// Forward declaration of `NativeListScrollAlignment` to properly resolve imports.
|
|
16
20
|
namespace margelo::nitro::nativelist { enum class NativeListScrollAlignment; }
|
|
17
21
|
|
|
18
22
|
#include <string>
|
|
23
|
+
#include "NativeListKeyboardDismissMode.hpp"
|
|
24
|
+
#include "NativeListKeyboardShouldPersistTaps.hpp"
|
|
19
25
|
#include <functional>
|
|
20
26
|
#include <optional>
|
|
21
27
|
#include "NativeListScrollAlignment.hpp"
|
|
@@ -73,6 +79,20 @@ namespace margelo::nitro::nativelist {
|
|
|
73
79
|
inline void setSnapshotJson(const std::string& snapshotJson) noexcept override {
|
|
74
80
|
_swiftPart.setSnapshotJson(snapshotJson);
|
|
75
81
|
}
|
|
82
|
+
inline NativeListKeyboardDismissMode getKeyboardDismissMode() noexcept override {
|
|
83
|
+
auto __result = _swiftPart.getKeyboardDismissMode();
|
|
84
|
+
return static_cast<NativeListKeyboardDismissMode>(__result);
|
|
85
|
+
}
|
|
86
|
+
inline void setKeyboardDismissMode(NativeListKeyboardDismissMode keyboardDismissMode) noexcept override {
|
|
87
|
+
_swiftPart.setKeyboardDismissMode(static_cast<int>(keyboardDismissMode));
|
|
88
|
+
}
|
|
89
|
+
inline NativeListKeyboardShouldPersistTaps getKeyboardShouldPersistTaps() noexcept override {
|
|
90
|
+
auto __result = _swiftPart.getKeyboardShouldPersistTaps();
|
|
91
|
+
return static_cast<NativeListKeyboardShouldPersistTaps>(__result);
|
|
92
|
+
}
|
|
93
|
+
inline void setKeyboardShouldPersistTaps(NativeListKeyboardShouldPersistTaps keyboardShouldPersistTaps) noexcept override {
|
|
94
|
+
_swiftPart.setKeyboardShouldPersistTaps(static_cast<int>(keyboardShouldPersistTaps));
|
|
95
|
+
}
|
|
76
96
|
inline std::optional<std::function<void(const std::string& /* payloadJson */)>> getOnRowAction() noexcept override {
|
|
77
97
|
auto __result = _swiftPart.getOnRowAction();
|
|
78
98
|
return __result;
|
|
@@ -104,6 +104,18 @@ using namespace margelo::nitro::nativelist::views;
|
|
|
104
104
|
: !newViewProps.snapshotJson.hasSameValue(oldViewProps->snapshotJson)) {
|
|
105
105
|
swiftPart.setSnapshotJson(newViewProps.snapshotJson.get());
|
|
106
106
|
}
|
|
107
|
+
// keyboardDismissMode: enum
|
|
108
|
+
if (oldViewProps == nullptr
|
|
109
|
+
? newViewProps.keyboardDismissMode.isProvided()
|
|
110
|
+
: !newViewProps.keyboardDismissMode.hasSameValue(oldViewProps->keyboardDismissMode)) {
|
|
111
|
+
swiftPart.setKeyboardDismissMode(static_cast<int>(newViewProps.keyboardDismissMode.get()));
|
|
112
|
+
}
|
|
113
|
+
// keyboardShouldPersistTaps: enum
|
|
114
|
+
if (oldViewProps == nullptr
|
|
115
|
+
? newViewProps.keyboardShouldPersistTaps.isProvided()
|
|
116
|
+
: !newViewProps.keyboardShouldPersistTaps.hasSameValue(oldViewProps->keyboardShouldPersistTaps)) {
|
|
117
|
+
swiftPart.setKeyboardShouldPersistTaps(static_cast<int>(newViewProps.keyboardShouldPersistTaps.get()));
|
|
118
|
+
}
|
|
107
119
|
// onRowAction: optional
|
|
108
120
|
if (oldViewProps == nullptr
|
|
109
121
|
? newViewProps.onRowAction.isProvided()
|
|
@@ -11,6 +11,8 @@ import NitroModules
|
|
|
11
11
|
public protocol HybridNativeListSpec_protocol: HybridObject, HybridView {
|
|
12
12
|
// Properties
|
|
13
13
|
var snapshotJson: String { get set }
|
|
14
|
+
var keyboardDismissMode: NativeListKeyboardDismissMode { get set }
|
|
15
|
+
var keyboardShouldPersistTaps: NativeListKeyboardShouldPersistTaps { get set }
|
|
14
16
|
var onRowAction: ((_ payloadJson: String) -> Void)? { get set }
|
|
15
17
|
var onActionAnchorInvalidated: ((_ payloadJson: String) -> Void)? { get set }
|
|
16
18
|
var onSelectionDelta: ((_ payloadJson: String) -> Void)? { get set }
|
|
@@ -132,6 +132,28 @@ open class HybridNativeListSpec_cxx {
|
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
+
public final var keyboardDismissMode: Int32 {
|
|
136
|
+
@inline(__always)
|
|
137
|
+
get {
|
|
138
|
+
return self.__implementation.keyboardDismissMode.rawValue
|
|
139
|
+
}
|
|
140
|
+
@inline(__always)
|
|
141
|
+
set {
|
|
142
|
+
self.__implementation.keyboardDismissMode = margelo.nitro.nativelist.NativeListKeyboardDismissMode(rawValue: newValue)!
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
public final var keyboardShouldPersistTaps: Int32 {
|
|
147
|
+
@inline(__always)
|
|
148
|
+
get {
|
|
149
|
+
return self.__implementation.keyboardShouldPersistTaps.rawValue
|
|
150
|
+
}
|
|
151
|
+
@inline(__always)
|
|
152
|
+
set {
|
|
153
|
+
self.__implementation.keyboardShouldPersistTaps = margelo.nitro.nativelist.NativeListKeyboardShouldPersistTaps(rawValue: newValue)!
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
135
157
|
public final var onRowAction: bridge.std__optional_std__function_void_const_std__string_____payloadJson______ {
|
|
136
158
|
@inline(__always)
|
|
137
159
|
get {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NativeListKeyboardDismissMode.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 `NativeListKeyboardDismissMode`, backed by a C++ enum.
|
|
10
|
+
*/
|
|
11
|
+
public typealias NativeListKeyboardDismissMode = margelo.nitro.nativelist.NativeListKeyboardDismissMode
|
|
12
|
+
|
|
13
|
+
public extension NativeListKeyboardDismissMode {
|
|
14
|
+
/**
|
|
15
|
+
* Get a NativeListKeyboardDismissMode 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 "none":
|
|
21
|
+
self = .none
|
|
22
|
+
case "on-drag":
|
|
23
|
+
self = .onDrag
|
|
24
|
+
case "interactive":
|
|
25
|
+
self = .interactive
|
|
26
|
+
default:
|
|
27
|
+
return nil
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Get the String value this NativeListKeyboardDismissMode represents.
|
|
33
|
+
*/
|
|
34
|
+
var stringValue: String {
|
|
35
|
+
switch self {
|
|
36
|
+
case .none:
|
|
37
|
+
return "none"
|
|
38
|
+
case .onDrag:
|
|
39
|
+
return "on-drag"
|
|
40
|
+
case .interactive:
|
|
41
|
+
return "interactive"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -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
|