react-native-unistyles 3.0.7 → 3.0.8

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 (30) hide show
  1. package/README.md +2 -2
  2. package/cxx/parser/Parser.cpp +6 -0
  3. package/lib/commonjs/index.js +6 -0
  4. package/lib/commonjs/index.js.map +1 -1
  5. package/lib/module/index.js +1 -1
  6. package/lib/module/index.js.map +1 -1
  7. package/lib/typescript/src/index.d.ts +1 -1
  8. package/lib/typescript/src/index.d.ts.map +1 -1
  9. package/nitrogen/generated/android/c++/JFunc_void_UnistylesNativeMiniRuntime.hpp +1 -1
  10. package/nitrogen/generated/android/c++/JFunc_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.hpp +2 -2
  11. package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.cpp +7 -2
  12. package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.hpp +1 -0
  13. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Dimensions.kt +1 -0
  14. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void_UnistylesNativeMiniRuntime.kt +1 -0
  15. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.kt +1 -0
  16. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Insets.kt +1 -0
  17. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/UnistylesNativeMiniRuntime.kt +1 -0
  18. package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.cpp +2 -2
  19. package/nitrogen/generated/ios/c++/HybridNativePlatformSpecSwift.hpp +5 -3
  20. package/nitrogen/generated/ios/swift/Func_void_UnistylesNativeMiniRuntime.swift +1 -0
  21. package/nitrogen/generated/ios/swift/Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.swift +1 -0
  22. package/nitrogen/generated/ios/swift/HybridNativePlatformSpec.swift +2 -1
  23. package/nitrogen/generated/ios/swift/HybridNativePlatformSpec_cxx.swift +10 -1
  24. package/nitrogen/generated/shared/c++/HybridNativePlatformSpec.hpp +2 -2
  25. package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.hpp +1 -1
  26. package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.hpp +1 -1
  27. package/nitrogen/generated/shared/c++/UnistyleDependency.hpp +5 -5
  28. package/nitrogen/generated/shared/c++/UnistylesCxxMiniRuntime.hpp +1 -1
  29. package/package.json +3 -3
  30. package/src/index.ts +1 -1
package/README.md CHANGED
@@ -21,14 +21,14 @@ yarn add react-native-unistyles
21
21
  Install dependencies:
22
22
 
23
23
  ```shell
24
- yarn add react-native-edge-to-edge react-native-nitro-modules@0.26.4
24
+ yarn add react-native-edge-to-edge react-native-nitro-modules@0.27.2
25
25
  ```
26
26
 
27
27
  > To avoid unexpected behavior, always use a fixed version of `react-native-nitro-modules`
28
28
 
29
29
  | react-native-unistyles | react-native-nitro-modules |
30
30
  |------------------------|----------------------------|
31
- | 3.0.0 | 0.26.4 |
31
+ | 3.0.0 | 0.27.2 |
32
32
 
