Skip to content

Commit

Permalink
fix(android): crash
Browse files Browse the repository at this point in the history
  • Loading branch information
gtokman committed Sep 23, 2023
1 parent fe9c7dc commit 4072a5a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.candlefinance.blurview

import android.os.Build
import android.view.View
import android.view.ViewGroup
import com.facebook.react.uimanager.SimpleViewManager
import com.facebook.react.uimanager.ThemedReactContext
Expand All @@ -20,7 +19,7 @@ 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<ViewGroup>(android.R.id.content)
val rootView = decorView?.findViewById<BlurView>(R.id.blurView)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
if (rootView != null) {
it.setupWith(rootView, RenderEffectBlur())
Expand Down
12 changes: 12 additions & 0 deletions android/src/main/res/layout/layout.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<eightbitlab.com.blurview.BlurView
android:id="@+id/blurView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
</eightbitlab.com.blurview.BlurView>
</LinearLayout>

0 comments on commit 4072a5a

Please sign in to comment.