@onekeyfe/react-native-tab-view 1.1.31
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/android/build.gradle +119 -0
- package/android/gradle.properties +4 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/rcttabview/ImageSource.kt +86 -0
- package/android/src/main/java/com/rcttabview/RCTTabView.kt +529 -0
- package/android/src/main/java/com/rcttabview/RCTTabViewManager.kt +204 -0
- package/android/src/main/java/com/rcttabview/RCTTabViewPackage.kt +16 -0
- package/android/src/main/java/com/rcttabview/TabInfo.kt +12 -0
- package/android/src/main/java/com/rcttabview/Utils.kt +31 -0
- package/android/src/main/java/com/rcttabview/events/OnNativeLayoutEvent.kt +20 -0
- package/android/src/main/java/com/rcttabview/events/OnTabBarMeasuredEvent.kt +19 -0
- package/android/src/main/java/com/rcttabview/events/PageSelectedEvent.kt +21 -0
- package/android/src/main/java/com/rcttabview/events/TabLongPressedEvent.kt +19 -0
- package/common/cpp/react/renderer/components/RNCTabView/RNCTabViewComponentDescriptor.h +32 -0
- package/common/cpp/react/renderer/components/RNCTabView/RNCTabViewShadowNode.cpp +18 -0
- package/common/cpp/react/renderer/components/RNCTabView/RNCTabViewShadowNode.h +35 -0
- package/common/cpp/react/renderer/components/RNCTabView/RNCTabViewState.cpp +15 -0
- package/common/cpp/react/renderer/components/RNCTabView/RNCTabViewState.h +25 -0
- package/ios/Extensions.swift +46 -0
- package/ios/RCTBottomAccessoryComponentView.h +12 -0
- package/ios/RCTBottomAccessoryComponentView.mm +67 -0
- package/ios/RCTBottomAccessoryContainerView.swift +51 -0
- package/ios/RCTTabViewComponentView.h +12 -0
- package/ios/RCTTabViewComponentView.mm +325 -0
- package/ios/RCTTabViewContainerView.swift +768 -0
- package/ios/RCTTabViewLog.h +7 -0
- package/ios/RCTTabViewLog.m +32 -0
- package/ios/SVG/CoreSVG.h +13 -0
- package/ios/SVG/CoreSVG.mm +177 -0
- package/ios/SVG/SvgDecoder.h +10 -0
- package/ios/SVG/SvgDecoder.mm +32 -0
- package/ios/TabBarFontSize.swift +55 -0
- package/lib/module/BottomAccessoryView.js +45 -0
- package/lib/module/BottomAccessoryView.js.map +1 -0
- package/lib/module/BottomAccessoryViewNativeComponent.ts +27 -0
- package/lib/module/DelayedFreeze.js +26 -0
- package/lib/module/DelayedFreeze.js.map +1 -0
- package/lib/module/NativeSVGDecoder.js +5 -0
- package/lib/module/NativeSVGDecoder.js.map +1 -0
- package/lib/module/SceneMap.js +28 -0
- package/lib/module/SceneMap.js.map +1 -0
- package/lib/module/TabView.js +263 -0
- package/lib/module/TabView.js.map +1 -0
- package/lib/module/TabViewNativeComponent.ts +68 -0
- package/lib/module/codegen-types.d.js +2 -0
- package/lib/module/codegen-types.d.js.map +1 -0
- package/lib/module/index.js +20 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/types.js +4 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/utils/BottomTabBarHeightContext.js +5 -0
- package/lib/module/utils/BottomTabBarHeightContext.js.map +1 -0
- package/lib/module/utils/useBottomTabBarHeight.js +12 -0
- package/lib/module/utils/useBottomTabBarHeight.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/BottomAccessoryView.d.ts +8 -0
- package/lib/typescript/src/BottomAccessoryView.d.ts.map +1 -0
- package/lib/typescript/src/BottomAccessoryViewNativeComponent.d.ts +16 -0
- package/lib/typescript/src/BottomAccessoryViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/DelayedFreeze.d.ts +8 -0
- package/lib/typescript/src/DelayedFreeze.d.ts.map +1 -0
- package/lib/typescript/src/NativeSVGDecoder.d.ts +6 -0
- package/lib/typescript/src/NativeSVGDecoder.d.ts.map +1 -0
- package/lib/typescript/src/SceneMap.d.ts +10 -0
- package/lib/typescript/src/SceneMap.d.ts.map +1 -0
- package/lib/typescript/src/TabView.d.ts +178 -0
- package/lib/typescript/src/TabView.d.ts.map +1 -0
- package/lib/typescript/src/TabViewNativeComponent.d.ts +55 -0
- package/lib/typescript/src/TabViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +16 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +29 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/lib/typescript/src/utils/BottomTabBarHeightContext.d.ts +3 -0
- package/lib/typescript/src/utils/BottomTabBarHeightContext.d.ts.map +1 -0
- package/lib/typescript/src/utils/useBottomTabBarHeight.d.ts +2 -0
- package/lib/typescript/src/utils/useBottomTabBarHeight.d.ts.map +1 -0
- package/package.json +114 -0
- package/react-native-tab-view.podspec +36 -0
- package/react-native.config.js +13 -0
- package/src/BottomAccessoryView.tsx +58 -0
- package/src/BottomAccessoryViewNativeComponent.ts +27 -0
- package/src/DelayedFreeze.tsx +27 -0
- package/src/NativeSVGDecoder.ts +5 -0
- package/src/SceneMap.tsx +34 -0
- package/src/TabView.tsx +466 -0
- package/src/TabViewNativeComponent.ts +68 -0
- package/src/codegen-types.d.ts +28 -0
- package/src/index.tsx +18 -0
- package/src/types.ts +31 -0
- package/src/utils/BottomTabBarHeightContext.ts +5 -0
- package/src/utils/useBottomTabBarHeight.ts +15 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#import <Foundation/Foundation.h>
|
|
2
|
+
|
|
3
|
+
/// Bridges to OneKeyLog.debug() without importing the ReactNativeNativeLogger Swift module
|
|
4
|
+
/// (which pulls in NitroModules C++ headers that fail on Xcode 26).
|
|
5
|
+
@interface RCTTabViewLog : NSObject
|
|
6
|
+
+ (void)debug:(NSString * _Nonnull)tag message:(NSString * _Nonnull)message;
|
|
7
|
+
@end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#import "RCTTabViewLog.h"
|
|
2
|
+
|
|
3
|
+
static NSString *const kTag = @"RCTTabView";
|
|
4
|
+
|
|
5
|
+
@implementation RCTTabViewLog
|
|
6
|
+
|
|
7
|
+
+ (void)debug:(NSString *)tag message:(NSString *)message {
|
|
8
|
+
[self _log:@"debug::" tag:tag message:message];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
#pragma mark - Private
|
|
12
|
+
|
|
13
|
+
+ (void)_log:(NSString *)selectorName tag:(NSString *)tag message:(NSString *)message {
|
|
14
|
+
Class logClass = NSClassFromString(@"ReactNativeNativeLogger.OneKeyLog");
|
|
15
|
+
if (!logClass) {
|
|
16
|
+
logClass = NSClassFromString(@"OneKeyLog");
|
|
17
|
+
}
|
|
18
|
+
if (!logClass) {
|
|
19
|
+
NSLog(@"[%@] %@", tag, message);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
SEL sel = NSSelectorFromString(selectorName);
|
|
23
|
+
if (!sel || ![logClass respondsToSelector:sel]) {
|
|
24
|
+
NSLog(@"[%@] %@", tag, message);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
typedef void (*LogFunc)(id, SEL, NSString *, NSString *);
|
|
28
|
+
LogFunc func = (LogFunc)[logClass methodForSelector:sel];
|
|
29
|
+
func(logClass, sel, tag, message);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#import <UIKit/UIKit.h>
|
|
2
|
+
typedef UIImage PlatformImage;
|
|
3
|
+
|
|
4
|
+
@interface CoreSVGWrapper : NSObject
|
|
5
|
+
|
|
6
|
+
+ (instancetype)shared;
|
|
7
|
+
|
|
8
|
+
- (PlatformImage *)imageFromSVGData:(NSData *)data;
|
|
9
|
+
|
|
10
|
+
+ (BOOL)isSVGData:(NSData *)data;
|
|
11
|
+
+ (BOOL)supportsVectorSVGImage;
|
|
12
|
+
|
|
13
|
+
@end
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
#import "CoreSVG.h"
|
|
2
|
+
#import <dlfcn.h>
|
|
3
|
+
#import <objc/runtime.h>
|
|
4
|
+
|
|
5
|
+
#define kSVGTagEnd @"</svg>"
|
|
6
|
+
|
|
7
|
+
typedef struct CF_BRIDGED_TYPE(id) CGSVGDocument *CGSVGDocumentRef;
|
|
8
|
+
|
|
9
|
+
static CGSVGDocumentRef (*CoreSVGDocumentRetain)(CGSVGDocumentRef);
|
|
10
|
+
static void (*CoreSVGDocumentRelease)(CGSVGDocumentRef);
|
|
11
|
+
static CGSVGDocumentRef (*CoreSVGDocumentCreateFromData)(CFDataRef data, CFDictionaryRef options);
|
|
12
|
+
static void (*CoreSVGContextDrawSVGDocument)(CGContextRef context, CGSVGDocumentRef document);
|
|
13
|
+
static CGSize (*CoreSVGDocumentGetCanvasSize)(CGSVGDocumentRef document);
|
|
14
|
+
|
|
15
|
+
#if !TARGET_OS_OSX
|
|
16
|
+
static SEL CoreSVGImageWithDocumentSEL = NULL;
|
|
17
|
+
static SEL CoreSVGDocumentSEL = NULL;
|
|
18
|
+
#endif
|
|
19
|
+
#if TARGET_OS_OSX
|
|
20
|
+
static Class CoreSVGImageRepClass = NULL;
|
|
21
|
+
static Ivar CoreSVGImageRepDocumentIvar = NULL;
|
|
22
|
+
#endif
|
|
23
|
+
|
|
24
|
+
static inline NSString *Base64DecodedString(NSString *base64String) {
|
|
25
|
+
NSData *data = [[NSData alloc] initWithBase64EncodedString:base64String options:NSDataBase64DecodingIgnoreUnknownCharacters];
|
|
26
|
+
if (!data) {
|
|
27
|
+
return nil;
|
|
28
|
+
}
|
|
29
|
+
return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@implementation CoreSVGWrapper
|
|
33
|
+
|
|
34
|
+
+ (instancetype)shared {
|
|
35
|
+
static dispatch_once_t onceToken;
|
|
36
|
+
static CoreSVGWrapper *wrapper;
|
|
37
|
+
dispatch_once(&onceToken, ^{
|
|
38
|
+
wrapper = [[CoreSVGWrapper alloc] init];
|
|
39
|
+
});
|
|
40
|
+
return wrapper;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
+ (void)initialize {
|
|
44
|
+
CoreSVGDocumentRetain = (CGSVGDocumentRef (*)(CGSVGDocumentRef))dlsym(RTLD_DEFAULT, Base64DecodedString(@"Q0dTVkdEb2N1bWVudFJldGFpbg==").UTF8String);
|
|
45
|
+
CoreSVGDocumentRelease = (void (*)(CGSVGDocumentRef))dlsym(RTLD_DEFAULT, Base64DecodedString(@"Q0dTVkdEb2N1bWVudFJlbGVhc2U=").UTF8String);
|
|
46
|
+
CoreSVGDocumentCreateFromData = (CGSVGDocumentRef (*)(CFDataRef data, CFDictionaryRef options))dlsym(RTLD_DEFAULT, Base64DecodedString(@"Q0dTVkdEb2N1bWVudENyZWF0ZUZyb21EYXRh").UTF8String);
|
|
47
|
+
CoreSVGContextDrawSVGDocument = (void (*)(CGContextRef context, CGSVGDocumentRef document))dlsym(RTLD_DEFAULT, Base64DecodedString(@"Q0dDb250ZXh0RHJhd1NWR0RvY3VtZW50").UTF8String);
|
|
48
|
+
CoreSVGDocumentGetCanvasSize = (CGSize (*)(CGSVGDocumentRef document))dlsym(RTLD_DEFAULT, Base64DecodedString(@"Q0dTVkdEb2N1bWVudEdldENhbnZhc1NpemU=").UTF8String);
|
|
49
|
+
|
|
50
|
+
#if !TARGET_OS_OSX
|
|
51
|
+
CoreSVGImageWithDocumentSEL = NSSelectorFromString(Base64DecodedString(@"X2ltYWdlV2l0aENHU1ZHRG9jdW1lbnQ6"));
|
|
52
|
+
CoreSVGDocumentSEL = NSSelectorFromString(Base64DecodedString(@"X0NHU1ZHRG9jdW1lbnQ="));
|
|
53
|
+
#endif
|
|
54
|
+
#if TARGET_OS_OSX
|
|
55
|
+
CoreSVGImageRepClass = NSClassFromString(Base64DecodedString(@"X05TU1ZHSW1hZ2VSZXA="));
|
|
56
|
+
if (CoreSVGImageRepClass) {
|
|
57
|
+
CoreSVGImageRepDocumentIvar = class_getInstanceVariable(CoreSVGImageRepClass, Base64DecodedString(@"X2RvY3VtZW50").UTF8String);
|
|
58
|
+
}
|
|
59
|
+
#endif
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
- (PlatformImage *)imageFromSVGData:(NSData *)data {
|
|
63
|
+
if (!data) {
|
|
64
|
+
return nil;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (![self.class supportsVectorSVGImage]) {
|
|
68
|
+
return nil;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return [self createVectorSVGWithData:data];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
- (PlatformImage *)createVectorSVGWithData:(NSData *)data {
|
|
75
|
+
if (!data) return nil;
|
|
76
|
+
|
|
77
|
+
PlatformImage *image;
|
|
78
|
+
|
|
79
|
+
#if TARGET_OS_OSX
|
|
80
|
+
if (!CoreSVGImageRepClass) {
|
|
81
|
+
return nil;
|
|
82
|
+
}
|
|
83
|
+
Class imageRepClass = CoreSVGImageRepClass;
|
|
84
|
+
NSImageRep *imageRep = [[imageRepClass alloc] initWithData:data];
|
|
85
|
+
if (!imageRep) {
|
|
86
|
+
return nil;
|
|
87
|
+
}
|
|
88
|
+
image = [[NSImage alloc] initWithSize:imageRep.size];
|
|
89
|
+
[image addRepresentation:imageRep];
|
|
90
|
+
#else
|
|
91
|
+
if (!CoreSVGDocumentCreateFromData || !CoreSVGDocumentRelease) {
|
|
92
|
+
return nil;
|
|
93
|
+
}
|
|
94
|
+
CGSVGDocumentRef document = CoreSVGDocumentCreateFromData((__bridge CFDataRef)data, NULL);
|
|
95
|
+
|
|
96
|
+
if (!document) {
|
|
97
|
+
return nil;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
image = ((UIImage *(*)(id,SEL,CGSVGDocumentRef))[UIImage.class methodForSelector:CoreSVGImageWithDocumentSEL])(UIImage.class, CoreSVGImageWithDocumentSEL, document);
|
|
101
|
+
CoreSVGDocumentRelease(document);
|
|
102
|
+
#endif
|
|
103
|
+
|
|
104
|
+
#if TARGET_OS_OSX
|
|
105
|
+
// Test render to catch potential CoreSVG crashes on macOS
|
|
106
|
+
NSBitmapImageRep *bitmap = [[NSBitmapImageRep alloc]
|
|
107
|
+
initWithBitmapDataPlanes:NULL
|
|
108
|
+
pixelsWide:1
|
|
109
|
+
pixelsHigh:1
|
|
110
|
+
bitsPerSample:8
|
|
111
|
+
samplesPerPixel:4
|
|
112
|
+
hasAlpha:YES
|
|
113
|
+
isPlanar:NO
|
|
114
|
+
colorSpaceName:NSCalibratedRGBColorSpace
|
|
115
|
+
bytesPerRow:0
|
|
116
|
+
bitsPerPixel:0];
|
|
117
|
+
|
|
118
|
+
NSGraphicsContext *context = [NSGraphicsContext graphicsContextWithBitmapImageRep:bitmap];
|
|
119
|
+
[NSGraphicsContext saveGraphicsState];
|
|
120
|
+
[NSGraphicsContext setCurrentContext:context];
|
|
121
|
+
|
|
122
|
+
@try {
|
|
123
|
+
[image drawInRect:NSMakeRect(0, 0, 1, 1)];
|
|
124
|
+
} @catch (...) {
|
|
125
|
+
[NSGraphicsContext restoreGraphicsState];
|
|
126
|
+
return nil;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
[NSGraphicsContext restoreGraphicsState];
|
|
130
|
+
#else
|
|
131
|
+
// Test render to catch potential CoreSVG crashes
|
|
132
|
+
UIGraphicsBeginImageContextWithOptions(CGSizeMake(1, 1), NO, 1.0);
|
|
133
|
+
@try {
|
|
134
|
+
[image drawInRect:CGRectMake(0, 0, 1, 1)];
|
|
135
|
+
} @catch (...) {
|
|
136
|
+
UIGraphicsEndImageContext();
|
|
137
|
+
return nil;
|
|
138
|
+
}
|
|
139
|
+
UIGraphicsEndImageContext();
|
|
140
|
+
#endif
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
return image;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
+ (BOOL)isSVGData:(NSData *)data {
|
|
147
|
+
if (!data) {
|
|
148
|
+
return NO;
|
|
149
|
+
}
|
|
150
|
+
// Check end with SVG tag
|
|
151
|
+
return [data rangeOfData:[kSVGTagEnd dataUsingEncoding:NSUTF8StringEncoding] options:NSDataSearchBackwards range: NSMakeRange(data.length - MIN(100, data.length), MIN(100, data.length))].location != NSNotFound;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
+ (BOOL)supportsVectorSVGImage {
|
|
155
|
+
static dispatch_once_t onceToken;
|
|
156
|
+
static BOOL supports;
|
|
157
|
+
dispatch_once(&onceToken, ^{
|
|
158
|
+
#if TARGET_OS_OSX
|
|
159
|
+
// macOS 10.15+ supports SVG built-in rendering, use selector to check is more accurate
|
|
160
|
+
if (CoreSVGImageRepClass) {
|
|
161
|
+
supports = YES;
|
|
162
|
+
} else {
|
|
163
|
+
supports = NO;
|
|
164
|
+
}
|
|
165
|
+
#else
|
|
166
|
+
// iOS 13+ supports SVG built-in rendering, use selector to check is more accurate
|
|
167
|
+
if ([UIImage respondsToSelector:CoreSVGImageWithDocumentSEL]) {
|
|
168
|
+
supports = YES;
|
|
169
|
+
} else {
|
|
170
|
+
supports = NO;
|
|
171
|
+
}
|
|
172
|
+
#endif
|
|
173
|
+
});
|
|
174
|
+
return supports;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
@end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#import "SvgDecoder.h"
|
|
2
|
+
#import "CoreSVG.h"
|
|
3
|
+
|
|
4
|
+
@implementation SvgDecoder
|
|
5
|
+
|
|
6
|
+
RCT_EXPORT_MODULE()
|
|
7
|
+
|
|
8
|
+
- (BOOL)canDecodeImageData:(NSData *)imageData
|
|
9
|
+
{
|
|
10
|
+
return [CoreSVGWrapper isSVGData:imageData];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
- (RCTImageLoaderCancellationBlock)decodeImageData:(NSData *)imageData
|
|
14
|
+
size:(CGSize)size
|
|
15
|
+
scale:(CGFloat)scale
|
|
16
|
+
resizeMode:(RCTResizeMode)resizeMode
|
|
17
|
+
completionHandler:(RCTImageLoaderCompletionBlock)completionHandler
|
|
18
|
+
{
|
|
19
|
+
UIImage *image = [CoreSVGWrapper.shared imageFromSVGData:imageData];
|
|
20
|
+
|
|
21
|
+
if (image) {
|
|
22
|
+
completionHandler(nil, image);
|
|
23
|
+
} else {
|
|
24
|
+
NSError *error = [NSError errorWithDomain:@"SVGDecoderErrorDomain"
|
|
25
|
+
code:2
|
|
26
|
+
userInfo:@{NSLocalizedDescriptionKey: @"Failed to render SVG to image"}];
|
|
27
|
+
completionHandler(error, nil);
|
|
28
|
+
}
|
|
29
|
+
return ^{};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React
|
|
2
|
+
import UIKit
|
|
3
|
+
|
|
4
|
+
enum TabBarFontSize {
|
|
5
|
+
static let defaultSize: CGFloat = {
|
|
6
|
+
if UIDevice.current.userInterfaceIdiom == .pad {
|
|
7
|
+
return 13.0
|
|
8
|
+
}
|
|
9
|
+
return 10.0
|
|
10
|
+
}()
|
|
11
|
+
|
|
12
|
+
static func createFontAttributes(
|
|
13
|
+
size: CGFloat,
|
|
14
|
+
family: String? = nil,
|
|
15
|
+
weight: String? = nil,
|
|
16
|
+
color: UIColor? = nil
|
|
17
|
+
) -> [NSAttributedString.Key: Any] {
|
|
18
|
+
var attributes: [NSAttributedString.Key: Any] = [:]
|
|
19
|
+
|
|
20
|
+
if family != nil || weight != nil {
|
|
21
|
+
attributes[.font] = RCTFont.update(
|
|
22
|
+
nil,
|
|
23
|
+
withFamily: family,
|
|
24
|
+
size: NSNumber(value: size),
|
|
25
|
+
weight: weight,
|
|
26
|
+
style: nil,
|
|
27
|
+
variant: nil,
|
|
28
|
+
scaleMultiplier: 1.0
|
|
29
|
+
)
|
|
30
|
+
} else {
|
|
31
|
+
attributes[.font] = UIFont.boldSystemFont(ofSize: size)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if let color {
|
|
35
|
+
attributes[.foregroundColor] = color
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return attributes
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
static func createNormalStateAttributes(
|
|
42
|
+
fontSize: Int? = nil,
|
|
43
|
+
fontFamily: String? = nil,
|
|
44
|
+
fontWeight: String? = nil,
|
|
45
|
+
inactiveColor: UIColor? = nil
|
|
46
|
+
) -> [NSAttributedString.Key: Any] {
|
|
47
|
+
let size = fontSize.map(CGFloat.init) ?? defaultSize
|
|
48
|
+
return createFontAttributes(
|
|
49
|
+
size: size,
|
|
50
|
+
family: fontFamily,
|
|
51
|
+
weight: fontWeight,
|
|
52
|
+
color: inactiveColor
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import BottomAccessoryViewNativeComponent from './BottomAccessoryViewNativeComponent';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
const defaultStyle = {
|
|
7
|
+
position: 'absolute',
|
|
8
|
+
top: 0,
|
|
9
|
+
left: 0
|
|
10
|
+
};
|
|
11
|
+
export const BottomAccessoryView = props => {
|
|
12
|
+
const {
|
|
13
|
+
renderBottomAccessoryView
|
|
14
|
+
} = props;
|
|
15
|
+
const [bottomAccessoryDimensions, setBottomAccessoryDimensions] = React.useState({
|
|
16
|
+
width: '100%',
|
|
17
|
+
height: '100%'
|
|
18
|
+
});
|
|
19
|
+
const [placement, setPlacement] = React.useState('none');
|
|
20
|
+
const handleNativeLayout = React.useCallback(event => {
|
|
21
|
+
const {
|
|
22
|
+
width,
|
|
23
|
+
height
|
|
24
|
+
} = event.nativeEvent;
|
|
25
|
+
setBottomAccessoryDimensions({
|
|
26
|
+
width,
|
|
27
|
+
height
|
|
28
|
+
});
|
|
29
|
+
}, [setBottomAccessoryDimensions]);
|
|
30
|
+
const handlePlacementChanged = React.useCallback(event => {
|
|
31
|
+
const newPlacement = event.nativeEvent.placement;
|
|
32
|
+
if (newPlacement === 'inline' || newPlacement === 'expanded' || newPlacement === 'none') {
|
|
33
|
+
setPlacement(newPlacement);
|
|
34
|
+
}
|
|
35
|
+
}, [setPlacement]);
|
|
36
|
+
return /*#__PURE__*/_jsx(BottomAccessoryViewNativeComponent, {
|
|
37
|
+
style: [defaultStyle, bottomAccessoryDimensions],
|
|
38
|
+
onNativeLayout: handleNativeLayout,
|
|
39
|
+
onPlacementChanged: handlePlacementChanged,
|
|
40
|
+
children: renderBottomAccessoryView({
|
|
41
|
+
placement
|
|
42
|
+
})
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=BottomAccessoryView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","BottomAccessoryViewNativeComponent","jsx","_jsx","defaultStyle","position","top","left","BottomAccessoryView","props","renderBottomAccessoryView","bottomAccessoryDimensions","setBottomAccessoryDimensions","useState","width","height","placement","setPlacement","handleNativeLayout","useCallback","event","nativeEvent","handlePlacementChanged","newPlacement","style","onNativeLayout","onPlacementChanged","children"],"sourceRoot":"../../src","sources":["BottomAccessoryView.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,OAAOC,kCAAkC,MAAM,sCAAsC;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEtF,MAAMC,YAAuB,GAAG;EAC9BC,QAAQ,EAAE,UAAU;EACpBC,GAAG,EAAE,CAAC;EACNC,IAAI,EAAE;AACR,CAAC;AAQD,OAAO,MAAMC,mBAAmB,GAAIC,KAA+B,IAAK;EACtE,MAAM;IAAEC;EAA0B,CAAC,GAAGD,KAAK;EAC3C,MAAM,CAACE,yBAAyB,EAAEC,4BAA4B,CAAC,GAC7DZ,KAAK,CAACa,QAAQ,CAEZ;IAAEC,KAAK,EAAE,MAAM;IAAEC,MAAM,EAAE;EAAO,CAAC,CAAC;EACtC,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGjB,KAAK,CAACa,QAAQ,CAE9C,MAAM,CAAC;EAET,MAAMK,kBAAkB,GAAGlB,KAAK,CAACmB,WAAW,CACzCC,KAA8D,IAAK;IAClE,MAAM;MAAEN,KAAK;MAAEC;IAAO,CAAC,GAAGK,KAAK,CAACC,WAAW;IAC3CT,4BAA4B,CAAC;MAAEE,KAAK;MAAEC;IAAO,CAAC,CAAC;EACjD,CAAC,EACD,CAACH,4BAA4B,CAC/B,CAAC;EAED,MAAMU,sBAAsB,GAAGtB,KAAK,CAACmB,WAAW,CAC7CC,KAAkD,IAAK;IACtD,MAAMG,YAAY,GAAGH,KAAK,CAACC,WAAW,CAACL,SAAS;IAChD,IACEO,YAAY,KAAK,QAAQ,IACzBA,YAAY,KAAK,UAAU,IAC3BA,YAAY,KAAK,MAAM,EACvB;MACAN,YAAY,CAACM,YAAY,CAAC;IAC5B;EACF,CAAC,EACD,CAACN,YAAY,CACf,CAAC;EAED,oBACEd,IAAA,CAACF,kCAAkC;IACjCuB,KAAK,EAAE,CAACpB,YAAY,EAAEO,yBAAyB,CAAE;IACjDc,cAAc,EAAEP,kBAAmB;IACnCQ,kBAAkB,EAAEJ,sBAAuB;IAAAK,QAAA,EAE1CjB,yBAAyB,CAAC;MAAEM;IAAU,CAAC;EAAC,CACP,CAAC;AAEzC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { codegenNativeComponent } from 'react-native';
|
|
2
|
+
import type { ViewProps } from 'react-native';
|
|
3
|
+
import type {
|
|
4
|
+
DirectEventHandler,
|
|
5
|
+
Double,
|
|
6
|
+
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
7
|
+
|
|
8
|
+
export type OnNativeLayout = Readonly<{
|
|
9
|
+
width: Double;
|
|
10
|
+
height: Double;
|
|
11
|
+
}>;
|
|
12
|
+
|
|
13
|
+
export type OnPlacementChanged = Readonly<{
|
|
14
|
+
placement: string;
|
|
15
|
+
}>;
|
|
16
|
+
|
|
17
|
+
export interface BottomAccessoryViewNativeProps extends ViewProps {
|
|
18
|
+
onNativeLayout?: DirectEventHandler<OnNativeLayout>;
|
|
19
|
+
onPlacementChanged?: DirectEventHandler<OnPlacementChanged>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default codegenNativeComponent<BottomAccessoryViewNativeProps>(
|
|
23
|
+
'BottomAccessoryView',
|
|
24
|
+
{
|
|
25
|
+
excludedPlatforms: ['android'],
|
|
26
|
+
}
|
|
27
|
+
);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Freeze } from 'react-freeze';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
const ANIMATION_DELAY = 200;
|
|
7
|
+
function DelayedFreeze({
|
|
8
|
+
freeze,
|
|
9
|
+
children
|
|
10
|
+
}) {
|
|
11
|
+
const [freezeState, setFreezeState] = React.useState(false);
|
|
12
|
+
React.useEffect(() => {
|
|
13
|
+
const id = setTimeout(() => {
|
|
14
|
+
setFreezeState(freeze);
|
|
15
|
+
}, ANIMATION_DELAY);
|
|
16
|
+
return () => {
|
|
17
|
+
clearTimeout(id);
|
|
18
|
+
};
|
|
19
|
+
}, [freeze]);
|
|
20
|
+
return /*#__PURE__*/_jsx(Freeze, {
|
|
21
|
+
freeze: freeze ? freezeState : false,
|
|
22
|
+
children: children
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export default DelayedFreeze;
|
|
26
|
+
//# sourceMappingURL=DelayedFreeze.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Freeze","jsx","_jsx","ANIMATION_DELAY","DelayedFreeze","freeze","children","freezeState","setFreezeState","useState","useEffect","id","setTimeout","clearTimeout"],"sourceRoot":"../../src","sources":["DelayedFreeze.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,MAAM,QAAQ,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAOtC,MAAMC,eAAe,GAAG,GAAG;AAE3B,SAASC,aAAaA,CAAC;EAAEC,MAAM;EAAEC;AAA6B,CAAC,EAAE;EAC/D,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGT,KAAK,CAACU,QAAQ,CAAC,KAAK,CAAC;EAE3DV,KAAK,CAACW,SAAS,CAAC,MAAM;IACpB,MAAMC,EAAE,GAAGC,UAAU,CAAC,MAAM;MAC1BJ,cAAc,CAACH,MAAM,CAAC;IACxB,CAAC,EAAEF,eAAe,CAAC;IAEnB,OAAO,MAAM;MACXU,YAAY,CAACF,EAAE,CAAC;IAClB,CAAC;EACH,CAAC,EAAE,CAACN,MAAM,CAAC,CAAC;EAEZ,oBAAOH,IAAA,CAACF,MAAM;IAACK,MAAM,EAAEA,MAAM,GAAGE,WAAW,GAAG,KAAM;IAAAD,QAAA,EAAEA;EAAQ,CAAS,CAAC;AAC1E;AAEA,eAAeF,aAAa","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeSVGDecoder.ts"],"mappings":";;AAAA,SAASA,mBAAmB,QAA0B,cAAc;AAIpE,eAAeA,mBAAmB,CAACC,YAAY,CAAO,YAAY,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
const SceneComponent = /*#__PURE__*/React.memo(({
|
|
6
|
+
component,
|
|
7
|
+
...rest
|
|
8
|
+
}) => {
|
|
9
|
+
return /*#__PURE__*/React.createElement(component, rest);
|
|
10
|
+
});
|
|
11
|
+
SceneComponent.displayName = 'SceneComponent';
|
|
12
|
+
export function SceneMap(scenes) {
|
|
13
|
+
return ({
|
|
14
|
+
route,
|
|
15
|
+
jumpTo
|
|
16
|
+
}) => {
|
|
17
|
+
const component = scenes[route.key];
|
|
18
|
+
if (!component) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
return /*#__PURE__*/_jsx(SceneComponent, {
|
|
22
|
+
jumpTo: jumpTo,
|
|
23
|
+
component: component,
|
|
24
|
+
route: route
|
|
25
|
+
}, route.key);
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=SceneMap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","jsx","_jsx","SceneComponent","memo","component","rest","createElement","displayName","SceneMap","scenes","route","jumpTo","key"],"sourceRoot":"../../src","sources":["SceneMap.tsx"],"mappings":";;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAO/B,MAAMC,cAAc,gBAAGH,KAAK,CAACI,IAAI,CAC/B,CAAiE;EAC/DC,SAAS;EACT,GAAGC;AACF,CAAC,KAAK;EACP,oBAAON,KAAK,CAACO,aAAa,CAACF,SAAS,EAAEC,IAAI,CAAC;AAC7C,CACF,CAAC;AAEDH,cAAc,CAACK,WAAW,GAAG,gBAAgB;AAE7C,OAAO,SAASC,QAAQA,CAAIC,MAAiD,EAAE;EAC7E,OAAO,CAAC;IAAEC,KAAK;IAAEC;EAAmB,CAAC,KAAK;IACxC,MAAMP,SAAS,GAAGK,MAAM,CAACC,KAAK,CAACE,GAAG,CAAC;IACnC,IAAI,CAACR,SAAS,EAAE;MACd,OAAO,IAAI;IACb;IACA,oBACEH,IAAA,CAACC,cAAc;MAEbS,MAAM,EAAEA,MAAO;MACfP,SAAS,EAAEA,SAAU;MACrBM,KAAK,EAAEA;IAAM,GAHRA,KAAK,CAACE,GAIZ,CAAC;EAEN,CAAC;AACH","ignoreList":[]}
|