react-native-navigation 8.8.3-snapshot.2516 → 8.8.3-snapshot.2534
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/ios/RNNReactButtonView.mm +59 -2
- package/package.json +1 -1
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
#import "RNNReactButtonView.h"
|
|
2
|
+
#import <React/RCTSurface.h>
|
|
2
3
|
|
|
3
|
-
@implementation RNNReactButtonView
|
|
4
|
+
@implementation RNNReactButtonView {
|
|
5
|
+
NSLayoutConstraint *_widthConstraint;
|
|
6
|
+
NSLayoutConstraint *_heightConstraint;
|
|
7
|
+
BOOL _didCenter;
|
|
8
|
+
}
|
|
4
9
|
|
|
5
10
|
- (instancetype)initWithHost:(RCTHost *)host
|
|
6
11
|
moduleName:(NSString *)moduleName
|
|
@@ -10,15 +15,67 @@
|
|
|
10
15
|
reactViewReadyBlock:(RNNReactViewReadyCompletionBlock)reactViewReadyBlock {
|
|
11
16
|
self = [super initWithHost:host moduleName:moduleName initialProperties:initialProperties eventEmitter:eventEmitter sizeMeasureMode:convertToSurfaceSizeMeasureMode(RCTRootViewSizeFlexibilityWidthAndHeight) reactViewReadyBlock:reactViewReadyBlock];
|
|
12
17
|
[host.surfacePresenter addObserver:self];
|
|
13
|
-
self.backgroundColor = UIColor
|
|
18
|
+
self.backgroundColor = [UIColor clearColor];
|
|
19
|
+
|
|
20
|
+
if (@available(iOS 26.0, *)) {
|
|
21
|
+
if (![self designRequiresCompatibility]) {
|
|
22
|
+
self.translatesAutoresizingMaskIntoConstraints = NO;
|
|
23
|
+
_widthConstraint = [self.widthAnchor constraintEqualToConstant:0];
|
|
24
|
+
_heightConstraint = [self.heightAnchor constraintEqualToConstant:0];
|
|
25
|
+
_widthConstraint.priority = UILayoutPriorityDefaultHigh;
|
|
26
|
+
_heightConstraint.priority = UILayoutPriorityDefaultHigh;
|
|
27
|
+
_widthConstraint.active = YES;
|
|
28
|
+
_heightConstraint.active = YES;
|
|
29
|
+
_didCenter = NO;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
14
32
|
|
|
15
33
|
return self;
|
|
16
34
|
}
|
|
17
35
|
|
|
36
|
+
- (BOOL)designRequiresCompatibility {
|
|
37
|
+
static BOOL checked = NO;
|
|
38
|
+
static BOOL result = NO;
|
|
39
|
+
if (!checked) {
|
|
40
|
+
checked = YES;
|
|
41
|
+
result = [[[NSBundle mainBundle] objectForInfoDictionaryKey:@"UIDesignRequiresCompatibility"] boolValue];
|
|
42
|
+
}
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
|
|
18
46
|
- (void)didMountComponentsWithRootTag:(NSInteger)rootTag {
|
|
19
47
|
if (self.surface.rootTag == rootTag) {
|
|
20
48
|
[super didMountComponentsWithRootTag:rootTag];
|
|
21
49
|
[self sizeToFit];
|
|
50
|
+
if (@available(iOS 26.0, *)) {
|
|
51
|
+
if (![self designRequiresCompatibility]) {
|
|
52
|
+
[self updateConstraintsToFitSize];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
- (void)updateConstraintsToFitSize {
|
|
59
|
+
CGSize size = self.frame.size;
|
|
60
|
+
if (size.width > 0 && size.height > 0) {
|
|
61
|
+
_widthConstraint.constant = size.width;
|
|
62
|
+
_heightConstraint.constant = size.height;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
- (void)layoutSubviews {
|
|
67
|
+
[super layoutSubviews];
|
|
68
|
+
if (@available(iOS 26.0, *)) {
|
|
69
|
+
if ([self designRequiresCompatibility]) return;
|
|
70
|
+
if (!_didCenter && self.superview && self.frame.size.width > 0) {
|
|
71
|
+
CGFloat wrapperWidth = self.superview.bounds.size.width;
|
|
72
|
+
CGFloat selfWidth = self.frame.size.width;
|
|
73
|
+
if (wrapperWidth > selfWidth) {
|
|
74
|
+
_didCenter = YES;
|
|
75
|
+
CGFloat tx = (wrapperWidth - selfWidth) / 2.0;
|
|
76
|
+
self.layer.affineTransform = CGAffineTransformMakeTranslation(tx, 0);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
22
79
|
}
|
|
23
80
|
}
|
|
24
81
|
|
package/package.json
CHANGED