Skip to content

Commit

Permalink
fix(android): cast crash
Browse files Browse the repository at this point in the history
  • Loading branch information
gtokman committed Sep 23, 2023
1 parent 7b1ed16 commit cd8998c
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@ class BlurViewViewManager : SimpleViewManager<BlurView>() {
val blurView = BlurView(reactContext.baseContext).also {
it.layoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
val decorView = reactContext.currentActivity
val rootView = decorView?.findViewById(android.R.id.content) as ViewGroup
val rootView = decorView?.findViewById<ViewGroup>(android.R.id.content)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
it.setupWith(rootView, RenderEffectBlur())
.setFrameClearDrawable(it.background)
if (rootView != null) {
it.setupWith(rootView, RenderEffectBlur())
.setFrameClearDrawable(it.background)
}
} else {
it.setupWith(rootView, RenderScriptBlur(reactContext.baseContext))
.setFrameClearDrawable(it.background)
if (rootView != null) {
it.setupWith(rootView, RenderScriptBlur(reactContext.baseContext))
.setFrameClearDrawable(it.background)
}
}
}
return blurView
Expand Down

0 comments on commit cd8998c

Please sign in to comment.