@react-navigation/native 8.0.0-alpha.0 → 8.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ReactNavigation.podspec +20 -0
- package/android/build.gradle +147 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/org/reactnavigation/MaterialSymbolModule.kt +100 -0
- package/android/src/main/java/org/reactnavigation/MaterialSymbolTypeface.kt +77 -0
- package/android/src/main/java/org/reactnavigation/MaterialSymbolView.kt +95 -0
- package/android/src/main/java/org/reactnavigation/MaterialSymbolViewManager.kt +49 -0
- package/android/src/main/java/org/reactnavigation/ReactNavigationPackage.kt +34 -0
- package/assets/fonts/MaterialSymbolsOutlined.codepoints +4102 -0
- package/assets/fonts/MaterialSymbolsOutlined_100.ttf +0 -0
- package/assets/fonts/MaterialSymbolsOutlined_200.ttf +0 -0
- package/assets/fonts/MaterialSymbolsOutlined_300.ttf +0 -0
- package/assets/fonts/MaterialSymbolsOutlined_400.ttf +0 -0
- package/assets/fonts/MaterialSymbolsOutlined_500.ttf +0 -0
- package/assets/fonts/MaterialSymbolsOutlined_600.ttf +0 -0
- package/assets/fonts/MaterialSymbolsOutlined_700.ttf +0 -0
- package/assets/fonts/MaterialSymbolsRounded.codepoints +4102 -0
- package/assets/fonts/MaterialSymbolsRounded_100.ttf +0 -0
- package/assets/fonts/MaterialSymbolsRounded_200.ttf +0 -0
- package/assets/fonts/MaterialSymbolsRounded_300.ttf +0 -0
- package/assets/fonts/MaterialSymbolsRounded_400.ttf +0 -0
- package/assets/fonts/MaterialSymbolsRounded_500.ttf +0 -0
- package/assets/fonts/MaterialSymbolsRounded_600.ttf +0 -0
- package/assets/fonts/MaterialSymbolsRounded_700.ttf +0 -0
- package/assets/fonts/MaterialSymbolsSharp.codepoints +4102 -0
- package/assets/fonts/MaterialSymbolsSharp_100.ttf +0 -0
- package/assets/fonts/MaterialSymbolsSharp_200.ttf +0 -0
- package/assets/fonts/MaterialSymbolsSharp_300.ttf +0 -0
- package/assets/fonts/MaterialSymbolsSharp_400.ttf +0 -0
- package/assets/fonts/MaterialSymbolsSharp_500.ttf +0 -0
- package/assets/fonts/MaterialSymbolsSharp_600.ttf +0 -0
- package/assets/fonts/MaterialSymbolsSharp_700.ttf +0 -0
- package/ios/ReactNavigationSFSymbolView.h +14 -0
- package/ios/ReactNavigationSFSymbolView.mm +79 -0
- package/ios/ReactNavigationSFSymbolView.swift +300 -0
- package/lib/module/NavigationContainer.js +7 -2
- package/lib/module/NavigationContainer.js.map +1 -1
- package/lib/module/createStaticNavigation.js +3 -6
- package/lib/module/createStaticNavigation.js.map +1 -1
- package/lib/module/index.js +4 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/native/MaterialSymbol.android.js +58 -0
- package/lib/module/native/MaterialSymbol.android.js.map +1 -0
- package/lib/module/native/MaterialSymbol.js +9 -0
- package/lib/module/native/MaterialSymbol.js.map +1 -0
- package/lib/module/native/MaterialSymbolData.js +2 -0
- package/lib/module/native/MaterialSymbolData.js.map +1 -0
- package/lib/module/native/MaterialSymbolViewNativeComponent.ts +23 -0
- package/lib/module/native/NativeMaterialSymbolModule.js +7 -0
- package/lib/module/native/NativeMaterialSymbolModule.js.map +1 -0
- package/lib/module/native/SFSymbol.ios.js +46 -0
- package/lib/module/native/SFSymbol.ios.js.map +1 -0
- package/lib/module/native/SFSymbol.js +6 -0
- package/lib/module/native/SFSymbol.js.map +1 -0
- package/lib/module/native/SFSymbolViewNativeComponent.ts +32 -0
- package/lib/module/native/constants.js +14 -0
- package/lib/module/native/constants.js.map +1 -0
- package/lib/module/native/types.js +4 -0
- package/lib/module/native/types.js.map +1 -0
- package/lib/module/theming/{DefaultTheme.js → LightTheme.js} +2 -2
- package/lib/module/theming/LightTheme.js.map +1 -0
- package/lib/module/theming/MaterialTheme.android.js +29 -0
- package/lib/module/theming/MaterialTheme.android.js.map +1 -0
- package/lib/module/theming/MaterialTheme.js +18 -0
- package/lib/module/theming/MaterialTheme.js.map +1 -0
- package/lib/module/useLinkBuilder.js +24 -5
- package/lib/module/useLinkBuilder.js.map +1 -1
- package/lib/module/useLinkTo.js +2 -4
- package/lib/module/useLinkTo.js.map +1 -1
- package/lib/module/useLinking.native.js +20 -3
- package/lib/module/useLinking.native.js.map +1 -1
- package/lib/typescript/src/NavigationContainer.d.ts +6 -1
- package/lib/typescript/src/NavigationContainer.d.ts.map +1 -1
- package/lib/typescript/src/createStaticNavigation.d.ts +3 -3
- package/lib/typescript/src/createStaticNavigation.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +4 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/native/MaterialSymbol.android.d.ts +8 -0
- package/lib/typescript/src/native/MaterialSymbol.android.d.ts.map +1 -0
- package/lib/typescript/src/native/MaterialSymbol.d.ts +8 -0
- package/lib/typescript/src/native/MaterialSymbol.d.ts.map +1 -0
- package/lib/typescript/src/native/MaterialSymbolData.d.ts +2 -0
- package/lib/typescript/src/native/MaterialSymbolData.d.ts.map +1 -0
- package/lib/typescript/src/native/MaterialSymbolViewNativeComponent.d.ts +11 -0
- package/lib/typescript/src/native/MaterialSymbolViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/native/NativeMaterialSymbolModule.d.ts +7 -0
- package/lib/typescript/src/native/NativeMaterialSymbolModule.d.ts.map +1 -0
- package/lib/typescript/src/native/SFSymbol.d.ts +5 -0
- package/lib/typescript/src/native/SFSymbol.d.ts.map +1 -0
- package/lib/typescript/src/native/SFSymbol.ios.d.ts +5 -0
- package/lib/typescript/src/native/SFSymbol.ios.d.ts.map +1 -0
- package/lib/typescript/src/native/SFSymbolViewNativeComponent.d.ts +23 -0
- package/lib/typescript/src/native/SFSymbolViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/native/constants.d.ts +12 -0
- package/lib/typescript/src/native/constants.d.ts.map +1 -0
- package/lib/typescript/src/native/types.d.ts +181 -0
- package/lib/typescript/src/native/types.d.ts.map +1 -0
- package/lib/typescript/src/theming/{DefaultTheme.d.ts → LightTheme.d.ts} +2 -2
- package/lib/typescript/src/theming/LightTheme.d.ts.map +1 -0
- package/lib/typescript/src/theming/MaterialTheme.android.d.ts +127 -0
- package/lib/typescript/src/theming/MaterialTheme.android.d.ts.map +1 -0
- package/lib/typescript/src/theming/MaterialTheme.d.ts +114 -0
- package/lib/typescript/src/theming/MaterialTheme.d.ts.map +1 -0
- package/lib/typescript/src/useLinkBuilder.d.ts +104 -6
- package/lib/typescript/src/useLinkBuilder.d.ts.map +1 -1
- package/lib/typescript/src/useLinking.native.d.ts.map +1 -1
- package/package.json +39 -4
- package/src/NavigationContainer.tsx +20 -3
- package/src/createStaticNavigation.tsx +8 -12
- package/src/index.tsx +7 -1
- package/src/native/MaterialSymbol.android.tsx +83 -0
- package/src/native/MaterialSymbol.tsx +17 -0
- package/src/native/MaterialSymbolData.tsx +4106 -0
- package/src/native/MaterialSymbolViewNativeComponent.ts +23 -0
- package/src/native/NativeMaterialSymbolModule.ts +19 -0
- package/src/native/SFSymbol.ios.tsx +53 -0
- package/src/native/SFSymbol.tsx +9 -0
- package/src/native/SFSymbolViewNativeComponent.ts +32 -0
- package/src/native/constants.tsx +11 -0
- package/src/native/types.tsx +218 -0
- package/src/theming/{DefaultTheme.tsx → LightTheme.tsx} +1 -1
- package/src/theming/MaterialTheme.android.tsx +30 -0
- package/src/theming/MaterialTheme.tsx +19 -0
- package/src/useLinkBuilder.tsx +26 -6
- package/src/useLinkTo.tsx +2 -2
- package/src/useLinking.native.tsx +38 -15
- package/lib/module/theming/DefaultTheme.js.map +0 -1
- package/lib/typescript/src/theming/DefaultTheme.d.ts.map +0 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#import <React/RCTViewComponentView.h>
|
|
2
|
+
#import <UIKit/UIKit.h>
|
|
3
|
+
|
|
4
|
+
#ifndef ReactNavigationSFSymbolViewNativeComponent_h
|
|
5
|
+
#define ReactNavigationSFSymbolViewNativeComponent_h
|
|
6
|
+
|
|
7
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
8
|
+
|
|
9
|
+
@interface ReactNavigationSFSymbolView : RCTViewComponentView
|
|
10
|
+
@end
|
|
11
|
+
|
|
12
|
+
NS_ASSUME_NONNULL_END
|
|
13
|
+
|
|
14
|
+
#endif /* ReactNavigationSFSymbolViewNativeComponent_h */
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#import "ReactNavigationSFSymbolView.h"
|
|
2
|
+
|
|
3
|
+
#if __has_include("ReactNavigation/ReactNavigation-Swift.h")
|
|
4
|
+
#import "ReactNavigation/ReactNavigation-Swift.h"
|
|
5
|
+
#else
|
|
6
|
+
#import "ReactNavigation-Swift.h"
|
|
7
|
+
#endif
|
|
8
|
+
|
|
9
|
+
#import <React/RCTConversions.h>
|
|
10
|
+
#import <react/renderer/components/ReactNavigationSpec/ComponentDescriptors.h>
|
|
11
|
+
#import <react/renderer/components/ReactNavigationSpec/Props.h>
|
|
12
|
+
|
|
13
|
+
#import "RCTFabricComponentsPlugins.h"
|
|
14
|
+
|
|
15
|
+
using namespace facebook::react;
|
|
16
|
+
|
|
17
|
+
@implementation ReactNavigationSFSymbolView {
|
|
18
|
+
ReactNavigationSFSymbolViewImpl * _view;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
22
|
+
{
|
|
23
|
+
return concreteComponentDescriptorProvider<ReactNavigationSFSymbolViewComponentDescriptor>();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
- (instancetype)initWithFrame:(CGRect)frame
|
|
27
|
+
{
|
|
28
|
+
if (self = [super initWithFrame:frame]) {
|
|
29
|
+
static const auto defaultProps = std::make_shared<const ReactNavigationSFSymbolViewProps>();
|
|
30
|
+
_props = defaultProps;
|
|
31
|
+
|
|
32
|
+
_view = [[ReactNavigationSFSymbolViewImpl alloc] init];
|
|
33
|
+
|
|
34
|
+
self.contentView = _view;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return self;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static ReactNavigationSFSymbolViewImplProps *convertProps(const Props::Shared &props) {
|
|
41
|
+
const auto &viewProps = *std::static_pointer_cast<ReactNavigationSFSymbolViewProps const>(props);
|
|
42
|
+
|
|
43
|
+
ReactNavigationSFSymbolViewImplProps *swiftProps = [[ReactNavigationSFSymbolViewImplProps alloc] init];
|
|
44
|
+
|
|
45
|
+
swiftProps.name = RCTNSStringFromString(viewProps.name);
|
|
46
|
+
swiftProps.size = viewProps.size;
|
|
47
|
+
swiftProps.color = RCTUIColorFromSharedColor(viewProps.color);
|
|
48
|
+
swiftProps.weight = viewProps.weight;
|
|
49
|
+
swiftProps.scale = RCTNSStringFromString(viewProps.scale);
|
|
50
|
+
swiftProps.mode = RCTNSStringFromString(viewProps.mode);
|
|
51
|
+
swiftProps.animation = RCTNSStringFromString(viewProps.animation);
|
|
52
|
+
swiftProps.animationRepeating = viewProps.animationRepeating;
|
|
53
|
+
swiftProps.animationRepeatCount = viewProps.animationRepeatCount;
|
|
54
|
+
swiftProps.animationSpeed = viewProps.animationSpeed;
|
|
55
|
+
swiftProps.animationWholeSymbol = viewProps.animationWholeSymbol;
|
|
56
|
+
swiftProps.animationDirection = RCTNSStringFromString(viewProps.animationDirection);
|
|
57
|
+
swiftProps.animationReversing = viewProps.animationReversing;
|
|
58
|
+
swiftProps.animationCumulative = viewProps.animationCumulative;
|
|
59
|
+
|
|
60
|
+
if (viewProps.colorPrimary) {
|
|
61
|
+
swiftProps.colorPrimary = RCTUIColorFromSharedColor(viewProps.colorPrimary);
|
|
62
|
+
}
|
|
63
|
+
if (viewProps.colorSecondary) {
|
|
64
|
+
swiftProps.colorSecondary = RCTUIColorFromSharedColor(viewProps.colorSecondary);
|
|
65
|
+
}
|
|
66
|
+
if (viewProps.colorTertiary) {
|
|
67
|
+
swiftProps.colorTertiary = RCTUIColorFromSharedColor(viewProps.colorTertiary);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return swiftProps;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
|
|
74
|
+
{
|
|
75
|
+
[_view updateProps:convertProps(props) oldProps:convertProps(_props)];
|
|
76
|
+
[super updateProps:props oldProps:oldProps];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
@end
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
import UIKit
|
|
2
|
+
|
|
3
|
+
@objcMembers public class ReactNavigationSFSymbolViewImplProps: NSObject {
|
|
4
|
+
public var name: String?
|
|
5
|
+
public var size: CGFloat = 24
|
|
6
|
+
public var color: UIColor = .black
|
|
7
|
+
public var weight: Int = 0
|
|
8
|
+
public var scale: String = "medium"
|
|
9
|
+
public var mode: String = "monochrome"
|
|
10
|
+
public var colorPrimary: UIColor?
|
|
11
|
+
public var colorSecondary: UIColor?
|
|
12
|
+
public var colorTertiary: UIColor?
|
|
13
|
+
public var animation: String = ""
|
|
14
|
+
public var animationRepeating: Bool = false
|
|
15
|
+
public var animationRepeatCount: Int = 0
|
|
16
|
+
public var animationSpeed: CGFloat = 1
|
|
17
|
+
public var animationWholeSymbol: Bool = false
|
|
18
|
+
public var animationDirection: String = ""
|
|
19
|
+
public var animationReversing: Bool = false
|
|
20
|
+
public var animationCumulative: Bool = false
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@objc public class ReactNavigationSFSymbolViewImpl: UIView {
|
|
24
|
+
private var imageView: UIImageView
|
|
25
|
+
private var currentAnimation: String = ""
|
|
26
|
+
|
|
27
|
+
override init(frame: CGRect) {
|
|
28
|
+
imageView = UIImageView()
|
|
29
|
+
imageView.contentMode = .center
|
|
30
|
+
imageView.translatesAutoresizingMaskIntoConstraints = false
|
|
31
|
+
|
|
32
|
+
super.init(frame: frame)
|
|
33
|
+
|
|
34
|
+
addSubview(imageView)
|
|
35
|
+
|
|
36
|
+
NSLayoutConstraint.activate([
|
|
37
|
+
imageView.topAnchor.constraint(equalTo: topAnchor),
|
|
38
|
+
imageView.bottomAnchor.constraint(equalTo: bottomAnchor),
|
|
39
|
+
imageView.leadingAnchor.constraint(equalTo: leadingAnchor),
|
|
40
|
+
imageView.trailingAnchor.constraint(equalTo: trailingAnchor),
|
|
41
|
+
])
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
required init?(coder: NSCoder) {
|
|
45
|
+
// This is only called for storyboard
|
|
46
|
+
// So we don't need to implement it
|
|
47
|
+
fatalError("init(coder:) has not been implemented")
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@objc public func updateProps(_ props: ReactNavigationSFSymbolViewImplProps, oldProps: ReactNavigationSFSymbolViewImplProps) {
|
|
51
|
+
let needsImageUpdate =
|
|
52
|
+
props.name != oldProps.name ||
|
|
53
|
+
props.size != oldProps.size ||
|
|
54
|
+
props.weight != oldProps.weight ||
|
|
55
|
+
props.scale != oldProps.scale ||
|
|
56
|
+
props.mode != oldProps.mode ||
|
|
57
|
+
props.colorPrimary != oldProps.colorPrimary ||
|
|
58
|
+
props.colorSecondary != oldProps.colorSecondary ||
|
|
59
|
+
props.colorTertiary != oldProps.colorTertiary
|
|
60
|
+
|
|
61
|
+
if needsImageUpdate {
|
|
62
|
+
if let name = props.name {
|
|
63
|
+
let symbolWeight = Self.symbolWeight(from: props.weight)
|
|
64
|
+
let symbolScale = Self.symbolScale(from: props.scale)
|
|
65
|
+
|
|
66
|
+
var configuration = UIImage.SymbolConfiguration(pointSize: props.size, weight: symbolWeight, scale: symbolScale)
|
|
67
|
+
|
|
68
|
+
let primaryColor = props.colorPrimary ?? props.color
|
|
69
|
+
|
|
70
|
+
switch props.mode {
|
|
71
|
+
case "hierarchical":
|
|
72
|
+
configuration = configuration.applying(
|
|
73
|
+
UIImage.SymbolConfiguration(hierarchicalColor: primaryColor)
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
let image = UIImage(systemName: name, withConfiguration: configuration)
|
|
77
|
+
|
|
78
|
+
imageView.image = image
|
|
79
|
+
imageView.tintColor = nil
|
|
80
|
+
|
|
81
|
+
case "palette":
|
|
82
|
+
var paletteColors: [UIColor] = []
|
|
83
|
+
|
|
84
|
+
paletteColors.append(primaryColor)
|
|
85
|
+
|
|
86
|
+
if let secondary = props.colorSecondary {
|
|
87
|
+
paletteColors.append(secondary)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if let tertiary = props.colorTertiary {
|
|
91
|
+
paletteColors.append(tertiary)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
configuration = configuration.applying(
|
|
95
|
+
UIImage.SymbolConfiguration(paletteColors: paletteColors)
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
let image = UIImage(systemName: name, withConfiguration: configuration)
|
|
99
|
+
|
|
100
|
+
imageView.image = image
|
|
101
|
+
imageView.tintColor = nil
|
|
102
|
+
|
|
103
|
+
case "multicolor":
|
|
104
|
+
configuration = configuration.applying(
|
|
105
|
+
UIImage.SymbolConfiguration.preferringMulticolor()
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
let image = UIImage(systemName: name, withConfiguration: configuration)
|
|
109
|
+
|
|
110
|
+
imageView.image = image
|
|
111
|
+
imageView.tintColor = nil
|
|
112
|
+
|
|
113
|
+
default:
|
|
114
|
+
// monochrome
|
|
115
|
+
let image = UIImage(systemName: name, withConfiguration: configuration)
|
|
116
|
+
|
|
117
|
+
imageView.image = image?.withRenderingMode(.alwaysTemplate)
|
|
118
|
+
imageView.tintColor = primaryColor
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if !needsImageUpdate && props.color != oldProps.color && props.mode == "monochrome" {
|
|
124
|
+
imageView.tintColor = props.colorPrimary ?? props.color
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
let animationChanged =
|
|
128
|
+
props.animation != oldProps.animation ||
|
|
129
|
+
props.animationRepeating != oldProps.animationRepeating ||
|
|
130
|
+
props.animationRepeatCount != oldProps.animationRepeatCount ||
|
|
131
|
+
props.animationSpeed != oldProps.animationSpeed ||
|
|
132
|
+
props.animationWholeSymbol != oldProps.animationWholeSymbol ||
|
|
133
|
+
props.animationDirection != oldProps.animationDirection ||
|
|
134
|
+
props.animationReversing != oldProps.animationReversing ||
|
|
135
|
+
props.animationCumulative != oldProps.animationCumulative
|
|
136
|
+
|
|
137
|
+
if animationChanged {
|
|
138
|
+
updateAnimation(props)
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
private func updateAnimation(_ props: ReactNavigationSFSymbolViewImplProps) {
|
|
143
|
+
guard #available(iOS 17.0, *) else { return }
|
|
144
|
+
|
|
145
|
+
imageView.removeAllSymbolEffects()
|
|
146
|
+
|
|
147
|
+
guard !props.animation.isEmpty else { return }
|
|
148
|
+
|
|
149
|
+
var options: SymbolEffectOptions = .default
|
|
150
|
+
|
|
151
|
+
if props.animationRepeating {
|
|
152
|
+
options = options.repeating
|
|
153
|
+
} else if props.animationRepeatCount > 0 {
|
|
154
|
+
options = options.repeat(props.animationRepeatCount)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if props.animationSpeed != 1 {
|
|
158
|
+
options = options.speed(props.animationSpeed)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
switch props.animation {
|
|
162
|
+
case "bounce":
|
|
163
|
+
var effect = BounceSymbolEffect.bounce
|
|
164
|
+
|
|
165
|
+
if props.animationWholeSymbol {
|
|
166
|
+
effect = effect.wholeSymbol
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if props.animationDirection == "up" {
|
|
170
|
+
effect = effect.up
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if props.animationDirection == "down" {
|
|
174
|
+
effect = effect.down
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
imageView.addSymbolEffect(effect, options: options)
|
|
178
|
+
|
|
179
|
+
case "pulse":
|
|
180
|
+
var effect = PulseSymbolEffect.pulse
|
|
181
|
+
|
|
182
|
+
if props.animationWholeSymbol {
|
|
183
|
+
effect = effect.wholeSymbol
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
imageView.addSymbolEffect(effect, options: options)
|
|
187
|
+
|
|
188
|
+
case "appear":
|
|
189
|
+
var effect = AppearSymbolEffect.appear
|
|
190
|
+
|
|
191
|
+
if props.animationWholeSymbol {
|
|
192
|
+
effect = effect.wholeSymbol
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if props.animationDirection == "up" {
|
|
196
|
+
effect = effect.up
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if props.animationDirection == "down" {
|
|
200
|
+
effect = effect.down
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
imageView.addSymbolEffect(effect, options: options)
|
|
204
|
+
|
|
205
|
+
case "disappear":
|
|
206
|
+
var effect = DisappearSymbolEffect.disappear
|
|
207
|
+
|
|
208
|
+
if props.animationWholeSymbol {
|
|
209
|
+
effect = effect.wholeSymbol
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
if props.animationDirection == "up" {
|
|
213
|
+
effect = effect.up
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
if props.animationDirection == "down" {
|
|
217
|
+
effect = effect.down
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
imageView.addSymbolEffect(effect, options: options)
|
|
221
|
+
|
|
222
|
+
case "variableColor":
|
|
223
|
+
var effect = VariableColorSymbolEffect.variableColor
|
|
224
|
+
|
|
225
|
+
if props.animationReversing {
|
|
226
|
+
effect = props.animationCumulative ? effect.reversing.cumulative : effect.reversing.iterative
|
|
227
|
+
} else {
|
|
228
|
+
effect = props.animationCumulative ? effect.nonReversing.cumulative : effect.nonReversing.iterative
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
imageView.addSymbolEffect(effect, options: options)
|
|
232
|
+
|
|
233
|
+
case "breathe":
|
|
234
|
+
if #available(iOS 18.0, *) {
|
|
235
|
+
var effect = BreatheSymbolEffect.breathe
|
|
236
|
+
|
|
237
|
+
if props.animationWholeSymbol {
|
|
238
|
+
effect = effect.wholeSymbol
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
imageView.addSymbolEffect(effect, options: options)
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
case "wiggle":
|
|
245
|
+
if #available(iOS 18.0, *) {
|
|
246
|
+
var effect = WiggleSymbolEffect.wiggle
|
|
247
|
+
|
|
248
|
+
if props.animationWholeSymbol {
|
|
249
|
+
effect = effect.wholeSymbol
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
if props.animationDirection == "up" {
|
|
253
|
+
effect = effect.up
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
if props.animationDirection == "down" {
|
|
257
|
+
effect = effect.down
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
imageView.addSymbolEffect(effect, options: options)
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
case "rotate":
|
|
264
|
+
if #available(iOS 18.0, *) {
|
|
265
|
+
var effect = RotateSymbolEffect.rotate
|
|
266
|
+
|
|
267
|
+
if props.animationWholeSymbol {
|
|
268
|
+
effect = effect.wholeSymbol
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
imageView.addSymbolEffect(effect, options: options)
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
default: break
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
private static func symbolWeight(from value: Int) -> UIImage.SymbolWeight {
|
|
279
|
+
switch value {
|
|
280
|
+
case 100: return .thin
|
|
281
|
+
case 200: return .ultraLight
|
|
282
|
+
case 300: return .light
|
|
283
|
+
case 400: return .regular
|
|
284
|
+
case 500: return .medium
|
|
285
|
+
case 600: return .semibold
|
|
286
|
+
case 700: return .bold
|
|
287
|
+
case 800: return .heavy
|
|
288
|
+
case 900: return .black
|
|
289
|
+
default: return .regular
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
private static func symbolScale(from value: String) -> UIImage.SymbolScale {
|
|
294
|
+
switch value {
|
|
295
|
+
case "small": return .small
|
|
296
|
+
case "large": return .large
|
|
297
|
+
default: return .medium
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
@@ -5,7 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import { I18nManager, Platform } from 'react-native';
|
|
6
6
|
import { LinkingContext } from "./LinkingContext.js";
|
|
7
7
|
import { LocaleDirContext } from "./LocaleDirContext.js";
|
|
8
|
-
import {
|
|
8
|
+
import { LightTheme } from "./theming/LightTheme.js";
|
|
9
9
|
import { useBackButton } from './useBackButton';
|
|
10
10
|
import { useDocumentTitle } from './useDocumentTitle';
|
|
11
11
|
import { useLinking } from './useLinking';
|
|
@@ -15,7 +15,7 @@ globalThis.REACT_NAVIGATION_DEVTOOLS = new WeakMap();
|
|
|
15
15
|
const RESTORE_STATE_ERROR = 'Failed to restore navigation state. The state will be initialized based on the navigation tree.';
|
|
16
16
|
function NavigationContainerInner({
|
|
17
17
|
direction = I18nManager.getConstants().isRTL ? 'rtl' : 'ltr',
|
|
18
|
-
theme =
|
|
18
|
+
theme = LightTheme,
|
|
19
19
|
linking,
|
|
20
20
|
persistor,
|
|
21
21
|
fallback = null,
|
|
@@ -56,9 +56,14 @@ function NavigationContainerInner({
|
|
|
56
56
|
// This will be used by the devtools
|
|
57
57
|
React.useEffect(() => {
|
|
58
58
|
if (refContainer.current) {
|
|
59
|
+
const previous = REACT_NAVIGATION_DEVTOOLS.get(refContainer.current);
|
|
60
|
+
const listeners = previous?.listeners ?? new Set();
|
|
59
61
|
REACT_NAVIGATION_DEVTOOLS.set(refContainer.current, {
|
|
60
62
|
get linking() {
|
|
61
63
|
return linkingConfig.options;
|
|
64
|
+
},
|
|
65
|
+
get listeners() {
|
|
66
|
+
return listeners;
|
|
62
67
|
}
|
|
63
68
|
});
|
|
64
69
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BaseNavigationContainer","getActionFromState","getPathFromState","getStateFromPath","ThemeProvider","validatePathConfig","React","I18nManager","Platform","LinkingContext","LocaleDirContext","
|
|
1
|
+
{"version":3,"names":["BaseNavigationContainer","getActionFromState","getPathFromState","getStateFromPath","ThemeProvider","validatePathConfig","React","I18nManager","Platform","LinkingContext","LocaleDirContext","LightTheme","useBackButton","useDocumentTitle","useLinking","useThenable","jsx","_jsx","globalThis","REACT_NAVIGATION_DEVTOOLS","WeakMap","RESTORE_STATE_ERROR","NavigationContainerInner","direction","getConstants","isRTL","theme","linking","persistor","fallback","documentTitle","onStateChange","rest","ref","config","refContainer","useRef","linkingConfig","useMemo","options","enabled","prefixes","getInitialState","useEffect","current","previous","get","listeners","Set","set","isLinkStateResolved","initialStateFromLink","initialState","undefined","isPersistenceSupported","OS","isPersistedStateResolved","initialStateFromPersisted","restoredState","restore","e","console","error","then","state","thenable","onfulfilled","Promise","resolve","useImperativeHandle","isStateReady","Provider","value","children","persist","NavigationContainer","forwardRef"],"sourceRoot":"../../src","sources":["NavigationContainer.tsx"],"mappings":";;AAAA,SACEA,uBAAuB,EACvBC,kBAAkB,EAClBC,gBAAgB,EAChBC,gBAAgB,EAQhBC,aAAa,EACbC,kBAAkB,QACb,wBAAwB;AAC/B,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,WAAW,EAAEC,QAAQ,QAAQ,cAAc;AAEpD,SAASC,cAAc,QAAQ,qBAAkB;AACjD,SAASC,gBAAgB,QAAQ,uBAAoB;AACrD,SAASC,UAAU,QAAQ,yBAAsB;AAOjD,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,UAAU,QAAQ,cAAc;AACzC,SAAwBC,WAAW,QAAQ,kBAAe;AAAC,SAAAC,GAAA,IAAAC,IAAA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,KAAM;QACb0B,YAAY,EACVpB,IAAI,CAACoB,YAAY,IACjBD,oBAAoB,IACpBM,yBACD;QACD1B,aAAa,EAAGiC,KAAK,IAAK;UACxBjC,aAAa,GAAGiC,KAAK,CAAC;UACtBpC,SAAS,EAAE8C,OAAO,CAACV,KAAK,CAAC;QAC3B,CAAE;QACF/B,GAAG,EAAEE;MAAa,CACnB;IAAC,CACqB;EAAC,CACD,CAAC;AAEhC;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMwC,mBAAmB,gBAAGrE,KAAK,CAACsE,UAAU,CACjDtD,wBACF,CAIuB","ignoreList":[]}
|
|
@@ -20,7 +20,7 @@ export function createStaticNavigation(tree) {
|
|
|
20
20
|
const linkingConfig = React.useMemo(() => {
|
|
21
21
|
const screens = createPathConfigForStaticNavigation(tree, {
|
|
22
22
|
initialRouteName: linking?.config?.initialRouteName
|
|
23
|
-
}, linking?.enabled === 'auto');
|
|
23
|
+
}, linking?.enabled == null || linking.enabled === 'auto');
|
|
24
24
|
if (!screens) return;
|
|
25
25
|
return {
|
|
26
26
|
path: linking?.config?.path,
|
|
@@ -29,10 +29,7 @@ export function createStaticNavigation(tree) {
|
|
|
29
29
|
};
|
|
30
30
|
}, [linking?.enabled, linking?.config?.path, linking?.config?.initialRouteName]);
|
|
31
31
|
const memoizedLinking = React.useMemo(() => {
|
|
32
|
-
|
|
33
|
-
return undefined;
|
|
34
|
-
}
|
|
35
|
-
const enabled = typeof linking.enabled === 'boolean' ? linking.enabled : linkingConfig?.screens != null;
|
|
32
|
+
const enabled = linking?.enabled == null || linking.enabled === 'auto' ? true : linking.enabled;
|
|
36
33
|
return {
|
|
37
34
|
...linking,
|
|
38
35
|
enabled,
|
|
@@ -40,7 +37,7 @@ export function createStaticNavigation(tree) {
|
|
|
40
37
|
};
|
|
41
38
|
}, [linking, linkingConfig]);
|
|
42
39
|
if (linking?.enabled === true && linkingConfig?.screens == null) {
|
|
43
|
-
throw new Error('Linking is enabled but no linking configuration was found for the screens.\n\n' + 'To solve this:\n' + "- Specify a 'linking' property
|
|
40
|
+
throw new Error('Linking is enabled but no linking configuration was found for the screens.\n\n' + 'To solve this:\n' + "- Specify a 'linking' property in each of the screen configs that you want to link to.\n" + "- Or set 'linking.enabled' to 'auto' to generate paths automatically.\n\n" + 'See usage guide: https://reactnavigation.org/docs/static-configuration#linking');
|
|
44
41
|
}
|
|
45
42
|
return /*#__PURE__*/_jsx(NavigationContainer, {
|
|
46
43
|
...rest,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createComponentForStaticNavigation","createPathConfigForStaticNavigation","React","NavigationContainer","jsx","_jsx","createStaticNavigation","tree","Component","Navigation","linking","rest","ref","linkingConfig","useMemo","screens","initialRouteName","config","enabled","path","memoizedLinking","
|
|
1
|
+
{"version":3,"names":["createComponentForStaticNavigation","createPathConfigForStaticNavigation","React","NavigationContainer","jsx","_jsx","createStaticNavigation","tree","Component","Navigation","linking","rest","ref","linkingConfig","useMemo","screens","initialRouteName","config","enabled","path","memoizedLinking","Error","children","forwardRef"],"sourceRoot":"../../src","sources":["createStaticNavigation.tsx"],"mappings":";;AAAA,SACEA,kCAAkC,EAClCC,mCAAmC,QAI9B,wBAAwB;AAC/B,OAAO,KAAKC,KAAK,MAAM,OAAO;AAE9B,SAASC,mBAAmB,QAAQ,0BAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AA8B5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsBA,CAACC,IAAqC,EAAE;EAC5E,MAAMC,SAAS,GAAGR,kCAAkC,CAACO,IAAI,EAAE,eAAe,CAAC;EAE3E,SAASE,UAAUA,CACjB;IAAEC,OAAO;IAAE,GAAGC;EAAY,CAAC,EAC3BC,GAAqD,EACrD;IACA,MAAMC,aAAa,GAAGX,KAAK,CAACY,OAAO,CAAC,MAAM;MACxC,MAAMC,OAAO,GAAGd,mCAAmC,CACjDM,IAAI,EACJ;QAAES,gBAAgB,EAAE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 +4,13 @@ export { createStaticNavigation } from "./createStaticNavigation.js";
|
|
|
4
4
|
export { Link } from "./Link.js";
|
|
5
5
|
export { LinkingContext } from "./LinkingContext.js";
|
|
6
6
|
export { LocaleDirContext } from "./LocaleDirContext.js";
|
|
7
|
+
export { MaterialSymbol } from './native/MaterialSymbol';
|
|
8
|
+
export { SFSymbol } from './native/SFSymbol';
|
|
7
9
|
export { NavigationContainer } from "./NavigationContainer.js";
|
|
8
10
|
export { ServerContainer } from "./ServerContainer.js";
|
|
9
11
|
export { DarkTheme } from "./theming/DarkTheme.js";
|
|
10
|
-
export { DefaultTheme } from "./theming/
|
|
12
|
+
export { LightTheme as DefaultTheme } from "./theming/LightTheme.js";
|
|
13
|
+
export { MaterialDarkTheme, MaterialLightTheme } from './theming/MaterialTheme';
|
|
11
14
|
export * from "./types.js";
|
|
12
15
|
export { useLinkBuilder } from "./useLinkBuilder.js";
|
|
13
16
|
export { useLinkProps } from "./useLinkProps.js";
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createStaticNavigation","Link","LinkingContext","LocaleDirContext","NavigationContainer","ServerContainer","DarkTheme","DefaultTheme","useLinkBuilder","useLinkProps","useLinkTo","useLocale","useRoutePath","useScrollToTop"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,sBAAsB,QAAQ,6BAA0B;AACjE,SAASC,IAAI,QAAQ,WAAQ;AAC7B,SAASC,cAAc,QAAQ,qBAAkB;AACjD,SAASC,gBAAgB,QAAQ,uBAAoB;AACrD,SAASC,mBAAmB,QAAQ,0BAAuB;AAC3D,SAASC,eAAe,QAAQ,sBAAmB;AACnD,SAASC,SAAS,QAAQ,wBAAqB;AAC/C,SAASC,YAAY,QAAQ,
|
|
1
|
+
{"version":3,"names":["createStaticNavigation","Link","LinkingContext","LocaleDirContext","MaterialSymbol","SFSymbol","NavigationContainer","ServerContainer","DarkTheme","LightTheme","DefaultTheme","MaterialDarkTheme","MaterialLightTheme","useLinkBuilder","useLinkProps","useLinkTo","useLocale","useRoutePath","useScrollToTop"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,sBAAsB,QAAQ,6BAA0B;AACjE,SAASC,IAAI,QAAQ,WAAQ;AAC7B,SAASC,cAAc,QAAQ,qBAAkB;AACjD,SAASC,gBAAgB,QAAQ,uBAAoB;AACrD,SACEC,cAAc,QAET,yBAAyB;AAChC,SAASC,QAAQ,QAA4B,mBAAmB;AAChE,SAASC,mBAAmB,QAAQ,0BAAuB;AAC3D,SAASC,eAAe,QAAQ,sBAAmB;AACnD,SAASC,SAAS,QAAQ,wBAAqB;AAC/C,SAASC,UAAU,IAAIC,YAAY,QAAQ,yBAAsB;AACjE,SAASC,iBAAiB,EAAEC,kBAAkB,QAAQ,yBAAyB;AAC/E,cAAc,YAAS;AACvB,SAASC,cAAc,QAAQ,qBAAkB;AACjD,SAAyBC,YAAY,QAAQ,mBAAgB;AAC7D,SAASC,SAAS,QAAQ,gBAAa;AACvC,SAASC,SAAS,QAAQ,gBAAa;AACvC,SAASC,YAAY,QAAQ,mBAAgB;AAC7C,SAASC,cAAc,QAAQ,qBAAkB;AACjD,cAAc,wBAAwB","ignoreList":[]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { PixelRatio, processColor } from 'react-native';
|
|
4
|
+
import { FONT_WEIGHTS } from "./constants.js";
|
|
5
|
+
import MaterialSymbolViewNativeComponent from './MaterialSymbolViewNativeComponent';
|
|
6
|
+
import NativeMaterialSymbolModule from "./NativeMaterialSymbolModule.js";
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
const imageSourceCache = new Map();
|
|
9
|
+
export function MaterialSymbol({
|
|
10
|
+
name,
|
|
11
|
+
weight,
|
|
12
|
+
size = 24,
|
|
13
|
+
color,
|
|
14
|
+
style,
|
|
15
|
+
...rest
|
|
16
|
+
}) {
|
|
17
|
+
return /*#__PURE__*/_jsx(MaterialSymbolViewNativeComponent, {
|
|
18
|
+
name: name,
|
|
19
|
+
weight: typeof weight === 'string' ? FONT_WEIGHTS[weight] : weight ?? 0,
|
|
20
|
+
size: size,
|
|
21
|
+
color: color,
|
|
22
|
+
style: [{
|
|
23
|
+
width: size,
|
|
24
|
+
height: size
|
|
25
|
+
}, style],
|
|
26
|
+
...rest
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
MaterialSymbol.getImageSource = ({
|
|
30
|
+
name,
|
|
31
|
+
variant,
|
|
32
|
+
weight,
|
|
33
|
+
size = 24,
|
|
34
|
+
color = 'black'
|
|
35
|
+
}) => {
|
|
36
|
+
const processedColor = processColor(color);
|
|
37
|
+
if (processedColor == null) {
|
|
38
|
+
throw new Error(`Invalid color value: ${String(color)}`);
|
|
39
|
+
}
|
|
40
|
+
const scale = PixelRatio.get();
|
|
41
|
+
const cacheKey = `${name}:${variant}:${weight}:${size}:${scale}:${JSON.stringify(processedColor)}`;
|
|
42
|
+
const cached = imageSourceCache.get(cacheKey);
|
|
43
|
+
if (cached !== undefined) {
|
|
44
|
+
return cached;
|
|
45
|
+
}
|
|
46
|
+
const uri = NativeMaterialSymbolModule.getImageSource(name, variant, typeof weight === 'string' ? FONT_WEIGHTS[weight] : weight, size, {
|
|
47
|
+
value: processedColor
|
|
48
|
+
});
|
|
49
|
+
const source = {
|
|
50
|
+
uri,
|
|
51
|
+
scale,
|
|
52
|
+
width: size,
|
|
53
|
+
height: size
|
|
54
|
+
};
|
|
55
|
+
imageSourceCache.set(cacheKey, source);
|
|
56
|
+
return source;
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=MaterialSymbol.android.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["PixelRatio","processColor","FONT_WEIGHTS","MaterialSymbolViewNativeComponent","NativeMaterialSymbolModule","jsx","_jsx","imageSourceCache","Map","MaterialSymbol","name","weight","size","color","style","rest","width","height","getImageSource","variant","processedColor","Error","String","scale","get","cacheKey","JSON","stringify","cached","undefined","uri","value","source","set"],"sourceRoot":"../../../src","sources":["native/MaterialSymbol.android.tsx"],"mappings":";;AAAA,SAEEA,UAAU,EACVC,YAAY,QAEP,cAAc;AAErB,SAASC,YAAY,QAAQ,gBAAa;AAC1C,OAAOC,iCAAiC,MAAM,qCAAqC;AACnF,OAAOC,0BAA0B,MAAM,iCAA8B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAKtE,MAAMC,gBAAgB,GAAG,IAAIC,GAAG,CAA8B,CAAC;AAE/D,OAAO,SAASC,cAAcA,CAAC;EAC7BC,IAAI;EACJC,MAAM;EACNC,IAAI,GAAG,EAAE;EACTC,KAAK;EACLC,KAAK;EACL,GAAGC;AACgB,CAAC,EAAsB;EAC1C,oBACET,IAAA,CAACH,iCAAiC;IAChCO,IAAI,EAAEA,IAAK;IACXC,MAAM,EAAE,OAAOA,MAAM,KAAK,QAAQ,GAAGT,YAAY,CAACS,MAAM,CAAC,GAAIA,MAAM,IAAI,CAAG;IAC1EC,IAAI,EAAEA,IAAK;IACXC,KAAK,EAAEA,KAAM;IACbC,KAAK,EAAE,CACL;MACEE,KAAK,EAAEJ,IAAI;MACXK,MAAM,EAAEL;IACV,CAAC,EACDE,KAAK,CACL;IAAA,GACEC;EAAI,CACT,CAAC;AAEN;AAEAN,cAAc,CAACS,cAAc,GAAG,CAAC;EAC/BR,IAAI;EACJS,OAAO;EACPR,MAAM;EACNC,IAAI,GAAG,EAAE;EACTC,KAAK,GAAG;AACa,CAAC,KAA0B;EAChD,MAAMO,cAAc,GAAGnB,YAAY,CAACY,KAAK,CAAC;EAE1C,IAAIO,cAAc,IAAI,IAAI,EAAE;IAC1B,MAAM,IAAIC,KAAK,CAAC,wBAAwBC,MAAM,CAACT,KAAK,CAAC,EAAE,CAAC;EAC1D;EAEA,MAAMU,KAAK,GAAGvB,UAAU,CAACwB,GAAG,CAAC,CAAC;EAE9B,MAAMC,QAAQ,GAAG,GAAGf,IAAI,IAAIS,OAAO,IAAIR,MAAM,IAAIC,IAAI,IAAIW,KAAK,IAAIG,IAAI,CAACC,SAAS,CAACP,cAAc,CAAC,EAAE;EAClG,MAAMQ,MAAM,GAAGrB,gBAAgB,CAACiB,GAAG,CAACC,QAAQ,CAAC;EAE7C,IAAIG,MAAM,KAAKC,SAAS,EAAE;IACxB,OAAOD,MAAM;EACf;EAEA,MAAME,GAAG,GAAG1B,0BAA0B,CAACc,cAAc,CACnDR,IAAI,EACJS,OAAO,EACP,OAAOR,MAAM,KAAK,QAAQ,GAAGT,YAAY,CAACS,MAAM,CAAC,GAAGA,MAAM,EAC1DC,IAAI,EACJ;IAAEmB,KAAK,EAAEX;EAAe,CAC1B,CAAC;EAED,MAAMY,MAA2B,GAAG;IAClCF,GAAG;IACHP,KAAK;IACLP,KAAK,EAAEJ,IAAI;IACXK,MAAM,EAAEL;EACV,CAAC;EAEDL,gBAAgB,CAAC0B,GAAG,CAACR,QAAQ,EAAEO,MAAM,CAAC;EAEtC,OAAOA,MAAM;AACf,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export function MaterialSymbol(_) {
|
|
4
|
+
throw new Error('MaterialSymbol is only supported on Android.');
|
|
5
|
+
}
|
|
6
|
+
MaterialSymbol.getImageSource = _ => {
|
|
7
|
+
throw new Error('MaterialSymbol.getImageSource is only supported on Android.');
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=MaterialSymbol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MaterialSymbol","_","Error","getImageSource"],"sourceRoot":"../../../src","sources":["native/MaterialSymbol.tsx"],"mappings":";;AAMA,OAAO,SAASA,cAAcA,CAACC,CAAsB,EAAsB;EACzE,MAAM,IAAIC,KAAK,CAAC,8CAA8C,CAAC;AACjE;AAEAF,cAAc,CAACG,cAAc,GAC3BF,CAAwB,IACA;EACxB,MAAM,IAAIC,KAAK,CACb,6DACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["native/MaterialSymbolData.tsx"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/* eslint-disable import-x/no-default-export */
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
codegenNativeComponent,
|
|
5
|
+
CodegenTypes,
|
|
6
|
+
type ColorValue,
|
|
7
|
+
type ViewProps,
|
|
8
|
+
} from 'react-native';
|
|
9
|
+
|
|
10
|
+
export interface NativeProps extends ViewProps {
|
|
11
|
+
name: string;
|
|
12
|
+
variant?: string;
|
|
13
|
+
weight?: CodegenTypes.WithDefault<
|
|
14
|
+
0 | 100 | 200 | 300 | 400 | 500 | 600 | 700,
|
|
15
|
+
0
|
|
16
|
+
>;
|
|
17
|
+
size: CodegenTypes.Float;
|
|
18
|
+
color?: ColorValue;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default codegenNativeComponent<NativeProps>(
|
|
22
|
+
'ReactNavigationMaterialSymbolView'
|
|
23
|
+
);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/* eslint-disable import-x/no-default-export */
|
|
4
|
+
|
|
5
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
6
|
+
export default TurboModuleRegistry.getEnforcing('ReactNavigationMaterialSymbolModule');
|
|
7
|
+
//# sourceMappingURL=NativeMaterialSymbolModule.js.map
|