@apple-pie/slice-native 0.1.4 → 0.1.7

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 (178) hide show
  1. package/README.md +164 -97
  2. package/SliceNative.podspec +24 -0
  3. package/dist/cjs/components.js +19 -0
  4. package/dist/cjs/hooks.js +9 -0
  5. package/dist/cjs/index.js +27 -812
  6. package/dist/cjs/providers.js +9 -0
  7. package/dist/cjs/src/components/SliceBackgroundBlur/SliceBackgroundBlur.js +11 -0
  8. package/dist/cjs/src/components/SliceButton/SliceButton.js +146 -0
  9. package/dist/cjs/src/components/SliceIcon/SliceIcon.js +20 -0
  10. package/dist/cjs/src/components/SliceIcon/iconRegistry.js +668 -0
  11. package/dist/cjs/src/components/SliceIcon/icons.js +144 -0
  12. package/dist/cjs/src/components/SliceLiquidGlassView/SliceLiquidGlassView.js +12 -0
  13. package/dist/cjs/src/components/SliceText/SliceText.js +21 -0
  14. package/dist/cjs/src/components/SliceTextInput/SliceTextInput.js +117 -0
  15. package/dist/cjs/src/hooks/useCreateThemedStyles/useCreateThemedStyles.js +13 -0
  16. package/dist/cjs/src/hooks/useDeviceCapabilities/useDeviceCapabilities.js +19 -0
  17. package/dist/cjs/src/providers/SliceThemeProvider.js +37 -0
  18. package/dist/cjs/src/theme/colors/colors.js +253 -0
  19. package/dist/cjs/src/theme/corners/corners.js +14 -0
  20. package/dist/cjs/src/theme/elevations/elevations.js +17 -0
  21. package/dist/cjs/src/theme/motion/motion.js +15 -0
  22. package/dist/cjs/src/theme/motion.js +47 -0
  23. package/dist/cjs/src/theme/spacing/spacing.js +14 -0
  24. package/dist/cjs/src/theme/type/type.js +190 -0
  25. package/dist/cjs/src/utils/sizes/sizes.js +40 -0
  26. package/dist/cjs/src/utils/typography/typography.js +17 -0
  27. package/dist/cjs/theme.js +23 -538
  28. package/dist/cjs/utils.js +10 -0
  29. package/dist/esm/components.mjs +7 -0
  30. package/dist/esm/hooks.mjs +2 -0
  31. package/dist/esm/index.mjs +12 -813
  32. package/dist/esm/providers.mjs +1 -0
  33. package/dist/esm/src/components/SliceBackgroundBlur/SliceBackgroundBlur.mjs +9 -0
  34. package/dist/esm/src/components/SliceButton/SliceButton.mjs +144 -0
  35. package/dist/esm/src/components/SliceIcon/SliceIcon.mjs +18 -0
  36. package/dist/esm/src/components/SliceIcon/iconRegistry.mjs +666 -0
  37. package/dist/esm/src/components/SliceIcon/icons.mjs +142 -0
  38. package/dist/esm/src/components/SliceLiquidGlassView/SliceLiquidGlassView.mjs +10 -0
  39. package/dist/esm/src/components/SliceText/SliceText.mjs +19 -0
  40. package/dist/esm/src/components/SliceTextInput/SliceTextInput.mjs +115 -0
  41. package/dist/esm/src/hooks/useCreateThemedStyles/useCreateThemedStyles.mjs +11 -0
  42. package/dist/esm/src/hooks/useDeviceCapabilities/useDeviceCapabilities.mjs +17 -0
  43. package/dist/esm/src/providers/SliceThemeProvider.mjs +33 -0
  44. package/dist/esm/src/theme/colors/colors.mjs +249 -0
  45. package/dist/esm/src/theme/corners/corners.mjs +12 -0
  46. package/dist/esm/src/theme/elevations/elevations.mjs +15 -0
  47. package/dist/esm/src/theme/motion/motion.mjs +13 -0
  48. package/dist/esm/src/theme/motion.mjs +45 -0
  49. package/dist/esm/src/theme/spacing/spacing.mjs +12 -0
  50. package/dist/esm/src/theme/type/type.mjs +184 -0
  51. package/dist/esm/src/utils/sizes/sizes.mjs +37 -0
  52. package/dist/esm/src/utils/typography/typography.mjs +15 -0
  53. package/dist/esm/theme.mjs +7 -522
  54. package/dist/esm/utils.mjs +2 -0
  55. package/dist/react-native/native/src/components/SliceBackgroundBlur/SliceBackgroundBlur.js +6 -0
  56. package/dist/react-native/native/src/components/SliceBackgroundBlur/SliceBackgroundBlur.native.js +6 -0
  57. package/dist/react-native/native/src/components/SliceBackgroundBlur/_types.js +1 -0
  58. package/dist/react-native/native/src/components/SliceBackgroundBlur/index.js +1 -0
  59. package/dist/react-native/native/src/components/SliceButton/SliceButton.js +141 -0
  60. package/dist/react-native/native/src/components/SliceButton/_types.js +1 -0
  61. package/dist/react-native/native/src/components/SliceButton/index.js +1 -0
  62. package/dist/react-native/native/src/components/SliceIcon/SliceIcon.js +15 -0
  63. package/dist/react-native/native/src/components/SliceIcon/_types.js +1 -0
  64. package/dist/react-native/native/src/components/SliceIcon/iconRegistry.js +663 -0
  65. package/dist/react-native/native/src/components/SliceIcon/icons.js +140 -0
  66. package/dist/react-native/native/src/components/SliceIcon/index.js +2 -0
  67. package/dist/react-native/native/src/components/SliceLiquidGlassView/SliceLiquidGlassView.ios.js +6 -0
  68. package/dist/react-native/native/src/components/SliceLiquidGlassView/SliceLiquidGlassView.js +7 -0
  69. package/dist/react-native/native/src/components/SliceLiquidGlassView/_types.js +1 -0
  70. package/dist/react-native/native/src/components/SliceLiquidGlassView/index.js +1 -0
  71. package/dist/react-native/native/src/components/SliceText/SliceText.js +16 -0
  72. package/dist/react-native/native/src/components/SliceText/_types.js +1 -0
  73. package/dist/react-native/native/src/components/SliceText/index.js +1 -0
  74. package/dist/react-native/native/src/components/SliceTextInput/SliceTextInput.js +111 -0
  75. package/dist/react-native/native/src/components/SliceTextInput/_types.js +1 -0
  76. package/dist/react-native/native/src/components/SliceTextInput/index.js +1 -0
  77. package/dist/react-native/native/src/components/index.js +6 -0
  78. package/dist/react-native/native/src/hooks/index.js +2 -0
  79. package/dist/react-native/native/src/hooks/useCreateThemedStyles/index.js +1 -0
  80. package/dist/react-native/native/src/hooks/useCreateThemedStyles/useCreateThemedStyles.js +8 -0
  81. package/dist/react-native/native/src/hooks/useDeviceCapabilities/_types.js +1 -0
  82. package/dist/react-native/native/src/hooks/useDeviceCapabilities/index.js +1 -0
  83. package/dist/react-native/native/src/hooks/useDeviceCapabilities/useDeviceCapabilities.js +14 -0
  84. package/dist/react-native/native/src/hooks/useDeviceCapabilities/useDeviceCapabilities.native.js +23 -0
  85. package/dist/react-native/native/src/index.js +6 -0
  86. package/dist/react-native/native/src/providers/SliceThemeProvider.js +30 -0
  87. package/dist/react-native/native/src/providers/index.js +1 -0
  88. package/dist/react-native/native/src/specs/BackgroundBlurNativeComponent.ts +16 -0
  89. package/dist/react-native/native/src/specs/LiquidGlassNativeComponent.ts +18 -0
  90. package/dist/react-native/native/src/specs/NativeDeviceCapabilities.ts +13 -0
  91. package/dist/react-native/native/src/theme/index.js +69 -0
  92. package/dist/react-native/native/src/theme/motion.js +43 -0
  93. package/dist/react-native/native/src/types/index.js +1 -0
  94. package/dist/react-native/native/src/types/sharedTypes.js +1 -0
  95. package/dist/react-native/native/src/utils/index.js +2 -0
  96. package/dist/react-native/native/src/utils/sizes/index.js +1 -0
  97. package/dist/react-native/native/src/utils/sizes/sizes.js +35 -0
  98. package/dist/react-native/native/src/utils/typography/index.js +1 -0
  99. package/dist/react-native/native/src/utils/typography/typography.js +13 -0
  100. package/dist/react-native/src/theme/colors/colors.js +385 -0
  101. package/dist/react-native/src/theme/colors/types.js +1 -0
  102. package/dist/react-native/src/theme/corners/corners.js +10 -0
  103. package/dist/react-native/src/theme/corners/types.js +1 -0
  104. package/dist/react-native/src/theme/elevations/_types.js +1 -0
  105. package/dist/react-native/src/theme/elevations/elevations.js +13 -0
  106. package/dist/react-native/src/theme/motion/_types.js +1 -0
  107. package/dist/react-native/src/theme/motion/motion.js +11 -0
  108. package/dist/react-native/src/theme/spacing/_types.js +1 -0
  109. package/dist/react-native/src/theme/spacing/spacing.js +10 -0
  110. package/dist/react-native/src/theme/type/type.js +371 -0
  111. package/dist/react-native/src/theme/type/types.js +1 -0
  112. package/dist/types/native/src/components/SliceBackgroundBlur/SliceBackgroundBlur.d.ts +3 -0
  113. package/dist/types/native/src/components/SliceBackgroundBlur/SliceBackgroundBlur.native.d.ts +2 -0
  114. package/dist/types/native/src/components/SliceBackgroundBlur/_types.d.ts +24 -0
  115. package/dist/types/native/src/components/SliceBackgroundBlur/index.d.ts +2 -0
  116. package/dist/types/native/src/components/SliceButton/SliceButton.d.ts +5 -0
  117. package/dist/types/native/src/components/SliceButton/_types.d.ts +78 -0
  118. package/dist/types/native/src/components/SliceButton/index.d.ts +2 -0
  119. package/dist/types/native/src/components/SliceIcon/SliceIcon.d.ts +2 -0
  120. package/dist/types/native/{components/Icon → src/components/SliceIcon}/icons.d.ts +1 -0
  121. package/dist/types/native/src/components/SliceIcon/index.d.ts +3 -0
  122. package/dist/types/native/src/components/SliceLiquidGlassView/SliceLiquidGlassView.d.ts +3 -0
  123. package/dist/types/native/src/components/SliceLiquidGlassView/SliceLiquidGlassView.ios.d.ts +2 -0
  124. package/dist/types/native/src/components/SliceLiquidGlassView/_types.d.ts +17 -0
  125. package/dist/types/native/src/components/SliceLiquidGlassView/index.d.ts +2 -0
  126. package/dist/types/native/src/components/SliceText/SliceText.d.ts +5 -0
  127. package/dist/types/native/src/components/SliceText/_types.d.ts +17 -0
  128. package/dist/types/native/src/components/SliceText/index.d.ts +2 -0
  129. package/dist/types/native/src/components/SliceTextInput/SliceTextInput.d.ts +2 -0
  130. package/dist/types/native/src/components/SliceTextInput/_types.d.ts +58 -0
  131. package/dist/types/native/src/components/SliceTextInput/index.d.ts +2 -0
  132. package/dist/types/native/src/components/index.d.ts +12 -0
  133. package/dist/types/native/src/hooks/index.d.ts +3 -0
  134. package/dist/types/native/src/hooks/useCreateThemedStyles/index.d.ts +1 -0
  135. package/dist/types/native/src/hooks/useCreateThemedStyles/useCreateThemedStyles.d.ts +7 -0
  136. package/dist/types/native/src/hooks/useDeviceCapabilities/_types.d.ts +17 -0
  137. package/dist/types/native/src/hooks/useDeviceCapabilities/index.d.ts +2 -0
  138. package/dist/types/native/src/hooks/useDeviceCapabilities/useDeviceCapabilities.d.ts +3 -0
  139. package/dist/types/native/src/hooks/useDeviceCapabilities/useDeviceCapabilities.native.d.ts +7 -0
  140. package/dist/types/native/src/index.d.ts +12 -0
  141. package/dist/types/native/src/providers/SliceThemeProvider.d.ts +16 -0
  142. package/dist/types/native/src/providers/index.d.ts +2 -0
  143. package/dist/types/native/src/specs/BackgroundBlurNativeComponent.d.ts +9 -0
  144. package/dist/types/native/src/specs/LiquidGlassNativeComponent.d.ts +9 -0
  145. package/dist/types/native/src/specs/NativeDeviceCapabilities.d.ts +11 -0
  146. package/dist/types/native/{theme → src/theme}/index.d.ts +5 -5
  147. package/dist/types/native/src/types/index.d.ts +1 -0
  148. package/dist/types/native/src/types/sharedTypes.d.ts +14 -0
  149. package/dist/types/native/src/utils/index.d.ts +2 -0
  150. package/dist/types/native/src/utils/sizes/index.d.ts +1 -0
  151. package/dist/types/native/src/utils/sizes/sizes.d.ts +7 -0
  152. package/dist/types/native/src/utils/typography/index.d.ts +1 -0
  153. package/dist/types/native/src/utils/typography/typography.d.ts +7 -0
  154. package/package.json +57 -11
  155. package/platform/android/build.gradle +22 -0
  156. package/platform/android/src/main/AndroidManifest.xml +1 -0
  157. package/platform/android/src/main/java/com/slice/SliceBackgroundBlurManager.java +28 -0
  158. package/platform/android/src/main/java/com/slice/SliceBackgroundBlurView.java +98 -0
  159. package/platform/android/src/main/java/com/slice/SliceDeviceCapabilitiesModule.java +25 -0
  160. package/platform/android/src/main/java/com/slice/SlicePackage.java +25 -0
  161. package/platform/ios/BackgroundBlurSurface.swift +89 -0
  162. package/platform/ios/LiquidGlassSurface.swift +82 -0
  163. package/platform/ios/RCTBackgroundBlurView.h +3 -0
  164. package/platform/ios/RCTBackgroundBlurView.mm +42 -0
  165. package/platform/ios/RCTLiquidGlassView.h +8 -0
  166. package/platform/ios/RCTLiquidGlassView.mm +73 -0
  167. package/platform/ios/SliceDeviceCapabilities.h +4 -0
  168. package/platform/ios/SliceDeviceCapabilities.mm +35 -0
  169. package/react-native.config.js +1 -0
  170. package/src/specs/BackgroundBlurNativeComponent.ts +16 -0
  171. package/src/specs/LiquidGlassNativeComponent.ts +18 -0
  172. package/src/specs/NativeDeviceCapabilities.ts +13 -0
  173. package/dist/types/native/components/Icon/NativeIcon.d.ts +0 -2
  174. package/dist/types/native/components/Icon/index.d.ts +0 -3
  175. package/dist/types/native/index.d.ts +0 -4
  176. /package/dist/types/native/{components/Icon → src/components/SliceIcon}/_types.d.ts +0 -0
  177. /package/dist/types/native/{components/Icon → src/components/SliceIcon}/iconRegistry.d.ts +0 -0
  178. /package/dist/types/native/{theme → src/theme}/motion.d.ts +0 -0
