aix 0.6.2 → 0.7.1-alpha.1

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.
@@ -219,7 +219,7 @@ class HybridAixComposer: HybridAixComposerSpec {
219
219
  return
220
220
  }
221
221
 
222
- guard let settings = stickToKeyboard, settings.enabled else {
222
+ guard let settings = stickToKeyboard, settings.enabled == true else {
223
223
  targetView.transform = .identity
224
224
  return
225
225
  }
@@ -31,14 +31,14 @@ namespace margelo::nitro::aix {
31
31
  [[nodiscard]]
32
32
  AixScrollOnFooterSizeUpdate toCpp() const {
33
33
  static const auto clazz = javaClassStatic();
34
- static const auto fieldEnabled = clazz->getField<jboolean>("enabled");
35
- jboolean enabled = this->getFieldValue(fieldEnabled);
34
+ static const auto fieldEnabled = clazz->getField<jni::JBoolean>("enabled");
35
+ jni::local_ref<jni::JBoolean> enabled = this->getFieldValue(fieldEnabled);
36
36
  static const auto fieldScrolledToEndThreshold = clazz->getField<jni::JDouble>("scrolledToEndThreshold");
37
37
  jni::local_ref<jni::JDouble> scrolledToEndThreshold = this->getFieldValue(fieldScrolledToEndThreshold);
38
38
  static const auto fieldAnimated = clazz->getField<jni::JBoolean>("animated");
39
39
  jni::local_ref<jni::JBoolean> animated = this->getFieldValue(fieldAnimated);
40
40
  return AixScrollOnFooterSizeUpdate(
41
- static_cast<bool>(enabled),
41
+ enabled != nullptr ? std::make_optional(static_cast<bool>(enabled->value())) : std::nullopt,
42
42
  scrolledToEndThreshold != nullptr ? std::make_optional(scrolledToEndThreshold->value()) : std::nullopt,
43
43
  animated != nullptr ? std::make_optional(static_cast<bool>(animated->value())) : std::nullopt
44
44
  );
@@ -50,12 +50,12 @@ namespace margelo::nitro::aix {
50
50
  */
51
51
  [[maybe_unused]]
52
52
  static jni::local_ref<JAixScrollOnFooterSizeUpdate::javaobject> fromCpp(const AixScrollOnFooterSizeUpdate& value) {
53
- using JSignature = JAixScrollOnFooterSizeUpdate(jboolean, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JBoolean>);
53
+ using JSignature = JAixScrollOnFooterSizeUpdate(jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JBoolean>);
54
54
  static const auto clazz = javaClassStatic();
55
55
  static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
56
56
  return create(
57
57
  clazz,
58
- value.enabled,
58
+ value.enabled.has_value() ? jni::JBoolean::valueOf(value.enabled.value()) : nullptr,
59
59
  value.scrolledToEndThreshold.has_value() ? jni::JDouble::valueOf(value.scrolledToEndThreshold.value()) : nullptr,
60
60
  value.animated.has_value() ? jni::JBoolean::valueOf(value.animated.value()) : nullptr
61
61
  );
@@ -33,12 +33,12 @@ namespace margelo::nitro::aix {
33
33
  [[nodiscard]]
34
34
  AixStickToKeyboard toCpp() const {
35
35
  static const auto clazz = javaClassStatic();
36
- static const auto fieldEnabled = clazz->getField<jboolean>("enabled");
37
- jboolean enabled = this->getFieldValue(fieldEnabled);
36
+ static const auto fieldEnabled = clazz->getField<jni::JBoolean>("enabled");
37
+ jni::local_ref<jni::JBoolean> enabled = this->getFieldValue(fieldEnabled);
38
38
  static const auto fieldOffset = clazz->getField<JAixStickToKeyboardOffset>("offset");
39
39
  jni::local_ref<JAixStickToKeyboardOffset> offset = this->getFieldValue(fieldOffset);
40
40
  return AixStickToKeyboard(
41
- static_cast<bool>(enabled),
41
+ enabled != nullptr ? std::make_optional(static_cast<bool>(enabled->value())) : std::nullopt,
42
42
  offset != nullptr ? std::make_optional(offset->toCpp()) : std::nullopt
43
43
  );
44
44
  }
@@ -49,12 +49,12 @@ namespace margelo::nitro::aix {
49
49
  */
50
50
  [[maybe_unused]]
51
51
  static jni::local_ref<JAixStickToKeyboard::javaobject> fromCpp(const AixStickToKeyboard& value) {
52
- using JSignature = JAixStickToKeyboard(jboolean, jni::alias_ref<JAixStickToKeyboardOffset>);
52
+ using JSignature = JAixStickToKeyboard(jni::alias_ref<jni::JBoolean>, jni::alias_ref<JAixStickToKeyboardOffset>);
53
53
  static const auto clazz = javaClassStatic();
54
54
  static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
55
55
  return create(
56
56
  clazz,
57
- value.enabled,
57
+ value.enabled.has_value() ? jni::JBoolean::valueOf(value.enabled.value()) : nullptr,
58
58
  value.offset.has_value() ? JAixStickToKeyboardOffset::fromCpp(value.offset.value()) : nullptr
59
59
  );
60
60
  }
@@ -19,7 +19,7 @@ import com.facebook.proguard.annotations.DoNotStrip
19
19
  data class AixScrollOnFooterSizeUpdate(
20
20
  @DoNotStrip
21
21
  @Keep
22
- val enabled: Boolean,
22
+ val enabled: Boolean?,
23
23
  @DoNotStrip
24
24
  @Keep
25
25
  val scrolledToEndThreshold: Double?,
@@ -37,7 +37,7 @@ data class AixScrollOnFooterSizeUpdate(
37
37
  @Keep
38
38
  @Suppress("unused")
39
39
  @JvmStatic
40
- private fun fromCpp(enabled: Boolean, scrolledToEndThreshold: Double?, animated: Boolean?): AixScrollOnFooterSizeUpdate {
40
+ private fun fromCpp(enabled: Boolean?, scrolledToEndThreshold: Double?, animated: Boolean?): AixScrollOnFooterSizeUpdate {
41
41
  return AixScrollOnFooterSizeUpdate(enabled, scrolledToEndThreshold, animated)
42
42
  }
43
43
  }
@@ -19,7 +19,7 @@ import com.facebook.proguard.annotations.DoNotStrip
19
19
  data class AixStickToKeyboard(
20
20
  @DoNotStrip
21
21
  @Keep
22
- val enabled: Boolean,
22
+ val enabled: Boolean?,
23
23
  @DoNotStrip
24
24
  @Keep
25
25
  val offset: AixStickToKeyboardOffset?
@@ -34,7 +34,7 @@ data class AixStickToKeyboard(
34
34
  @Keep
35
35
  @Suppress("unused")
36
36
  @JvmStatic
37
- private fun fromCpp(enabled: Boolean, offset: AixStickToKeyboardOffset?): AixStickToKeyboard {
37
+ private fun fromCpp(enabled: Boolean?, offset: AixStickToKeyboardOffset?): AixStickToKeyboard {
38
38
  return AixStickToKeyboard(enabled, offset)
39
39
  }
40
40
  }
@@ -78,33 +78,33 @@ namespace Aix { class HybridAixSpec_cxx; }
78
78
  */
79
79
  namespace margelo::nitro::aix::bridge::swift {
80
80
 
81
- // pragma MARK: std::optional<double>
81
+ // pragma MARK: std::optional<bool>
82
82
  /**
83
- * Specialized version of `std::optional<double>`.
83
+ * Specialized version of `std::optional<bool>`.
84
84
  */
85
- using std__optional_double_ = std::optional<double>;
86
- inline std::optional<double> create_std__optional_double_(const double& value) noexcept {
87
- return std::optional<double>(value);
85
+ using std__optional_bool_ = std::optional<bool>;
86
+ inline std::optional<bool> create_std__optional_bool_(const bool& value) noexcept {
87
+ return std::optional<bool>(value);
88
88
  }
89
- inline bool has_value_std__optional_double_(const std::optional<double>& optional) noexcept {
89
+ inline bool has_value_std__optional_bool_(const std::optional<bool>& optional) noexcept {
90
90
  return optional.has_value();
91
91
  }
92
- inline double get_std__optional_double_(const std::optional<double>& optional) noexcept {
92
+ inline bool get_std__optional_bool_(const std::optional<bool>& optional) noexcept {
93
93
  return *optional;
94
94
  }
95
95
 
96
- // pragma MARK: std::optional<bool>
96
+ // pragma MARK: std::optional<double>
97
97
  /**
98
- * Specialized version of `std::optional<bool>`.
98
+ * Specialized version of `std::optional<double>`.
99
99
  */
100
- using std__optional_bool_ = std::optional<bool>;
101
- inline std::optional<bool> create_std__optional_bool_(const bool& value) noexcept {
102
- return std::optional<bool>(value);
100
+ using std__optional_double_ = std::optional<double>;
101
+ inline std::optional<double> create_std__optional_double_(const double& value) noexcept {
102
+ return std::optional<double>(value);
103
103
  }
104
- inline bool has_value_std__optional_bool_(const std::optional<bool>& optional) noexcept {
104
+ inline bool has_value_std__optional_double_(const std::optional<double>& optional) noexcept {
105
105
  return optional.has_value();
106
106
  }
107
- inline bool get_std__optional_bool_(const std::optional<bool>& optional) noexcept {
107
+ inline double get_std__optional_double_(const std::optional<double>& optional) noexcept {
108
108
  return *optional;
109
109
  }
110
110
 
@@ -19,8 +19,14 @@ public extension AixScrollOnFooterSizeUpdate {
19
19
  /**
20
20
  * Create a new instance of `AixScrollOnFooterSizeUpdate`.
21
21
  */
22
- init(enabled: Bool, scrolledToEndThreshold: Double?, animated: Bool?) {
23
- self.init(enabled, { () -> bridge.std__optional_double_ in
22
+ init(enabled: Bool?, scrolledToEndThreshold: Double?, animated: Bool?) {
23
+ self.init({ () -> bridge.std__optional_bool_ in
24
+ if let __unwrappedValue = enabled {
25
+ return bridge.create_std__optional_bool_(__unwrappedValue)
26
+ } else {
27
+ return .init()
28
+ }
29
+ }(), { () -> bridge.std__optional_double_ in
24
30
  if let __unwrappedValue = scrolledToEndThreshold {
25
31
  return bridge.create_std__optional_double_(__unwrappedValue)
26
32
  } else {
@@ -35,14 +41,27 @@ public extension AixScrollOnFooterSizeUpdate {
35
41
  }())
36
42
  }
37
43
 
38
- var enabled: Bool {
44
+ var enabled: Bool? {
39
45
  @inline(__always)
40
46
  get {
41
- return self.__enabled
47
+ return { () -> Bool? in
48
+ if bridge.has_value_std__optional_bool_(self.__enabled) {
49
+ let __unwrapped = bridge.get_std__optional_bool_(self.__enabled)
50
+ return __unwrapped
51
+ } else {
52
+ return nil
53
+ }
54
+ }()
42
55
  }
43
56
  @inline(__always)
44
57
  set {
45
- self.__enabled = newValue
58
+ self.__enabled = { () -> bridge.std__optional_bool_ in
59
+ if let __unwrappedValue = newValue {
60
+ return bridge.create_std__optional_bool_(__unwrappedValue)
61
+ } else {
62
+ return .init()
63
+ }
64
+ }()
46
65
  }
47
66
  }
48
67
 
@@ -19,8 +19,14 @@ public extension AixStickToKeyboard {
19
19
  /**
20
20
  * Create a new instance of `AixStickToKeyboard`.
21
21
  */
22
- init(enabled: Bool, offset: AixStickToKeyboardOffset?) {
23
- self.init(enabled, { () -> bridge.std__optional_AixStickToKeyboardOffset_ in
22
+ init(enabled: Bool?, offset: AixStickToKeyboardOffset?) {
23
+ self.init({ () -> bridge.std__optional_bool_ in
24
+ if let __unwrappedValue = enabled {
25
+ return bridge.create_std__optional_bool_(__unwrappedValue)
26
+ } else {
27
+ return .init()
28
+ }
29
+ }(), { () -> bridge.std__optional_AixStickToKeyboardOffset_ in
24
30
  if let __unwrappedValue = offset {
25
31
  return bridge.create_std__optional_AixStickToKeyboardOffset_(__unwrappedValue)
26
32
  } else {
@@ -29,14 +35,27 @@ public extension AixStickToKeyboard {
29
35
  }())
30
36
  }
31
37
 
32
- var enabled: Bool {
38
+ var enabled: Bool? {
33
39
  @inline(__always)
34
40
  get {
35
- return self.__enabled
41
+ return { () -> Bool? in
42
+ if bridge.has_value_std__optional_bool_(self.__enabled) {
43
+ let __unwrapped = bridge.get_std__optional_bool_(self.__enabled)
44
+ return __unwrapped
45
+ } else {
46
+ return nil
47
+ }
48
+ }()
36
49
  }
37
50
  @inline(__always)
38
51
  set {
39
- self.__enabled = newValue
52
+ self.__enabled = { () -> bridge.std__optional_bool_ in
53
+ if let __unwrappedValue = newValue {
54
+ return bridge.create_std__optional_bool_(__unwrappedValue)
55
+ } else {
56
+ return .init()
57
+ }
58
+ }()
40
59
  }
41
60
  }
42
61
 
@@ -34,13 +34,13 @@ namespace margelo::nitro::aix {
34
34
  */
35
35
  struct AixScrollOnFooterSizeUpdate {
36
36
  public:
37
- bool enabled SWIFT_PRIVATE;
37
+ std::optional<bool> enabled SWIFT_PRIVATE;
38
38
  std::optional<double> scrolledToEndThreshold SWIFT_PRIVATE;
39
39
  std::optional<bool> animated SWIFT_PRIVATE;
40
40
 
41
41
  public:
42
42
  AixScrollOnFooterSizeUpdate() = default;
43
- explicit AixScrollOnFooterSizeUpdate(bool enabled, std::optional<double> scrolledToEndThreshold, std::optional<bool> animated): enabled(enabled), scrolledToEndThreshold(scrolledToEndThreshold), animated(animated) {}
43
+ explicit AixScrollOnFooterSizeUpdate(std::optional<bool> enabled, std::optional<double> scrolledToEndThreshold, std::optional<bool> animated): enabled(enabled), scrolledToEndThreshold(scrolledToEndThreshold), animated(animated) {}
44
44
  };
45
45
 
46
46
  } // namespace margelo::nitro::aix
@@ -53,14 +53,14 @@ namespace margelo::nitro {
53
53
  static inline margelo::nitro::aix::AixScrollOnFooterSizeUpdate fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
54
54
  jsi::Object obj = arg.asObject(runtime);
55
55
  return margelo::nitro::aix::AixScrollOnFooterSizeUpdate(
56
- JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "enabled")),
56
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "enabled")),
57
57
  JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "scrolledToEndThreshold")),
58
58
  JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "animated"))
59
59
  );
60
60
  }
61
61
  static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::aix::AixScrollOnFooterSizeUpdate& arg) {
62
62
  jsi::Object obj(runtime);
63
- obj.setProperty(runtime, "enabled", JSIConverter<bool>::toJSI(runtime, arg.enabled));
63
+ obj.setProperty(runtime, "enabled", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.enabled));
64
64
  obj.setProperty(runtime, "scrolledToEndThreshold", JSIConverter<std::optional<double>>::toJSI(runtime, arg.scrolledToEndThreshold));
65
65
  obj.setProperty(runtime, "animated", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.animated));
66
66
  return obj;
@@ -73,7 +73,7 @@ namespace margelo::nitro {
73
73
  if (!nitro::isPlainObject(runtime, obj)) {
74
74
  return false;
75
75
  }
76
- if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "enabled"))) return false;
76
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "enabled"))) return false;
77
77
  if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "scrolledToEndThreshold"))) return false;
78
78
  if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "animated"))) return false;
79
79
  return true;
@@ -26,8 +26,8 @@
26
26
  // Forward declaration of `AixStickToKeyboardOffset` to properly resolve imports.
27
27
  namespace margelo::nitro::aix { struct AixStickToKeyboardOffset; }
28
28
 
29
- #include "AixStickToKeyboardOffset.hpp"
30
29
  #include <optional>
30
+ #include "AixStickToKeyboardOffset.hpp"
31
31
 
32
32
  namespace margelo::nitro::aix {
33
33
 
@@ -36,12 +36,12 @@ namespace margelo::nitro::aix {
36
36
  */
37
37
  struct AixStickToKeyboard {
38
38
  public:
39
- bool enabled SWIFT_PRIVATE;
39
+ std::optional<bool> enabled SWIFT_PRIVATE;
40
40
  std::optional<AixStickToKeyboardOffset> offset SWIFT_PRIVATE;
41
41
 
42
42
  public:
43
43
  AixStickToKeyboard() = default;
44
- explicit AixStickToKeyboard(bool enabled, std::optional<AixStickToKeyboardOffset> offset): enabled(enabled), offset(offset) {}
44
+ explicit AixStickToKeyboard(std::optional<bool> enabled, std::optional<AixStickToKeyboardOffset> offset): enabled(enabled), offset(offset) {}
45
45
  };
46
46
 
47
47
  } // namespace margelo::nitro::aix
@@ -54,13 +54,13 @@ namespace margelo::nitro {
54
54
  static inline margelo::nitro::aix::AixStickToKeyboard fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
55
55
  jsi::Object obj = arg.asObject(runtime);
56
56
  return margelo::nitro::aix::AixStickToKeyboard(
57
- JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "enabled")),
57
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "enabled")),
58
58
  JSIConverter<std::optional<margelo::nitro::aix::AixStickToKeyboardOffset>>::fromJSI(runtime, obj.getProperty(runtime, "offset"))
59
59
  );
60
60
  }
61
61
  static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::aix::AixStickToKeyboard& arg) {
62
62
  jsi::Object obj(runtime);
63
- obj.setProperty(runtime, "enabled", JSIConverter<bool>::toJSI(runtime, arg.enabled));
63
+ obj.setProperty(runtime, "enabled", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.enabled));
64
64
  obj.setProperty(runtime, "offset", JSIConverter<std::optional<margelo::nitro::aix::AixStickToKeyboardOffset>>::toJSI(runtime, arg.offset));
65
65
  return obj;
66
66
  }
@@ -72,7 +72,7 @@ namespace margelo::nitro {
72
72
  if (!nitro::isPlainObject(runtime, obj)) {
73
73
  return false;
74
74
  }
75
- if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "enabled"))) return false;
75
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "enabled"))) return false;
76
76
  if (!JSIConverter<std::optional<margelo::nitro::aix::AixStickToKeyboardOffset>>::canConvert(runtime, obj.getProperty(runtime, "offset"))) return false;
77
77
  return true;
78
78
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aix",
3
- "version": "0.6.2",
3
+ "version": "0.7.1-alpha.1",
4
4
  "author": "Fernando Rojo",
5
5
  "repository": {
6
6
  "type": "git",
package/src/dropzone.tsx CHANGED
@@ -1,8 +1,10 @@
1
1
  import type { PropsWithChildren } from 'react'
2
2
  import type { AixInputWrapperOnPasteEvent } from './views/aix.nitro'
3
+ import type { StyleProp, ViewStyle } from 'react-native'
3
4
 
4
5
  export type AixDropzoneComponentProps = PropsWithChildren<{
5
6
  onDrop?: (events: AixInputWrapperOnPasteEvent[]) => void
7
+ style?: StyleProp<ViewStyle>
6
8
  }>
7
9
 
8
10
  export function AixDropzone(props: AixDropzoneComponentProps) {
@@ -26,7 +26,7 @@ export interface AixScrollOnFooterSizeUpdate {
26
26
  *
27
27
  * Default: true
28
28
  */
29
- enabled: boolean
29
+ enabled?: boolean
30
30
  /**
31
31
  * The number of pixels from the bottom of the scroll view to the end of the content that is considered "scrolled near the end".
32
32
  *
@@ -155,7 +155,7 @@ export interface AixStickToKeyboardOffset {
155
155
  }
156
156
 
157
157
  export interface AixStickToKeyboard {
158
- enabled: boolean
158
+ enabled?: boolean
159
159
  offset?: AixStickToKeyboardOffset
160
160
  }
161
161