Don't hold lazy reference to view binding in delayed runnable.

This commit is contained in:
Nicholas Tinsley
2024-06-13 15:43:51 -04:00
parent 2ab2c6f039
commit 73142cea39

View File

@@ -197,9 +197,13 @@ class EnterPhoneNumberV2Fragment : LoggingFragment(R.layout.fragment_registratio
fragmentViewModel.setPhoneNumber(it?.toString())
}
val scrollView = binding.scrollView
val registerButton = binding.registerButton
phoneNumberInputLayout.onFocusChangeListener = View.OnFocusChangeListener { _: View?, hasFocus: Boolean ->
if (hasFocus) {
binding.scrollView.postDelayed({ binding.scrollView.smoothScrollTo(0, binding.registerButton.bottom) }, 250)
scrollView.postDelayed({
scrollView.smoothScrollTo(0, registerButton.bottom)
}, 250)
}
}