@@ -0,0 +1,82 @@
1
+ import UIKit
2
+
3
+ /// UIKit surface owned by the Fabric component. React children live in contentView.
4
+ @objc(SliceLiquidGlassSurface)
5
+ public final class LiquidGlassSurface: UIView {
6
+ private let effectView = UIVisualEffectView(effect: nil)
7
+ private var usesClearGlass = false
8
+ private var glassTint: UIColor?
9
+ private var interactive = false
10
+ private var radius: CGFloat = 24
11
+ private var reduceTransparencyObserver: NSObjectProtocol?
12
+
13
+ @objc public var reactContentView: UIView { effectView.contentView }
14
+
15
+ public override init(frame: CGRect) {
16
+ super.init(frame: frame)
17
+ backgroundColor = .clear
18
+ addSubview(effectView)
19
+ effectView.frame = bounds
20
+ effectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
21
+ reduceTransparencyObserver = NotificationCenter.default.addObserver(
22
+ forName: UIAccessibility.reduceTransparencyStatusDidChangeNotification,
23
+ object: nil,
24
+ queue: .main
25
+ ) { [weak self] _ in
26
+ MainActor.assumeIsolated { self?.updateEffect() }
27
+ }
28
+ updateEffect()
29
+ }
30
+
31
+ public required init?(coder: NSCoder) {
32
+ fatalError("init(coder:) has not been implemented")
33
+ }
34
+
35
+ deinit {
36
+ if let observer = reduceTransparencyObserver {
37
+ NotificationCenter.default.removeObserver(observer)
38
+ }
39
+ }
40
+
41
+ @objc public func configure(
42
+ clear: Bool,
43
+ tint: UIColor?,
44
+ interactive: Bool,
45
+ cornerRadius: CGFloat
46
+ ) {
47
+ let nextRadius = cornerRadius.isFinite ? max(0, cornerRadius) : 24
48
+ guard usesClearGlass != clear || glassTint != tint || self.interactive != interactive || radius != nextRadius else {
49
+ return
50
+ }
51
+ usesClearGlass = clear
52
+ glassTint = tint
53
+ self.interactive = interactive
54
+ radius = nextRadius
55
+ updateEffect()
56
+ }
57
+
58
+ private func updateEffect() {
59
+ if UIAccessibility.isReduceTransparencyEnabled {
60
+ effectView.effect = nil
61
+ effectView.backgroundColor = .secondarySystemBackground
62
+ } else {
63
+ effectView.backgroundColor = .clear
64
+ if #available(iOS 26.0, *) {
65
+ let effect = UIGlassEffect(style: usesClearGlass ? .clear : .regular)
66
+ effect.tintColor = glassTint
67
+ effect.isInteractive = interactive
68
+ effectView.effect = effect
69
+ } else {
70
+ effectView.effect = UIBlurEffect(style: .systemUltraThinMaterial)
71
+ }
72
+ }
73
+
74
+ if #available(iOS 26.0, *) {
75
+ effectView.cornerConfiguration = .corners(radius: .fixed(radius))
76
+ } else {
77
+ effectView.layer.cornerRadius = radius
78
+ effectView.layer.cornerCurve = .continuous
79
+ }
80
+ effectView.clipsToBounds = true
81
+ }
82
+ }
@@ -0,0 +1,3 @@
1
+ #import <React/RCTViewComponentView.h>
2
+ @interface RCTBackgroundBlurView : RCTViewComponentView
3
+ @end
@@ -0,0 +1,42 @@
1
+ #import "RCTBackgroundBlurView.h"
2
+ #import "SliceNative-Swift.h"
3
+ #import <React/RCTConversions.h>
4
+ #import <react/renderer/components/SliceNativeSpec/ComponentDescriptors.h>
5
+ #import <react/renderer/components/SliceNativeSpec/Props.h>
6
+ #import <react/renderer/components/SliceNativeSpec/RCTComponentViewHelpers.h>
7
+
8
+ using namespace facebook::react;
9
+ @interface RCTBackgroundBlurView () <RCTSliceBackgroundBlurViewProtocol>
10
+ @end
11
+ @implementation RCTBackgroundBlurView {
12
+ SliceBackgroundBlurSurface *_surface;
13
+ }
14
+ + (ComponentDescriptorProvider)componentDescriptorProvider {
15
+ return concreteComponentDescriptorProvider<SliceBackgroundBlurComponentDescriptor>();
16
+ }
17
+ - (instancetype)initWithFrame:(CGRect)frame {
18
+ if (self = [super initWithFrame:frame]) {
19
+ _props = std::make_shared<const SliceBackgroundBlurProps>();
20
+ _surface = [[SliceBackgroundBlurSurface alloc] initWithFrame:self.bounds];
21
+ self.contentView = _surface;
22
+ }
23
+ return self;
24
+ }
25
+ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps {
26
+ const auto &p = *std::static_pointer_cast<const SliceBackgroundBlurProps>(props);
27
+ NSString *direction = @"down";
28
+ switch (p.direction) {
29
+ case SliceBackgroundBlurDirection::Up: direction = @"up"; break;
30
+ case SliceBackgroundBlurDirection::Left: direction = @"left"; break;
31
+ case SliceBackgroundBlurDirection::Right: direction = @"right"; break;
32
+ default: break;
33
+ }
34
+ [_surface configureWithIntensity:p.blurIntensity fadeStop:p.fadeStop direction:direction fallbackColor:RCTUIColorFromSharedColor(p.fallbackColor)];
35
+ [super updateProps:props oldProps:oldProps];
36
+ }
37
+ - (void)prepareForRecycle {
38
+ [super prepareForRecycle];
39
+ [_surface configureWithIntensity:12 fadeStop:0 direction:@"down" fallbackColor:nil];
40
+ }
41
+ @end
42
+ Class<RCTComponentViewProtocol> SliceBackgroundBlurCls(void) { return RCTBackgroundBlurView.class; }
@@ -0,0 +1,8 @@
1
+ #import <React/RCTViewComponentView.h>
2
+
3
+ NS_ASSUME_NONNULL_BEGIN
4
+
5
+ @interface RCTLiquidGlassView : RCTViewComponentView
6
+ @end
7
+
8
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,73 @@
1
+ #import "RCTLiquidGlassView.h"
2
+ #import "SliceNative-Swift.h"
3
+ #import <React/RCTConversions.h>
4
+
5
+ #import <react/renderer/components/SliceNativeSpec/ComponentDescriptors.h>
6
+ #import <react/renderer/components/SliceNativeSpec/Props.h>
7
+ #import <react/renderer/components/SliceNativeSpec/RCTComponentViewHelpers.h>
8
+ #import <react/renderer/graphics/Color.h>
9
+
10
+ using namespace facebook::react;
11
+
12
+ @interface RCTLiquidGlassView () <RCTSliceLiquidGlassViewViewProtocol>
13
+ @end
14
+
15
+ @implementation RCTLiquidGlassView {
16
+ SliceLiquidGlassSurface *_surface;
17
+ }
18
+
19
+ + (ComponentDescriptorProvider)componentDescriptorProvider
20
+ {
21
+ return concreteComponentDescriptorProvider<SliceLiquidGlassViewComponentDescriptor>();
22
+ }
23
+
24
+ - (instancetype)initWithFrame:(CGRect)frame
25
+ {
26
+ if (self = [super initWithFrame:frame]) {
27
+ _props = std::make_shared<const SliceLiquidGlassViewProps>();
28
+ _surface = [[SliceLiquidGlassSurface alloc] initWithFrame:self.bounds];
29
+ [self addSubview:_surface];
30
+ }
31
+ return self;
32
+ }
33
+
34
+ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
35
+ {
36
+ const auto &newProps = *std::static_pointer_cast<const SliceLiquidGlassViewProps>(props);
37
+ [_surface configureWithClear:newProps.glassStyle == SliceLiquidGlassViewGlassStyle::Clear
38
+ tint:RCTUIColorFromSharedColor(newProps.glassTintColor)
39
+ interactive:newProps.interactive
40
+ cornerRadius:newProps.cornerRadius];
41
+ [super updateProps:props oldProps:oldProps];
42
+ }
43
+
44
+ - (void)layoutSubviews
45
+ {
46
+ [super layoutSubviews];
47
+ // Fill the entire view, including Yoga padding. Child frames already include padding.
48
+ _surface.frame = self.bounds;
49
+ }
50
+
51
+ - (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
52
+ {
53
+ [_surface.reactContentView insertSubview:childComponentView atIndex:index];
54
+ }
55
+
56
+ - (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
57
+ {
58
+ [childComponentView removeFromSuperview];
59
+ }
60
+
61
+ - (void)prepareForRecycle
62
+ {
63
+ [super prepareForRecycle];
64
+ [_surface configureWithClear:NO tint:nil interactive:NO cornerRadius:24];
65
+ }
66
+
67
+ @end
68
+
69
+ // Also supports component discovery in React Native versions using the class provider.
70
+ Class<RCTComponentViewProtocol> SliceLiquidGlassViewCls(void)
71
+ {
72
+ return RCTLiquidGlassView.class;
73
+ }
@@ -0,0 +1,4 @@
1
+ #import <SliceNativeSpec/SliceNativeSpec.h>
2
+
3
+ @interface SliceDeviceCapabilities : NSObject <NativeDeviceCapabilitiesSpec>
4
+ @end
@@ -0,0 +1,35 @@
1
+ #import "SliceDeviceCapabilities.h"
2
+ #import <UIKit/UIKit.h>
3
+ #import <sys/utsname.h>
4
+ #import <cstdlib>
5
+
6
+ @implementation SliceDeviceCapabilities
7
+ RCT_EXPORT_MODULE(SliceDeviceCapabilities)
8
+
9
+ + (BOOL)requiresMainQueueSetup { return NO; }
10
+
11
+ - (facebook::react::ModuleConstants<JS::NativeDeviceCapabilities::Constants>)constantsToExport {
12
+ return [self getConstants];
13
+ }
14
+
15
+ - (facebook::react::ModuleConstants<JS::NativeDeviceCapabilities::Constants>)getConstants {
16
+ struct utsname systemInfo;
17
+ NSString *model = uname(&systemInfo) == 0 ? [NSString stringWithUTF8String:systemInfo.machine] : @"";
18
+ // Simulator uname reports the host architecture; use the simulated device instead.
19
+ const char *simulatorModel = getenv("SIMULATOR_MODEL_IDENTIFIER");
20
+ if (simulatorModel != nullptr) { model = [NSString stringWithUTF8String:simulatorModel]; }
21
+ BOOL supportsGlass = NO;
22
+ if (@available(iOS 26.0, *)) { supportsGlass = YES; }
23
+ return facebook::react::typedConstants<JS::NativeDeviceCapabilities::Constants>({
24
+ .supportsLiquidGlass = (bool)supportsGlass,
25
+ .supportsNativeBlur = true,
26
+ .deviceName = [UIDevice currentDevice].name,
27
+ .deviceModel = model ?: @"",
28
+ });
29
+ }
30
+
31
+ - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
32
+ (const facebook::react::ObjCTurboModule::InitParams &)params {
33
+ return std::make_shared<facebook::react::NativeDeviceCapabilitiesSpecJSI>(params);
34
+ }
35
+ @end
@@ -0,0 +1 @@
1
+ module.exports = { dependency: { platforms: { android: { sourceDir: './platform/android' } } } };
@@ -0,0 +1,16 @@
1
+ import {
2
+ type CodegenTypes,
3
+ type ColorValue,
4
+ type HostComponent,
5
+ type ViewProps,
6
+ codegenNativeComponent,
7
+ } from 'react-native';
8
+
9
+ export interface NativeProps extends ViewProps {
10
+ blurIntensity?: CodegenTypes.WithDefault<CodegenTypes.Double, 12>;
11
+ fadeStop?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
12
+ direction?: CodegenTypes.WithDefault<'down' | 'up' | 'left' | 'right', 'down'>;
13
+ fallbackColor?: ColorValue;
14
+ }
15
+
16
+ export default codegenNativeComponent<NativeProps>('SliceBackgroundBlur') as HostComponent<NativeProps>;
@@ -0,0 +1,18 @@
1
+ import {
2
+ type CodegenTypes,
3
+ type ColorValue,
4
+ type HostComponent,
5
+ type ViewProps,
6
+ codegenNativeComponent,
7
+ } from 'react-native';
8
+
9
+ export interface NativeProps extends ViewProps {
10
+ glassStyle?: CodegenTypes.WithDefault<'regular' | 'clear', 'regular'>;
11
+ glassTintColor?: ColorValue;
12
+ interactive?: CodegenTypes.WithDefault<boolean, false>;
13
+ cornerRadius?: CodegenTypes.WithDefault<CodegenTypes.Double, 24>;
14
+ }
15
+
16
+ export default codegenNativeComponent<NativeProps>('SliceLiquidGlassView', {
17
+ excludedPlatforms: ['android'],
18
+ }) as HostComponent<NativeProps>;
@@ -0,0 +1,13 @@
1
+ import type { TurboModule } from 'react-native';
2
+ import { TurboModuleRegistry } from 'react-native';
3
+
4
+ export interface Spec extends TurboModule {
5
+ readonly getConstants: () => {
6
+ supportsLiquidGlass: boolean;
7
+ supportsNativeBlur: boolean;
8
+ deviceName: string;
9
+ deviceModel: string;
10
+ };
11
+ }
12
+
13
+ export default TurboModuleRegistry.get<Spec>('SliceDeviceCapabilities');
@@ -1,2 +0,0 @@
1
- import type { IconProps } from './_types';
2
- export declare const NativeIcon: import("react").MemoExoticComponent<(props: IconProps) => import("react").JSX.Element | null>;
@@ -1,3 +0,0 @@
1
- export { NativeIcon, NativeIcon as Icon } from './NativeIcon';
2
- export type { IconProps } from './_types';
3
- export { SliceIcons } from './icons';
@@ -1,4 +0,0 @@
1
- export { Icon, NativeIcon, SliceIcons } from './components/Icon';
2
- export type { IconProps } from './components/Icon';
3
- export { lightTheme, darkTheme, createTypography } from './theme';
4
- export type { SliceNativeTheme, SliceTheme } from './theme';