33
33
  Then follow [installation guides](https://unistyl.es/v3/start/getting-started) for your platform.
34
34
 
@@ -437,6 +437,12 @@ jsi::Object parser::Parser::parseFirstLevel(jsi::Runtime& rt, Unistyle::Shared u
437
437
 
438
438
  return;
439
439
  }
440
+
441
+ if (propertyValue.isBool() && propertyName == "includeFontPadding") {
442
+ parsedStyle.setProperty(rt, jsi::PropNameID::forUtf8(rt, propertyName), propertyValue);
443
+
444
+ return;
445
+ }
440
446
 
441
447
  // at this point ignore non objects
442
448
  if (!propertyValue.isObject()) {
@@ -45,6 +45,12 @@ Object.defineProperty(exports, "UnistylesRuntime", {
45
45
  return _specs.UnistylesRuntime;
46
46
  }
47
47
  });
48
+ Object.defineProperty(exports, "createUnistylesElement", {
49
+ enumerable: true,
50
+ get: function () {
51
+ return _core.createUnistylesElement;
52
+ }
53
+ });
48
54
  Object.defineProperty(exports, "getServerUnistyles", {
49
55
  enumerable: true,
50
56
  get: function () {
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_specs","_mq","_core","_components","_server","e","__esModule","default","majorReactVersions","React","version","split","map","Number","parseInt","undefined","Error"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAQA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,GAAA,GAAAF,OAAA;AAEA,IAAAG,KAAA,GAAAH,OAAA;AAEA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAA+G,SAAAD,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAZ/G,MAAM,CAACG,kBAAkB,CAAC,GAAGC,cAAK,CAACC,OAAO,CAACC,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,CAACC,MAAM,CAACC,QAAQ,CAAC;AAE1E,IAAIN,kBAAkB,KAAKO,SAAS,IAAIP,kBAAkB,GAAG,EAAE,EAAE;EAC7D,MAAM,IAAIQ,KAAK,CAAC,kFAAkF,CAAC;AACvG","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_specs","_mq","_core","_components","_server","e","__esModule","default","majorReactVersions","React","version","split","map","Number","parseInt","undefined","Error"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAQA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,GAAA,GAAAF,OAAA;AAEA,IAAAG,KAAA,GAAAH,OAAA;AAEA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAA+G,SAAAD,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAZ/G,MAAM,CAACG,kBAAkB,CAAC,GAAGC,cAAK,CAACC,OAAO,CAACC,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,CAACC,MAAM,CAACC,QAAQ,CAAC;AAE1E,IAAIN,kBAAkB,KAAKO,SAAS,IAAIP,kBAAkB,GAAG,EAAE,EAAE;EAC7D,MAAM,IAAIQ,KAAK,CAAC,kFAAkF,CAAC;AACvG","ignoreList":[]}
@@ -7,7 +7,7 @@ if (majorReactVersions === undefined || majorReactVersions < 19) {
7
7
  }
8
8
  export { StyleSheet, UnistylesRuntime, StatusBar, NavigationBar } from './specs';
9
9
  export { mq } from './mq';
10
- export { withUnistyles, useUnistyles } from './core';
10
+ export { withUnistyles, useUnistyles, createUnistylesElement } from './core';
11
11
  export { Display, Hide, ScopedTheme } from './components';
12
12
  export { useServerUnistyles, hydrateServerUnistyles, getServerUnistyles, resetServerUnistyles } from './server';
13
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","majorReactVersions","version","split","map","Number","parseInt","undefined","Error","StyleSheet","UnistylesRuntime","StatusBar","NavigationBar","mq","withUnistyles","useUnistyles","Display","Hide","ScopedTheme","useServerUnistyles","hydrateServerUnistyles","getServerUnistyles","resetServerUnistyles"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,MAAM,CAACC,kBAAkB,CAAC,GAAGD,KAAK,CAACE,OAAO,CAACC,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,CAACC,MAAM,CAACC,QAAQ,CAAC;AAE1E,IAAIL,kBAAkB,KAAKM,SAAS,IAAIN,kBAAkB,GAAG,EAAE,EAAE;EAC7D,MAAM,IAAIO,KAAK,CAAC,kFAAkF,CAAC;AACvG;AAEA,SAASC,UAAU,EAAEC,gBAAgB,EAAEC,SAAS,EAAEC,aAAa,QAAQ,SAAS;AAChF,SAASC,EAAE,QAAQ,MAAM;AAEzB,SAASC,aAAa,EAAEC,YAAY,QAAQ,QAAQ;AAEpD,SAASC,OAAO,EAAEC,IAAI,EAAEC,WAAW,QAAQ,cAAc;AACzD,SAASC,kBAAkB,EAAEC,sBAAsB,EAAEC,kBAAkB,EAAEC,oBAAoB,QAAQ,UAAU","ignoreList":[]}
1
+ {"version":3,"names":["React","majorReactVersions","version","split","map","Number","parseInt","undefined","Error","StyleSheet","UnistylesRuntime","StatusBar","NavigationBar","mq","withUnistyles","useUnistyles","createUnistylesElement","Display","Hide","ScopedTheme","useServerUnistyles","hydrateServerUnistyles","getServerUnistyles","resetServerUnistyles"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,MAAM,CAACC,kBAAkB,CAAC,GAAGD,KAAK,CAACE,OAAO,CAACC,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,CAACC,MAAM,CAACC,QAAQ,CAAC;AAE1E,IAAIL,kBAAkB,KAAKM,SAAS,IAAIN,kBAAkB,GAAG,EAAE,EAAE;EAC7D,MAAM,IAAIO,KAAK,CAAC,kFAAkF,CAAC;AACvG;AAEA,SAASC,UAAU,EAAEC,gBAAgB,EAAEC,SAAS,EAAEC,aAAa,QAAQ,SAAS;AAChF,SAASC,EAAE,QAAQ,MAAM;AAEzB,SAASC,aAAa,EAAEC,YAAY,EAAEC,sBAAsB,QAAQ,QAAQ;AAE5E,SAASC,OAAO,EAAEC,IAAI,EAAEC,WAAW,QAAQ,cAAc;AACzD,SAASC,kBAAkB,EAAEC,sBAAsB,EAAEC,kBAAkB,EAAEC,oBAAoB,QAAQ,UAAU","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  export { StyleSheet, UnistylesRuntime, StatusBar, NavigationBar } from './specs';
2
2
  export { mq } from './mq';
3
3
  export type { UnistylesThemes, UnistylesBreakpoints } from './global';
4
- export { withUnistyles, useUnistyles } from './core';
4
+ export { withUnistyles, useUnistyles, createUnistylesElement } from './core';
5
5
  export type { UnistylesVariants } from './types';
6
6
  export { Display, Hide, ScopedTheme } from './components';
7
7
  export { useServerUnistyles, hydrateServerUnistyles, getServerUnistyles, resetServerUnistyles } from './server';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAChF,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAA;AACzB,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AACrE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AACpD,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAChF,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAA;AACzB,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AACrE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAA;AAC5E,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA"}
@@ -10,8 +10,8 @@
10
10
  #include <fbjni/fbjni.h>
11
11
  #include <functional>
12
12
 
13
- #include <functional>
14
13
  #include "UnistylesNativeMiniRuntime.hpp"
14
+ #include <functional>
15
15
  #include "JUnistylesNativeMiniRuntime.hpp"
16
16
  #include "ColorScheme.hpp"
17
17
  #include "JColorScheme.hpp"
@@ -10,10 +10,10 @@
10
10
  #include <fbjni/fbjni.h>
11
11
  #include <functional>
12
12
 
13
- #include <functional>
14
- #include <vector>
15
13
  #include "UnistyleDependency.hpp"
14
+ #include <vector>
16
15
  #include "UnistylesNativeMiniRuntime.hpp"
16
+ #include <functional>
17
17
  #include "JUnistyleDependency.hpp"
18
18
  #include "JUnistylesNativeMiniRuntime.hpp"
19
19
  #include "ColorScheme.hpp"
@@ -31,9 +31,9 @@ namespace margelo::nitro::unistyles { enum class UnistyleDependency; }
31
31
  #include "JDimensions.hpp"
32
32
  #include "UnistylesNativeMiniRuntime.hpp"
33
33
  #include "JUnistylesNativeMiniRuntime.hpp"
34
- #include <functional>
35
- #include <vector>
36
34
  #include "UnistyleDependency.hpp"
35
+ #include <vector>
36
+ #include <functional>
37
37
  #include "JFunc_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.hpp"
38
38
  #include "JUnistyleDependency.hpp"
39
39
  #include "JFunc_void_UnistylesNativeMiniRuntime.hpp"
@@ -55,6 +55,11 @@ namespace margelo::nitro::unistyles {
55
55
  return method(_javaPart);
56
56
  }
57
57
 
58
+ void JHybridNativePlatformSpec::dispose() noexcept {
59
+ static const auto method = javaClassStatic()->getMethod<void()>("dispose");
60
+ method(_javaPart);
61
+ }
62
+
58
63
  // Properties
59
64
 
60
65
 
@@ -39,6 +39,7 @@ namespace margelo::nitro::unistyles {
39
39
 
40
40
  public:
41
41
  size_t getExternalMemorySize() noexcept override;
42
+ void dispose() noexcept override;
42
43
 
43
44
  public:
44
45
  inline const jni::global_ref<JHybridNativePlatformSpec::javaobject>& getJavaPart() const noexcept {
@@ -11,6 +11,7 @@ import androidx.annotation.Keep
11
11
  import com.facebook.proguard.annotations.DoNotStrip
12
12
  import com.margelo.nitro.core.*
13
13
 
14
+
14
15
  /**
15
16
  * Represents the JavaScript object/struct "Dimensions".
16
17
  */
@@ -13,6 +13,7 @@ import com.facebook.proguard.annotations.DoNotStrip
13
13
  import com.margelo.nitro.core.*
14
14
  import dalvik.annotation.optimization.FastNative
15
15
 
16
+
16
17
  /**
17
18
  * Represents the JavaScript callback `(miniRuntime: struct) => void`.
18
19
  * This can be either implemented in C++ (in which case it might be a callback coming from JS),
@@ -13,6 +13,7 @@ import com.facebook.proguard.annotations.DoNotStrip
13
13
  import com.margelo.nitro.core.*
14
14
  import dalvik.annotation.optimization.FastNative
15
15
 
16
+
16
17
  /**
17
18
  * Represents the JavaScript callback `(dependencies: array, miniRuntime: struct) => void`.
18
19
  * This can be either implemented in C++ (in which case it might be a callback coming from JS),
@@ -11,6 +11,7 @@ import androidx.annotation.Keep
11
11
  import com.facebook.proguard.annotations.DoNotStrip
12
12
  import com.margelo.nitro.core.*
13
13
 
14
+
14
15
  /**
15
16
  * Represents the JavaScript object/struct "Insets".
16
17
  */
@@ -11,6 +11,7 @@ import androidx.annotation.Keep
11
11
  import com.facebook.proguard.annotations.DoNotStrip
12
12
  import com.margelo.nitro.core.*
13
13
 
14
+
14
15
  /**
15
16
  * Represents the JavaScript object/struct "UnistylesNativeMiniRuntime".
16
17
  */
@@ -36,11 +36,11 @@ namespace margelo::nitro::unistyles::bridge::swift {
36
36
  }
37
37
  void* _Nonnull get_std__shared_ptr_margelo__nitro__unistyles__HybridNativePlatformSpec_(std__shared_ptr_margelo__nitro__unistyles__HybridNativePlatformSpec_ cppType) {
38
38
  std::shared_ptr<margelo::nitro::unistyles::HybridNativePlatformSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::unistyles::HybridNativePlatformSpecSwift>(cppType);
39
- #ifdef NITRO_DEBUG
39
+ #ifdef NITRO_DEBUG
40
40
  if (swiftWrapper == nullptr) [[unlikely]] {
41
41
  throw std::runtime_error("Class \"HybridNativePlatformSpec\" is not implemented in Swift!");
42
42
  }
43
- #endif
43
+ #endif
44
44
  Unistyles::HybridNativePlatformSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
45
45
  return swiftPart.toUnsafe();
46
46
  }
@@ -31,9 +31,9 @@ namespace margelo::nitro::unistyles { enum class UnistyleDependency; }
31
31
  #include <string>
32
32
  #include "Dimensions.hpp"
33
33
  #include "UnistylesNativeMiniRuntime.hpp"
34
- #include <functional>
35
- #include <vector>
36
34
  #include "UnistyleDependency.hpp"
35
+ #include <vector>
36
+ #include <functional>
37
37
 
38
38
  #include "Unistyles-Swift-Cxx-Umbrella.hpp"
39
39
 
@@ -63,10 +63,12 @@ namespace margelo::nitro::unistyles {
63
63
  }
64
64
 
65
65
  public:
66
- // Get memory pressure
67
66
  inline size_t getExternalMemorySize() noexcept override {
68
67
  return _swiftPart.getMemorySize();
69
68
  }
69
+ void dispose() noexcept override {
70
+ _swiftPart.dispose();
71
+ }
70
72
 
71
73
  public:
72
74
  // Properties
@@ -7,6 +7,7 @@
7
7
 
8
8
  import NitroModules
9
9
 
10
+
10
11
  /**
11
12
  * Wraps a Swift `(_ miniRuntime: UnistylesNativeMiniRuntime) -> Void` as a class.
12
13
  * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
@@ -7,6 +7,7 @@
7
7
 
8
8
  import NitroModules
9
9
 
10
+
10
11
  /**
11
12
  * Wraps a Swift `(_ dependencies: [UnistyleDependency], _ miniRuntime: UnistylesNativeMiniRuntime) -> Void` as a class.
12
13
  * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
@@ -35,8 +35,9 @@ public protocol HybridNativePlatformSpec_protocol: HybridObject {
35
35
  }
36
36
 
37
37
  /// See ``HybridNativePlatformSpec``
38
- public class HybridNativePlatformSpec_base {
38
+ open class HybridNativePlatformSpec_base {
39
39
  private weak var cxxWrapper: HybridNativePlatformSpec_cxx? = nil
40
+ public init() { }
40
41
  public func getCxxWrapper() -> HybridNativePlatformSpec_cxx {
41
42
  #if DEBUG
42
43
  guard self is HybridNativePlatformSpec else {
@@ -17,7 +17,7 @@ import NitroModules
17
17
  * - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
18
18
  * - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
19
19
  */
20
- public class HybridNativePlatformSpec_cxx {
20
+ open class HybridNativePlatformSpec_cxx {
21
21
  /**
22
22
  * The Swift <> C++ bridge's namespace (`margelo::nitro::unistyles::bridge::swift`)
23
23
  * from `Unistyles-Swift-Cxx-Bridge.hpp`.
@@ -96,6 +96,15 @@ public class HybridNativePlatformSpec_cxx {
96
96
  return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
97
97
  }
98
98
 
99
+ /**
100
+ * Call dispose() on the Swift class.
101
+ * This _may_ be called manually from JS.
102
+ */
103
+ @inline(__always)
104
+ public func dispose() {
105
+ self.__implementation.dispose()
106
+ }
107
+
99
108
  // Properties
100
109
 
101
110
 
@@ -32,9 +32,9 @@ namespace margelo::nitro::unistyles { enum class UnistyleDependency; }
32
32
  #include <string>
33
33
  #include "Dimensions.hpp"
34
34
  #include "UnistylesNativeMiniRuntime.hpp"
35
- #include <functional>
36
- #include <vector>
37
35
  #include "UnistyleDependency.hpp"
36
+ #include <vector>
37
+ #include <functional>
38
38
 
39
39
  namespace margelo::nitro::unistyles {
40
40
 
@@ -26,8 +26,8 @@ namespace margelo::nitro::unistyles { struct UnistylesCxxMiniRuntime; }
26
26
 
27
27
  #include "ColorScheme.hpp"
28
28
  #include "Dimensions.hpp"
29
- #include <optional>
30
29
  #include <string>
30
+ #include <optional>
31
31
  #include <unordered_map>
32
32
  #include "Insets.hpp"
33
33
  #include "Orientation.hpp"
@@ -17,8 +17,8 @@
17
17
  namespace margelo::nitro::unistyles { enum class UnistyleDependency; }
18
18
 
19
19
  #include <functional>
20
- #include <vector>
21
20
  #include "UnistyleDependency.hpp"
21
+ #include <vector>
22
22
 
23
23
  namespace margelo::nitro::unistyles {
24
24
 
@@ -7,7 +7,6 @@
7
7
 
8
8
  #pragma once
9
9
 
10
- #include <cmath>
11
10
  #if __has_include(<NitroModules/JSIConverter.hpp>)
12
11
  #include <NitroModules/JSIConverter.hpp>
13
12
  #else
@@ -64,10 +63,11 @@ namespace margelo::nitro {
64
63
  if (!value.isNumber()) {
65
64
  return false;
66
65
  }
67
- double integer;
68
- double fraction = modf(value.getNumber(), &integer);
69
- if (fraction != 0.0) {
70
- // It is some kind of floating point number - our enums are ints.
66
+ double number = value.getNumber();
67
+ int integer = static_cast<int>(number);
68
+ if (number != integer) {
69
+ // The integer is not the same value as the double - we truncated floating points.
70
+ // Enums are all integers, so the input floating point number is obviously invalid.
71
71
  return false;
72
72
  }
73
73
  // Check if we are within the bounds of the enum.
@@ -25,8 +25,8 @@ namespace margelo::nitro::unistyles { struct Dimensions; }
25
25
  // Forward declaration of `Insets` to properly resolve imports.
26
26
  namespace margelo::nitro::unistyles { struct Insets; }
27
27
 
28
- #include <optional>
29
28
  #include <string>
29
+ #include <optional>
30
30
  #include "ColorScheme.hpp"
31
31
  #include "Dimensions.hpp"
32
32
  #include "Insets.hpp"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-unistyles",
3
- "version": "3.0.7",
3
+ "version": "3.0.8",
4
4
  "description": "Level up your React Native StyleSheet",
5
5
  "scripts": {
6
6
  "test": "NODE_ENV=babel-test jest ./plugin",
@@ -148,11 +148,11 @@
148
148
  "husky": "9.1.7",
149
149
  "jest": "29.7.0",
150
150
  "metro-react-native-babel-preset": "0.77.0",
151
- "nitro-codegen": "0.26.4",
151
+ "nitro-codegen": "0.27.2",
152
152
  "react": "19.1.0",
153
153
  "react-native": "0.79.2",
154
154
  "react-native-builder-bob": "0.40.10",
155
- "react-native-nitro-modules": "0.26.4",
155
+ "react-native-nitro-modules": "0.27.2",
156
156
  "react-native-reanimated": "3.17.5",
157
157
  "react-native-web": "0.20.0",
158
158
  "react-test-renderer": "19.1.0",
package/src/index.ts CHANGED
@@ -9,7 +9,7 @@ if (majorReactVersions === undefined || majorReactVersions < 19) {
9
9
  export { StyleSheet, UnistylesRuntime, StatusBar, NavigationBar } from './specs'
10
10
  export { mq } from './mq'
11
11
  export type { UnistylesThemes, UnistylesBreakpoints } from './global'
12
- export { withUnistyles, useUnistyles } from './core'
12
+ export { withUnistyles, useUnistyles, createUnistylesElement } from './core'
13
13
  export type { UnistylesVariants } from './types'
14
14
  export { Display, Hide, ScopedTheme } from './components'
15
15
  export { useServerUnistyles, hydrateServerUnistyles, getServerUnistyles, resetServerUnistyles } from './server'