@pinwheel/react-native-pinwheel 3.2.3 → 3.2.4-rc.0
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.
|
@@ -41,6 +41,24 @@ class Pinwheel : FrameLayout {
|
|
|
41
41
|
private fun init() {
|
|
42
42
|
// Match background color of Link. We may want to have a loader here in the future.
|
|
43
43
|
setBackgroundColor(Color.WHITE)
|
|
44
|
+
if (isAttachedToWindow) {
|
|
45
|
+
createFragment()
|
|
46
|
+
} else {
|
|
47
|
+
addOnAttachStateChangeListener(object : OnAttachStateChangeListener {
|
|
48
|
+
override fun onViewAttachedToWindow(v: View) {
|
|
49
|
+
createFragment()
|
|
50
|
+
removeOnAttachStateChangeListener(this)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
override fun onViewDetachedFromWindow(v: View) {}
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
// Check again after adding the listener in case the the view attached before the listener
|
|
57
|
+
// was added.
|
|
58
|
+
if (isAttachedToWindow) {
|
|
59
|
+
createFragment()
|
|
60
|
+
}
|
|
61
|
+
}
|
|
44
62
|
}
|
|
45
63
|
|
|
46
64
|
fun setToken(token: String?) {
|
|
@@ -58,20 +76,22 @@ class Pinwheel : FrameLayout {
|
|
|
58
76
|
|
|
59
77
|
private fun createFragment() {
|
|
60
78
|
Handler(Looper.getMainLooper()).post {
|
|
61
|
-
this.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
79
|
+
if (this.pinwheelFragment == null) {
|
|
80
|
+
this.token?.let {
|
|
81
|
+
val pinwheelFragment = PinwheelFragment.newInstance(it, "react native", "3.2.4", getReactNativeVersion(), this.handleInsets)
|
|
82
|
+
pinwheelEventListener?.let { listener ->
|
|
83
|
+
pinwheelFragment.pinwheelEventListener = listener
|
|
84
|
+
}
|
|
85
|
+
val reactContext = context as ThemedReactContext
|
|
86
|
+
val activity = reactContext.currentActivity as? FragmentActivity
|
|
87
|
+
|
|
88
|
+
activity?.supportFragmentManager
|
|
89
|
+
?.beginTransaction()
|
|
90
|
+
?.replace(id, pinwheelFragment, id.toString())
|
|
91
|
+
?.commit()
|
|
92
|
+
|
|
93
|
+
this.pinwheelFragment = pinwheelFragment
|
|
65
94
|
}
|
|
66
|
-
val reactContext = context as ThemedReactContext
|
|
67
|
-
val activity = reactContext.currentActivity as? FragmentActivity
|
|
68
|
-
|
|
69
|
-
activity?.supportFragmentManager
|
|
70
|
-
?.beginTransaction()
|
|
71
|
-
?.replace(id, pinwheelFragment, id.toString())
|
|
72
|
-
?.commit()
|
|
73
|
-
|
|
74
|
-
this.pinwheelFragment = pinwheelFragment
|
|
75
95
|
}
|
|
76
96
|
}
|
|
77
97
|
|
|
@@ -99,14 +119,6 @@ class Pinwheel : FrameLayout {
|
|
|
99
119
|
this.layout(left, top, left + width, top + height)
|
|
100
120
|
}
|
|
101
121
|
|
|
102
|
-
override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) {
|
|
103
|
-
super.onLayout(changed, left, top, right, bottom)
|
|
104
|
-
|
|
105
|
-
if (changed && this.pinwheelFragment == null) {
|
|
106
|
-
createFragment()
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
122
|
fun setPinwheelEventListener(listener: PinwheelEventListener) {
|
|
111
123
|
pinwheelEventListener = listener
|
|
112
124
|
pinwheelFragment?.let {
|
package/ios/RTNPinwheelView.mm
CHANGED
|
@@ -43,7 +43,7 @@ using namespace facebook::react;
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
if (self.token != nil) {
|
|
46
|
-
self.pinwheelWrapperVC = [[PinwheelWrapperVC alloc] initWithToken:self.token delegate:self sdk:@"react native" version: @"3.2.
|
|
46
|
+
self.pinwheelWrapperVC = [[PinwheelWrapperVC alloc] initWithToken:self.token delegate:self sdk:@"react native" version: @"3.2.4"];
|
|
47
47
|
[self addSubview:self.pinwheelWrapperVC.view];
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -135,7 +135,7 @@ Class<RCTComponentViewProtocol> RTNPinwheelCls(void)
|
|
|
135
135
|
|
|
136
136
|
- (void)initPinwheelWrapperVC {
|
|
137
137
|
if (self.token != nil && self.pinwheelWrapperVC == nil) {
|
|
138
|
-
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.4"];
|
|
139
139
|
[self addSubview:self.pinwheelWrapperVC.view];
|
|
140
140
|
}
|
|
141
141
|
}
|