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

refactor: Use react-native-test-app to manage our test app #142

Merged
merged 13 commits into from
Aug 20, 2021

Conversation

Saadnajmi
Copy link
Contributor

@Saadnajmi Saadnajmi commented Jun 27, 2021

Overview

This PR replaces the test app in the repo with one managed by React Native Test App. This is mainly inspired by my want to add macOS support, which is currently blocked by / tracked at #141. Still, setting up the template test app now will make standing up the macOS portion of the test app trivial come time.

"React Native Test App" provides test apps for all platforms as a package. It handles the native bits, allowing you the developer to focus on the JS. There are a few advantages to using this package:

  • It makes RN version updates easier, as it will handle the proper native code changes
  • It makes targeting new platforms (like macOS or Windows) easier, since it has a template to configure each platform's test app.

Steps

I tried to document my steps well with my individual commit messages. In essence:

mv example/ example2 # Move the existing test app out of the way for a bit
yarn add -D react-native-test-app
yarn init-test-app
# The options I chose
# ✔ What is the name of your test app? … MenuExample
# ✔ Which platforms do you need test apps for? › Android, iOS
# ✔ Where should we create the new project? … example
cd example

After this I did a few extra things:

  • Added generated lock files after running yarn / pod install in the new example test app folder
    • cd example && yarn && pod install --project-directory:ios
    • git add yarn.lock ios/Podfile.lock
  • Ran yarn lint --fix to fix lint errors in the generated test app (mostly double quotes vs single quotes)
  • Modified the example test app's package.json to include the following dependency so we can actually test menu:
    • "@react-native-menu/menu": "../"

Then finally, I copied over the JS source from the old test app, and deleted the old test app

rm example/index.js example/App.js
mv example2/index.tsx example.index.tsx
mv example2/src/App.tsx example/src/App.tsx
rm -rf example2/

Test Plan

Locally ran the iOS and Android test apps.

Screen Shot 2021-06-27 at 4 16 11 PM

@Saadnajmi
Copy link
Contributor Author

Since I couldn't add you as reviewers..
@tido64 who maintains react-native-test-app
@Naturalclar who maintains react-native menu

Alas, I couldn't add macOS support because react-native-macos isn't on 0.64 yet :(. I decided to go forward with moving the test app anyway to make it easier to add macOS support in the fut
Keeping this as a draft at the moment because run-ios doesn't work. If that's not a blocker, I can make it a full PR. Working on filing the right bugs in the cli now =)

example/yarn.lock Outdated Show resolved Hide resolved
example/package.json Outdated Show resolved Hide resolved
@Saadnajmi Saadnajmi marked this pull request as ready for review August 20, 2021 12:47
@Saadnajmi
Copy link
Contributor Author

@Naturalclar This should be ready for review! It should also make updating to RN 0.65 very simple, I just didn't want to bundle that in the same review. Thanks @tido64 for helping fix upstream CLI issues!

Copy link
Member

@Naturalclar Naturalclar left a comment

Choose a reason for hiding this comment

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

@Saadnajmi @tido64 awesome! thank you guys so much!

@Naturalclar Naturalclar merged commit 22bc25b into react-native-menu:master Aug 20, 2021
@tido64
Copy link
Contributor

tido64 commented Nov 6, 2021

Alas, I couldn't add macOS support because react-native-macos isn't on 0.64 yet :(.

Btw, the first 0.64 versions of react-native-macos is quite usable now ;)

@Saadnajmi Saadnajmi deleted the new-test-app branch November 15, 2021 16:19
@Saadnajmi
Copy link
Contributor Author

Alas, I couldn't add macOS support because react-native-macos isn't on 0.64 yet :(.

Btw, the first 0.64 versions of react-native-macos is quite usable now ;)

Yep! I have a working menu component I wrote for macOS elsewhere that I can port here once I get the chance!

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.

None yet

3 participants