@pinwheel/react-native-pinwheel 3.2.4-rc.0 → 3.2.4
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
CHANGED
|
@@ -10,7 +10,6 @@ import android.view.Choreographer
|
|
|
10
10
|
import android.view.View
|
|
11
11
|
import android.widget.FrameLayout
|
|
12
12
|
import androidx.fragment.app.FragmentActivity
|
|
13
|
-
import com.facebook.react.bridge.ReactApplicationContext
|
|
14
13
|
import com.underdog_tech.pinwheel_android.PinwheelEventListener
|
|
15
14
|
import com.underdog_tech.pinwheel_android.PinwheelFragment
|
|
16
15
|
import com.facebook.react.uimanager.ThemedReactContext
|
|
@@ -21,6 +20,7 @@ class Pinwheel : FrameLayout {
|
|
|
21
20
|
private var pinwheelFragment: PinwheelFragment? = null
|
|
22
21
|
private var pinwheelEventListener: PinwheelEventListener? = null
|
|
23
22
|
private var handleInsets: Boolean = true
|
|
23
|
+
private var fragmentContainer: FrameLayout? = null
|
|
24
24
|
|
|
25
25
|
constructor(context: Context) : super(context) {
|
|
26
26
|
init()
|
|
@@ -41,6 +41,12 @@ 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
|
+
|
|
45
|
+
// Create a FrameLayout to act as the fragment container
|
|
46
|
+
fragmentContainer = FrameLayout(context)
|
|
47
|
+
fragmentContainer!!.id = View.generateViewId()
|
|
48
|
+
addView(fragmentContainer, LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT))
|
|
49
|
+
|
|
44
50
|
if (isAttachedToWindow) {
|
|
45
51
|
createFragment()
|
|
46
52
|
} else {
|
|
@@ -85,10 +91,11 @@ class Pinwheel : FrameLayout {
|
|
|
85
91
|
val reactContext = context as ThemedReactContext
|
|
86
92
|
val activity = reactContext.currentActivity as? FragmentActivity
|
|
87
93
|
|
|
88
|
-
activity?.supportFragmentManager
|
|
89
|
-
|
|
90
|
-
?.
|
|
91
|
-
|
|
94
|
+
val transaction = activity?.supportFragmentManager?.beginTransaction()
|
|
95
|
+
transaction?.runOnCommit {
|
|
96
|
+
fragmentContainer?.addView(pinwheelFragment.view)
|
|
97
|
+
}
|
|
98
|
+
transaction?.add(pinwheelFragment, pinwheelFragment.id.toString())?.commit()
|
|
92
99
|
|
|
93
100
|
this.pinwheelFragment = pinwheelFragment
|
|
94
101
|
}
|