@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.
Files changed (62) hide show
  1. package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +15 -0
  2. package/android/src/main/java/com/onekey/nativelist/NativeListRowView.kt +18 -11
  3. package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +169 -10
  4. package/ios/HybridNativeList.swift +20 -0
  5. package/ios/RNCNativeListView.swift +106 -3
  6. package/lib/module/NativeList.js +6 -1
  7. package/lib/module/NativeList.web.js +2 -0
  8. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
  9. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
  10. package/lib/nitrogen/generated/android/c++/JNativeListKeyboardDismissMode.hpp +61 -0
  11. package/lib/nitrogen/generated/android/c++/JNativeListKeyboardShouldPersistTaps.hpp +61 -0
  12. package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
  13. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +12 -0
  14. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/NativeListKeyboardDismissMode.kt +24 -0
  15. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/NativeListKeyboardShouldPersistTaps.kt +24 -0
  16. package/lib/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Umbrella.hpp +6 -0
  17. package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +20 -0
  18. package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
  19. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
  20. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +22 -0
  21. package/lib/nitrogen/generated/ios/swift/NativeListKeyboardDismissMode.swift +44 -0
  22. package/lib/nitrogen/generated/ios/swift/NativeListKeyboardShouldPersistTaps.swift +44 -0
  23. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
  24. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +10 -0
  25. package/lib/nitrogen/generated/shared/c++/NativeListKeyboardDismissMode.hpp +80 -0
  26. package/lib/nitrogen/generated/shared/c++/NativeListKeyboardShouldPersistTaps.hpp +80 -0
  27. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
  28. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +8 -0
  29. package/lib/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
  30. package/lib/typescript/src/NativeList.d.ts +1 -1
  31. package/lib/typescript/src/NativeList.nitro.d.ts +4 -0
  32. package/lib/typescript/src/NativeList.types.d.ts +9 -0
  33. package/lib/typescript/src/NativeList.web.d.ts +1 -1
  34. package/lib/typescript/src/index.d.ts +1 -1
  35. package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
  36. package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
  37. package/nitrogen/generated/android/c++/JNativeListKeyboardDismissMode.hpp +61 -0
  38. package/nitrogen/generated/android/c++/JNativeListKeyboardShouldPersistTaps.hpp +61 -0
  39. package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
  40. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +12 -0
  41. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/NativeListKeyboardDismissMode.kt +24 -0
  42. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/NativeListKeyboardShouldPersistTaps.kt +24 -0
  43. package/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Umbrella.hpp +6 -0
  44. package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +20 -0
  45. package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
  46. package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
  47. package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +22 -0
  48. package/nitrogen/generated/ios/swift/NativeListKeyboardDismissMode.swift +44 -0
  49. package/nitrogen/generated/ios/swift/NativeListKeyboardShouldPersistTaps.swift +44 -0
  50. package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
  51. package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +10 -0
  52. package/nitrogen/generated/shared/c++/NativeListKeyboardDismissMode.hpp +80 -0
  53. package/nitrogen/generated/shared/c++/NativeListKeyboardShouldPersistTaps.hpp +80 -0
  54. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
  55. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +8 -0
  56. package/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
  57. package/package.json +3 -3
  58. package/src/NativeList.nitro.ts +9 -0
  59. package/src/NativeList.tsx +12 -0
  60. package/src/NativeList.types.ts +14 -0
  61. package/src/NativeList.web.tsx +4 -0
  62. package/src/index.ts +2 -0
@@ -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() ||
@@ -5,6 +5,8 @@
5
5
  "directEventTypes": {},
