Skip to content

Conversation

Kudo
Copy link
Contributor

@Kudo Kudo commented Feb 23, 2023

Why

fix textinput crash on expo go home

                         E  FATAL EXCEPTION: main
                         E  Process: host.exp.exponent, PID: 14389
                         E  java.lang.ClassCastException: android.app.ContextImpl cannot be cast to android.app.Activity
                         E      at com.facebook.react.ReactRootView$CustomGlobalLayoutListener.getActivity(ReactRootView.java:22)
                         E      at com.facebook.react.ReactRootView$CustomGlobalLayoutListener.checkForKeyboardEvents(ReactRootView.java:62)
                         E      at com.facebook.react.ReactRootView$CustomGlobalLayoutListener.onGlobalLayout(ReactRootView.java:36)
                         E      at android.view.ViewTreeObserver.dispatchOnGlobalLayout(ViewTreeObserver.java:1061)
                         E      at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3352)
                         E      at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2286)
                         E      at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8948)
                         E      at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1231)
                         E      at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1239)
                         E      at android.view.Choreographer.doCallbacks(Choreographer.java:899)
                         E      at android.view.Choreographer.doFrame(Choreographer.java:832)
                         E      at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1214)
                         E      at android.os.Handler.handleCallback(Handler.java:942)
                         E      at android.os.Handler.dispatchMessage(Handler.java:99)
                         E      at android.os.Looper.loopOnce(Looper.java:201)
                         E      at android.os.Looper.loop(Looper.java:288)
                         E      at android.app.ActivityThread.main(ActivityThread.java:7898)
                         E      at java.lang.reflect.Method.invoke(Native Method)
                         E      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
                         E      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

close ENG-7643

How

in the ReactRootView, the context is actually MainApplication, which is not quite correct. We should pass Activity to views instead.

Test Plan

using Android 13 emulator to click textinput in expo go home

Checklist

@linear
Copy link

linear bot commented Feb 23, 2023

ENG-7643 Fix Expo Go "Enter URL manually" input on Android

It currently crashes on focus on Samsung devices. gabriel has a PR open here with one possible solution: expo/react-native#32 - it needs review from kudo and lukmccall

@expo-bot expo-bot added the bot: passed checks ExpoBot has nothing to complain about label Feb 23, 2023
@Kudo Kudo marked this pull request as ready for review February 23, 2023 17:53
@Kudo Kudo requested a review from gabrieldonadel February 23, 2023 17:53
@Kudo Kudo merged commit 570504b into main Feb 23, 2023
@Kudo Kudo deleted the @kudo/sdk48/expo-go-textinput-crash branch February 23, 2023 18:28
brentvatne pushed a commit that referenced this pull request Feb 23, 2023
# Why

fix textinput crash on expo go home
close ENG-7643

# How

in the ReactRootView, the context is actually `MainApplication`, which is not quite correct. We should pass Activity to views instead.

# Test Plan

using Android 13 emulator to click textinput in expo go home
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: passed checks ExpoBot has nothing to complain about
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants