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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/expo rn module #12

Merged
merged 18 commits into from
Oct 14, 2023
Merged

feat/expo rn module #12

merged 18 commits into from
Oct 14, 2023

Conversation

williscool
Copy link
Owner

@williscool williscool commented Oct 11, 2023

Bottom Line: Expo React native modules WORK!

The tutorial that finally got things going

https://docs.expo.dev/modules/get-started/#adding-a-new-module-to-an-existing-application

simple demo app

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

WARNING: we will need to HEAVILY FAVOR asynchronous functions for anything BECAUSE WE CANNOT DEBUG SYNC ONES.

enables:

  • react native modules WORK! (with the big caveat that you CANNOT DEBUG SYNCRONOUS FUNCTIONS. they work you just can't open the chrome or vscode debugger and hope to see anything related to them. its all console.log baby )
  • debugging in vscode
  • flipper
  • rn-game-over (for when things just don't seem to work and you need to delete a bunch of stuff and start over)

figured out an documented

  • how to use windows adb like its the linux one

also:

  • upgrade kotlin
  • downgrade gradle
  • downgrade to react 0.71

Fixes #3

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
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
hope we don't need expo install modules either
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
unfortunately debugging syncronous native modules in it does not :/
…shit

expo-module-scripts 3.1.0 depends on @expo/config 7.5 which breaks shit
turns out it breaks build. like flipper but not worth build break

This reverts commit 8612ff3.
@williscool williscool enabled auto-merge (squash) October 14, 2023 22:49
@williscool williscool merged commit 31b3a5c into master Oct 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setup react native/expo to enable migrating the UI
1 participant