Skip to content

[modules][Android] AppContext.currentActivity is not longer returning AppCompatActivity#19573

Merged
lukmccall merged 4 commits intomainfrom
@lukmccall/core/remove-app-compact
Oct 18, 2022
Merged

[modules][Android] AppContext.currentActivity is not longer returning AppCompatActivity#19573
lukmccall merged 4 commits intomainfrom
@lukmccall/core/remove-app-compact

Conversation

@lukmccall
Copy link
Copy Markdown
Contributor

Why

We can't return AppCompatActivity from the AppContext.currentActivity, because that symbol may not be defined in the user library. In theory, we could reexport the androidx package from e-m-c, but I don't see a reason why. It doesn't sound like a good idea.

How

Replaced AppCompatActivity with pure Activity class

Test Plan

  • unit tests ✅

@expo-bot expo-bot added the bot: suggestions ExpoBot has some suggestions label Oct 16, 2022
@expo-bot expo-bot added bot: passed checks ExpoBot has nothing to complain about and removed bot: suggestions ExpoBot has some suggestions labels Oct 18, 2022
@lukmccall lukmccall merged commit f13a192 into main Oct 18, 2022
@lukmccall lukmccall deleted the @lukmccall/core/remove-app-compact branch October 18, 2022 15:13
williscool added a commit to williscool/CalendarNotification that referenced this pull request Oct 12, 2023
ran into this ugly one called

java.lang.IllegalStateException: Current Activity is of incorrect class,
expected AppCompatActivity, received ui.MyReactActivity

hard to debug for real for real.

ended up looking into expo docs that said they are getting rid of the
bare instructions

and then

expo/expo#18022

then that had me be like where is that erorr even from...

which lead me to git blame

packages/expo-modules-core/android/src/main/java/expo/modules/kotlin/AppContext.kt

which lead me to

expo/expo#19573

which lead me to

s/Activity/AppCompatActivity/g

in

android/app/src/main/java/com/github/quarck/calnotify/ui/MyReactActivity.kt
williscool added a commit to williscool/CalendarNotification that referenced this pull request Oct 14, 2023
* bring over stuff that looks good from standard native modules attempt

#10

* expo config setup init

MAN THAT WAS HARD!

had to

- downgrade react-native to 0.71
- upgrade kotlin to 1.8
- downgrade gradle to 7.6
- change the location of @react-native/gradle-plugin  to
  react-native-gradle-plugin
- setup the expo config to use the hermes compiler (not mention in doc
    :/ )

facebook/react-native#38179

expo/expo#22008

* missed a spot

* got everything running with no errors

ran into this ugly one called

java.lang.IllegalStateException: Current Activity is of incorrect class,
expected AppCompatActivity, received ui.MyReactActivity

hard to debug for real for real.

ended up looking into expo docs that said they are getting rid of the
bare instructions

and then

expo/expo#18022

then that had me be like where is that erorr even from...

which lead me to git blame

packages/expo-modules-core/android/src/main/java/expo/modules/kotlin/AppContext.kt

which lead me to

expo/expo#19573

which lead me to

s/Activity/AppCompatActivity/g

in

android/app/src/main/java/com/github/quarck/calnotify/ui/MyReactActivity.kt

* fix: forgot to switch to matching gradle version for android build plugin

* def don't need react native picker

hope we don't need expo install modules either

* kinda crazy but got a (mostly) WORKING NATIVE MODULE!

in

modules/my-module/android/src/main/java/expo/modules/mymodule/MyModule.kt

Constants, Events, and AsyncFunction work beautifully!

View seems to work but I don't really understand it

weirdly Function DOES NOT WORK AT ALL!!!

it just says is not a function and since it seemed like the easiest
thing and was what I looked at first it made me thing everything else
was broken too :/

lost A LOT of time to that

* Logcat instead of println and hello on button press

* document why chrome debugging doesn't work as expected by default

to save myself time in the future

* debugging with vscode works!!!!

unfortunately debugging syncronous native modules in it does not :/

* more docs on debugging

* react-native-devsettings because why not

* flipper setup again because why not?

* drop a android studio thing that didn't work

* fix readme

* drop a dependency we dont need that had a peer dependency that broke shit

expo-module-scripts 3.1.0 depends on @expo/config 7.5 which breaks shit

* Revert "flipper setup again because why not?"

turns out it breaks build. like flipper but not worth build break

This reverts commit 8612ff3.

* do still want to set entryFile though
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.

4 participants