6
6
  "validAttributes": {
7
7
  "snapshotJson": true,
8
+ "keyboardDismissMode": true,
9
+ "keyboardShouldPersistTaps": true,
8
10
  "onRowAction": true,
9
11
  "onActionAnchorInvalidated": true,
10
12
  "onSelectionDelta": true,
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import type { ImageSource } from './models';
3
3
  import type { NativeListProps } from './NativeList.types';
4
4
  export type { NativeListProps, NativeListRef } from './NativeList.types';
5
- export type { ActionAnchorState, ScrollAlignment, ScrollPositionOptions, ScrollToEndParams, ScrollToIndexFailedInfo, ScrollToIndexParams, ScrollToItemParams, ScrollToKeyParams, ScrollToLocationParams, ScrollToOffsetParams, } from './NativeList.types';
5
+ export type { ActionAnchorState, NativeListKeyboardDismissMode, NativeListKeyboardShouldPersistTaps, ScrollAlignment, ScrollPositionOptions, ScrollToEndParams, ScrollToIndexFailedInfo, ScrollToIndexParams, ScrollToItemParams, ScrollToKeyParams, ScrollToLocationParams, ScrollToOffsetParams, } from './NativeList.types';
6
6
  export declare function preloadNativeListAvatarImages(sources: readonly ImageSource[]): Promise<boolean>;
7
7
  export declare const NativeList: React.ForwardRefExoticComponent<NativeListProps & React.RefAttributes<Readonly<{
8
8
  applySnapshot(snapshot: import("./models").NativeListSnapshot): void;
@@ -6,6 +6,8 @@ import type { HybridView, HybridViewMethods, HybridViewProps } from 'react-nativ
6
6
  */
7
7
  export interface NativeListNativeProps extends HybridViewProps {
8
8
  snapshotJson: string;
9
+ keyboardDismissMode: NativeListKeyboardDismissMode;
10
+ keyboardShouldPersistTaps: NativeListKeyboardShouldPersistTaps;
9
11
  onRowAction?: (payloadJson: string) => void;
10
12
  onActionAnchorInvalidated?: (payloadJson: string) => void;
11
13
  onSelectionDelta?: (payloadJson: string) => void;
@@ -13,6 +15,8 @@ export interface NativeListNativeProps extends HybridViewProps {
13
15
  onEndReached?: (payloadJson: string) => void;
14
16
  onVisibleRangeChanged?: (payloadJson: string) => void;
15
17
  }
18
+ export type NativeListKeyboardDismissMode = 'none' | 'on-drag' | 'interactive';
19
+ export type NativeListKeyboardShouldPersistTaps = 'never' | 'always' | 'handled';
16
20
  export type NativeListScrollAlignment = 'start' | 'center' | 'end' | 'nearest';
17
21
  export interface NativeListMethods extends HybridViewMethods {
18
22
  applySnapshot(snapshotJson: string): void;
@@ -6,6 +6,8 @@ export type ActionAnchorState = Readonly<{
6
6
  restoreFocus?: boolean;
7
7
  }>;
8
8
  export type ScrollAlignment = 'start' | 'center' | 'end' | 'nearest';
9
+ export type NativeListKeyboardDismissMode = 'none' | 'on-drag' | 'interactive';
10
+ export type NativeListKeyboardShouldPersistTaps = 'never' | 'always' | 'handled';
9
11
  export type ScrollPositionOptions = Readonly<{
10
12
  animated?: boolean;
11
13
  alignment?: ScrollAlignment;
@@ -74,6 +76,13 @@ export type NativeListProps = Omit<ViewProps, 'children'> & Readonly<{
74
76
  snapshot: NativeListSnapshot;
75
77
  /** Web only. Defaults to true and is ignored by the native host. */
76
78
  webVirtualizationEnabled?: boolean;
79
+ /** Defaults to `none`. `interactive` behaves as `none` on Android. */
80
+ keyboardDismissMode?: NativeListKeyboardDismissMode;
81
+ /**
82
+ * Defaults to `never`. Boolean values are deprecated compatibility aliases:
83
+ * `true` maps to `always` and `false` maps to `never`.
84
+ */
85
+ keyboardShouldPersistTaps?: NativeListKeyboardShouldPersistTaps | boolean;
77
86
  onRowAction?: (event: RowActionEvent) => void;
78
87
  onActionAnchorInvalidated?: (event: ActionAnchorInvalidatedEvent) => void;
79
88
  onSelectionDelta?: (event: SelectionDeltaEvent) => void;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import type { NativeListProps } from './NativeList.types';
3
3
  import type { ImageSource, NativeListSnapshot, RowPatch } from './models';
4
4
  export type { NativeListProps, NativeListRef } from './NativeList.types';
5
- export type { ActionAnchorState, ScrollAlignment, ScrollPositionOptions, ScrollToEndParams, ScrollToIndexFailedInfo, ScrollToIndexParams, ScrollToItemParams, ScrollToKeyParams, ScrollToLocationParams, ScrollToOffsetParams, } from './NativeList.types';
5
+ export type { ActionAnchorState, NativeListKeyboardDismissMode, NativeListKeyboardShouldPersistTaps, ScrollAlignment, ScrollPositionOptions, ScrollToEndParams, ScrollToIndexFailedInfo, ScrollToIndexParams, ScrollToItemParams, ScrollToKeyParams, ScrollToLocationParams, ScrollToOffsetParams, } from './NativeList.types';
6
6
  export declare function preloadNativeListAvatarImages(sources: readonly ImageSource[]): Promise<boolean>;
7
7
  export declare const NativeList: React.ForwardRefExoticComponent<NativeListProps & React.RefAttributes<Readonly<{
8
8
  applySnapshot(snapshot: NativeListSnapshot): void;
@@ -1,5 +1,5 @@
1
1
  export { NativeList, preloadNativeListAvatarImages } from './NativeList';
2
- export type { ActionAnchorState, NativeListProps, NativeListRef, ScrollAlignment, ScrollPositionOptions, ScrollToEndParams, ScrollToIndexFailedInfo, ScrollToIndexParams, ScrollToItemParams, ScrollToKeyParams, ScrollToLocationParams, ScrollToOffsetParams, } from './NativeList';
2
+ export type { ActionAnchorState, NativeListKeyboardDismissMode, NativeListKeyboardShouldPersistTaps, NativeListProps, NativeListRef, ScrollAlignment, ScrollPositionOptions, ScrollToEndParams, ScrollToIndexFailedInfo, ScrollToIndexParams, ScrollToItemParams, ScrollToKeyParams, ScrollToLocationParams, ScrollToOffsetParams, } from './NativeList';
3
3
  export type * from './models';
4
4
  export { applyRowPatches, serializePatches, serializeSnapshot, validatePatches, validateSnapshot, } from './validation';
5
5
  export { checkboxStateForKeys, checkboxStateForSection, isSelectableRow, reduceSelection, selectionStateFromSnapshot, } from './selection';
@@ -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)) {
@@ -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
+ }