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

[docs] Update Adding a new module to an existing application section in Expo Modules API: Get started #28470

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

amandeepmittal
Copy link
Member

@amandeepmittal amandeepmittal commented Apr 26, 2024

Why

Context Slack

How

  • Add context to use Prebuild command to generate native project directories and use npx expo run commands to compile and run the example app instead of using EAS Build.
  • Update Android and iOS instructions in step 3
  • Update instructions in Step 2 to provide an example how to use the method from the native module

Test Plan

Run docs locally and see: http://localhost:3002/modules/get-started/#adding-a-new-module-to-an-existing-application or see Preview link below.

Checklist

@expo-bot expo-bot added the bot: passed checks ExpoBot has nothing to complain about label Apr 26, 2024
@expo-bot
Copy link
Collaborator

expo-bot commented Apr 26, 2024

📘 Your docs preview website is ready!

Copy link
Member

@tsapeta tsapeta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thank you for improving it! I left a couple of comments.

I'm also wondering if recommending building/running the native project from Xcode and Android Studio wouldn't be better than npx expo run and re-running it every time you change something.

User could just run npx expo start once and then use the native editors which I believe offer a bit better DX for native code development. You don't need to switch between the editor and terminal, you have access to the native logs, debugger etc.

docs/pages/modules/get-started.mdx Outdated Show resolved Hide resolved
docs/pages/modules/get-started.mdx Outdated Show resolved Hide resolved

Rebuild the app or build a new development client and you should see your change. Remember you need to either run `npx expo prebuild` each time you make a native change or reinstall the pods using `pod install --project-directory="example/ios"` (which should be way faster).
Remember you need to either run `npx expo prebuild` each time you make a native change or reinstall the pods using `pod install --project-directory="ios"` (which will be faster).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not necessary to run prebuild after each native change. You only need to run it again.

pod install might be necessary when you modify expo-module.config.json (e.g. add another module class) and when you add more files to the module (they won't appear in Xcode if you add them using something else than Xcode).


Rebuild the app or build a new development client and you should see your change.
For example, change the `hello` method to return a different string such as "Hello world! 🌎🤖". Then, run `npx expo prebuild` to generate the native directory and use `npx expo:android` to run the example app.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For example, change the `hello` method to return a different string such as "Hello world! 🌎🤖". Then, run `npx expo prebuild` to generate the native directory and use `npx expo:android` to run the example app.
For example, change the `hello` method to return a different string such as "Hello world! 🌎🤖". Then, run `npx expo prebuild` to generate the native directory and use `npx expo:android` to run the example app.

It's not necessary to run prebuild after each native change. You only need to run it again.

@tsapeta, does the comment mean, we don't need to run npx expo prebuild at this step too? (similarly for iOS below).

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 preview
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants