Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove isLaidOut check from copyBoundsInWindow method #275

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.reactnativekeyboardcontroller.extensions

import android.graphics.Rect
import android.os.Build
import android.util.Log
import android.view.View
import androidx.annotation.RequiresApi

Expand Down Expand Up @@ -37,15 +38,12 @@ private val tmpIntArr = IntArray(2)
*/
@RequiresApi(Build.VERSION_CODES.KITKAT)
fun View.copyBoundsInWindow(rect: Rect) {
if (isLaidOut && isAttachedToWindow) {
if (isAttachedToWindow) {
rect.set(0, 0, width, height)
getLocationInWindow(tmpIntArr)
rect.offset(tmpIntArr[0], tmpIntArr[1])
} else {
throw IllegalArgumentException(
"Can not copy bounds as view is not laid out" +
" or attached to window",
)
Log.w("View.copyBoundsInWindow", "Can not copy bounds as view is not attached to window")
}
}

Expand Down
Loading