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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
DEMO: test the battery status WebAPI across web and iOS&Android #2663
Draft
kelset
wants to merge
16
commits into
main
Choose a base branch
from
kelset/rneu-demo-v2
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add battery test in test app cleanup add a little comment starting point fix for multidemo
kelset
changed the title
DEMO: test the battery status API across web and native
DEMO: test the battery status API across web and iOS&Android
Sep 12, 2023
kelset
changed the title
DEMO: test the battery status API across web and iOS&Android
DEMO: test the battery status WebAPI across web and iOS&Android
Sep 12, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello, and welcome to the demo!
If you are reading this, it's very likely that you watched @kelset and @tido64's demo at RNEU 2023 (link to recording TBA).
This draft PR is here to provide you with step-by-step instructions for how to play with it locally!
Please bear in mind that this example is just to showcase what we are thinking about when dabbling with the concept of having web code work directly in React Native. It is NOT for production use - heck, it's not for ANY use aside from this demo scenario!
Relevant context
If you want to better understand what's going on here, please check out our Roadmap document and the webapis RFC; after that, you can have a pass through the code of this PR adding a custom polyfills "autolinker" for Metro and the PR that implements the webapi for BatteryStatus for iOS and Android.
Steps to setup locally
kelset/rneu-demo-v2
yarn install
at rootcd packages/test-app
yarn build --dependencies
to prepare the monorepopod install --project-directory=ios
to setup the iOS test appweb
(viacd web
) and once again runyarn install
to link everything upyarn dev
and you can open up the Vite+React+TS sample app athttp://localhost:5173/
packages/test-app
folder, and we can start the native appsyarn ios --simulator "iPhone 14"
packages/test-app
folder and runyarn start --reset-cache
to start Metroyarn android
packages/test-app/src/App.native.tsx
; go there and uncomment lines L19, L27 and L39->L41, then hit save.packages/test-app/web/src/useBatteryStatus.ts
(ex. changing L8 tosetBatteryLevel(status.level * 100);
) and when hitting save you should see all the 3 apps refresh and showcase the new values!And that's it! Have fun and please remember this is just an experiment 馃И