Skip to content

Commit 1d7b1c7

Browse files
committed
fix: android view
1 parent 256331b commit 1d7b1c7

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

android/src/main/java/com/effx/secureview/SecureView.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,15 @@ class SecureView(context: Context) : FrameLayout(context) {
2727
e.printStackTrace()
2828
}
2929
}
30+
31+
override fun onDetachedFromWindow() {
32+
super.onDetachedFromWindow()
33+
34+
try {
35+
val activity = (context as? ThemedReactContext)?.currentActivity
36+
activity?.window?.clearFlags(WindowManager.LayoutParams.FLAG_SECURE)
37+
} catch (e: Exception) {
38+
e.printStackTrace()
39+
}
40+
}
3041
}

android/src/main/java/com/effx/secureview/SecureViewManager.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ class SecureViewManager : ViewGroupManager<SecureView>(), SecureViewManagerInter
2121
}
2222

2323
override fun createViewInstance(context: ThemedReactContext): SecureView {
24-
return SecureView(context)
24+
return SecureView(context).apply {
25+
isHermesEnabled = true
26+
}
2527
}
2628

2729
@ReactProp(name = "enable", defaultBoolean = true)

0 commit comments

Comments
 (0)