-
Notifications
You must be signed in to change notification settings - Fork 3
React Native Support #15
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How did a dedicated Editmode.native.jsx go?
I didn't go with it because I thought it might be too overkill? And also confusing in the long run. I just think the current approach will make more sense if someone is not using React Native. At least that's how I see it. What do you think? |
The .native extensions is basically a way of opting into RN support without breaking non-RN projects. From the looks of this PR, RN is now a required dependency for consumers, which would be a breaking change. Am I reading that correctly? Another way libraries support both web and RN is having a separate entry point: Anyway, there are a variety of methods, but the primary goal is that non-RN projections won't have RN as a dependency directly or indirectly (from this lib). |
Googled a few stackoverflow answers. Says there that separate entry routes do not work anymore after 0.49.3. They also said to use { Platform } instead. Which is what we have right now.
I'm not sure how an import can be a breaking change? It will probably be an extra kb, though. |
That’s interesting! I was going off of
https://reactnative.dev/docs/platform-specific-code#platform-specific-extensions
If you tested it and it works and doesn’t affect web, feel free to ship!
Thanks for the extra info :)
--
Sent from Gmail Mobile
|
@ericclemmons that is so weird. The docs say 0.63 so it should probably work, right? I couldn't make it work and when I searched for it they were saying that it shouldn't work anymore. Is this by any chance a mistake in the docs? Or am I just doing something wrong? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BosEriko We can revisit this, but if things are working in your testing, let's ship 👍
Track bundle-sizes here post-release:
🚀 PR was released in |
"axios": "^0.19.2", | ||
"dompurify": "^2.0.11", | ||
"lodash-es": "^4.17.15", | ||
"react": "^16.13.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
react
should be both indevDependencies
andpeerDepenencies
because we depend on it for local development directly (e.g.import React from "react"
) and consumers should have it in their project.react-dom
should be apeerDependencies
because consumers should have it in their project.react-native
can be adevDependencies
if we're using it for tests or in a local project, but likely won't need it listed anywhere at all.
// @ts-check | ||
import React, { useEffect } from "react"; | ||
import { EditmodeContext } from "./EditmodeContext"; | ||
import { Platform } from 'react-native'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't safely depend on react-native
within a web environment because of how react-native
publishes to NPM (under the expectation that it's bundled via expo
or metro
bundler)
@@ -1,23 +1,28 @@ | |||
// @ts-check |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to re-investigate splitting Editmode.jsx
into 2 files:
Editmode.jsx
for webEditmode.native.jsx
forreact-native
📦 Published PR as canary version:
3.1.3-canary.15.931587d.0
✨ Test out this PR locally via: