@pinwheel/react-native-pinwheel 3.2.2 → 3.2.3
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.
|
@@ -59,7 +59,7 @@ class Pinwheel : FrameLayout {
|
|
|
59
59
|
private fun createFragment() {
|
|
60
60
|
Handler(Looper.getMainLooper()).post {
|
|
61
61
|
this.token?.let {
|
|
62
|
-
val pinwheelFragment = PinwheelFragment.newInstance(it, "react native", "3.2.
|
|
62
|
+
val pinwheelFragment = PinwheelFragment.newInstance(it, "react native", "3.2.3", getReactNativeVersion(), this.handleInsets)
|
|
63
63
|
pinwheelEventListener?.let { listener ->
|
|
64
64
|
pinwheelFragment.pinwheelEventListener = listener
|
|
65
65
|
}
|
package/ios/RTNPinwheelView.h
CHANGED
|
@@ -21,8 +21,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
21
21
|
#endif
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
@property (nonatomic, strong) PinwheelWrapperVC *pinwheelWrapperVC;
|
|
25
|
-
@property (nonatomic,
|
|
24
|
+
@property (nonatomic, strong, nullable) PinwheelWrapperVC *pinwheelWrapperVC;
|
|
25
|
+
@property (nonatomic, strong) NSString *token;
|
|
26
26
|
|
|
27
27
|
- (instancetype)initWithFrame:(CGRect)frame token:(NSString *)token;
|
|
28
28
|
|
package/ios/RTNPinwheelView.mm
CHANGED
|
@@ -37,8 +37,13 @@ using namespace facebook::react;
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
- (void)initPinwheelWrapperVC {
|
|
40
|
-
if (self.
|
|
41
|
-
self.pinwheelWrapperVC
|
|
40
|
+
if (self.pinwheelWrapperVC != nil) {
|
|
41
|
+
[self.pinwheelWrapperVC.view removeFromSuperview];
|
|
42
|
+
self.pinwheelWrapperVC = nil;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (self.token != nil) {
|
|
46
|
+
self.pinwheelWrapperVC = [[PinwheelWrapperVC alloc] initWithToken:self.token delegate:self sdk:@"react native" version: @"3.2.3"];
|
|
42
47
|
[self addSubview:self.pinwheelWrapperVC.view];
|
|
43
48
|
}
|
|
44
49
|
}
|
|
@@ -46,7 +51,6 @@ using namespace facebook::react;
|
|
|
46
51
|
- (void)setToken:(NSString *)newToken {
|
|
47
52
|
if (![_token isEqualToString:newToken]) {
|
|
48
53
|
_token = newToken;
|
|
49
|
-
[self initPinwheelWrapperVC];
|
|
50
54
|
}
|
|
51
55
|
}
|
|
52
56
|
|
|
@@ -59,14 +63,20 @@ using namespace facebook::react;
|
|
|
59
63
|
NSString* convertedToken = [NSString stringWithUTF8String:newViewProps.token.c_str()];
|
|
60
64
|
[self setToken:convertedToken];
|
|
61
65
|
}
|
|
66
|
+
// Ensures that the view is always re-initialized whenever the props change, or the React Native component is
|
|
67
|
+
// re-mounted. On the new architecture, there are optimizations which causes the view to be re-used in these
|
|
68
|
+
// scenarios, whereas the ideal functionality here is to have the Link modal reset to the starting state.
|
|
69
|
+
[self initPinwheelWrapperVC];
|
|
62
70
|
|
|
63
71
|
[super updateProps:props oldProps:oldProps];
|
|
64
72
|
}
|
|
65
73
|
|
|
66
74
|
- (void)layoutSubviews
|
|
67
75
|
{
|
|
68
|
-
|
|
69
|
-
|
|
76
|
+
[super layoutSubviews];
|
|
77
|
+
if (self.pinwheelWrapperVC != nil) {
|
|
78
|
+
self.pinwheelWrapperVC.view.frame = self.bounds;
|
|
79
|
+
}
|
|
70
80
|
}
|
|
71
81
|
|
|
72
82
|
- (void)onEventWithName:(NSString *)name event:(NSDictionary<NSString *, id> *)event {
|
|
@@ -125,7 +135,7 @@ Class<RCTComponentViewProtocol> RTNPinwheelCls(void)
|
|
|
125
135
|
|
|
126
136
|
- (void)initPinwheelWrapperVC {
|
|
127
137
|
if (self.token != nil && self.pinwheelWrapperVC == nil) {
|
|
128
|
-
self.pinwheelWrapperVC = [[PinwheelWrapperVC alloc] initWithToken:self.token delegate:self sdk:@"react native" version: @"3.2.
|
|
138
|
+
self.pinwheelWrapperVC = [[PinwheelWrapperVC alloc] initWithToken:self.token delegate:self sdk:@"react native" version: @"3.2.3"];
|
|
129
139
|
[self addSubview:self.pinwheelWrapperVC.view];
|
|
130
140
|
}
|
|
131
141
|
}
|