@ionic/portals-react-native 0.0.5 → 0.0.6

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.
@@ -241,23 +241,22 @@ internal class PortalViewManager(private val context: ReactApplicationContext) :
241
241
  fragmentMap.remove(view.id)
242
242
  }
243
243
 
244
- private fun setupLayout(view: ViewGroup) {
245
- Choreographer.getInstance().postFrameCallback {
246
- layoutChildren(view)
247
- view.viewTreeObserver.dispatchOnGlobalLayout()
248
- }
244
+ private fun setupLayout(view: View) {
245
+ Choreographer.getInstance().postFrameCallback(object : Choreographer.FrameCallback {
246
+ override fun doFrame(frameTimeNanos: Long) {
247
+ layoutPortal(view)
248
+ view.viewTreeObserver.dispatchOnGlobalLayout()
249
+ Choreographer.getInstance().postFrameCallback(this)
250
+ }
251
+ })
249
252
  }
250
253
 
251
- private fun layoutChildren(view: ViewGroup) {
252
- for (i in 0 until view.childCount) {
253
- val child = view.getChildAt(i)
254
+ private fun layoutPortal(view: View) {
255
+ view.measure(
256
+ View.MeasureSpec.makeMeasureSpec(view.measuredWidth, View.MeasureSpec.EXACTLY),
257
+ View.MeasureSpec.makeMeasureSpec(view.measuredHeight, View.MeasureSpec.EXACTLY)
258
+ )
254
259
 
255
- child.measure(
256
- View.MeasureSpec.makeMeasureSpec(view.measuredWidth, View.MeasureSpec.EXACTLY),
257
- View.MeasureSpec.makeMeasureSpec(view.measuredHeight, View.MeasureSpec.EXACTLY)
258
- )
259
-
260
- child.layout(0, 0, child.measuredWidth, child.measuredHeight)
261
- }
260
+ view.layout(0, 0, view.measuredWidth, view.measuredHeight)
262
261
  }
263
262
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ionic/portals-react-native",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "Ionic Portals for React Native",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",