Skip to content

Commit a284579

Browse files
committed
chore: changes after self review
1 parent 30de50f commit a284579

2 files changed

Lines changed: 3 additions & 12 deletions

File tree

android/src/main/java/com/reactnativekeyboardcontroller/listeners/KeyboardAnimationCallback.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ class KeyboardAnimationCallback(
5151
val view: View,
5252
val context: ThemedReactContext?,
5353
private val config: KeyboardAnimationCallbackConfig,
54-
private val source: KeyboardAnimationCallback? = null,
5554
) : WindowInsetsAnimationCompat.Callback(config.dispatchMode),
5655
OnApplyWindowInsetsListener,
5756
Suspendable {
@@ -173,7 +172,7 @@ class KeyboardAnimationCallback(
173172
if (prevKeyboardHeight != newHeight && !isMoving && !isSuspended) {
174173
Logger.w(
175174
TAG,
176-
"detected desynchronized state - force updating it. $prevKeyboardHeight -> $newHeight. Attached: ${view.isAttachedToWindow} EVA: ${this.eventPropagationView.isAttachedToWindow} Modal ${this.source}",
175+
"detected desynchronized state - force updating it.",
177176
)
178177
this.syncKeyboardPosition(newHeight, newHeight > 0)
179178
}
@@ -184,8 +183,6 @@ class KeyboardAnimationCallback(
184183
override fun onPrepare(animation: WindowInsetsAnimationCompat) {
185184
super.onPrepare(animation)
186185

187-
println("desynchronized - onPrepare")
188-
189186
if (!animation.isKeyboardAnimation || isSuspended) {
190187
return
191188
}

android/src/main/java/com/reactnativekeyboardcontroller/modal/ModalAttachedWatcher.kt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ class ModalAttachedWatcher(
3333
return
3434
}
3535

36-
val cb = this.callback()
3736
val modal =
3837
try {
3938
uiManager?.resolveView(event.viewTag) as? ReactModalHostView
@@ -45,9 +44,6 @@ class ModalAttachedWatcher(
4544
if (modal == null) {
4645
return
4746
}
48-
if (cb == null) {
49-
return
50-
}
5147

5248
val dialog = modal.dialog
5349
val window = dialog?.window
@@ -64,7 +60,6 @@ class ModalAttachedWatcher(
6460
eventPropagationView = view,
6561
context = reactContext,
6662
config = config,
67-
source = cb,
6863
)
6964

7065
rootView.addView(eventView)
@@ -73,10 +68,9 @@ class ModalAttachedWatcher(
7368
// on Android < 12 all events for `WindowInsetsAnimationCallback`
7469
// go through main `rootView`, so we don't need to stop main
7570
// callback - otherwise keyboard transitions will not be animated
76-
cb.suspend(true)
71+
this.callback()?.suspend(true)
7772
// attaching callback to Modal on Android < 12 can cause ghost animations, see: https://github.com/kirillzyusko/react-native-keyboard-controller/pull/718
78-
// and overall attaching additional callbacks (if animation events go through the main window)
79-
// is not necessary
73+
// and overall attaching additional callbacks (if animation events go through the main window) is not necessary
8074
ViewCompat.setWindowInsetsAnimationCallback(rootView, callback)
8175
ViewCompat.setOnApplyWindowInsetsListener(eventView, callback)
8276
}

0 commit comments

Comments
 (0)