-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[WIP] Grommet box primitives INITIAL WIP - DO NOT MERGE #3029
[WIP] Grommet box primitives INITIAL WIP - DO NOT MERGE #3029
Conversation
Lots of good stuff in here, especially the detailed research results around your wip.
I'm not sure if investing in this library will be a good choice to spend resources on. again, THANK you for sharing your work, it's good to know we can leverage existing libraries to make this type of support possible. feel free to help with the information/question above. |
Hi @ShimiSun, thanks for the thoughtful and timely feedback. Here are my responses so far: I would likely favor migrating to In terms of My general motivation is to enable app developers to target web apps and React Native GUIs with a similar if not unified code base, using a "super-modern" material design framework such as this one. This could theoretically enable an app developer to start with with online and PWA apps, then make a smooth transition over to React Native as needed. Please let me know if this is still not clear enough or you guys have any further questions. The I have made the following to revive
My thought has been that I will completely understand if Grommet decides not to use Some finer, less important points: Part of my motivation behind selecting Grommet over another Material Design framework is that it seems to use modular CSS via the styled-components API rather than CSS classes, which are not readily supported by React Native. (I would love to get CSS classes working on React Native someday.) Here are some really interesting articles about the experiences MLS Soccer had with "universal components":
At this point I remain hopeful that we could find a way to improve general reuse between web and React Native. I suspect this will improve as more and more developers start using modular CSS frameworks like styled/emotion and some form of universal component libraries. This could be parallel to the transition to SPA that happened within the past decade. |
I hope to revisit this proposal soon, my apologies for such a long delay. Some quick thoughts:
|
76bc7ef
to
550662e
Compare
(was originally in multiple workaround commits)
NEEDED NOW THAT the padding is enabled again
c36bdfc
to
6198206
Compare
I took some time this week to rebase onto the recent |
We appreciate your work on this PR. |
What does this PR do?
INTIIAL DRAFT WIP:
Box
and themedGrommet
components now partially working on web and React Native usingstyled-components/primitives
, with a few workarounds that are hopefully temporary.Unfortunately the padding is not working at this time. I would have to investigate it further. My initial purpose is to prove Grommet able to run with some basic components on both web and native using react-primitives.
NOTE that this PR is coming from an initial-wip branch and is not intended to ever be merged. I would expect some deep rework will be needed before we should consider merging. I will also completely understand if some of the initial coding decisions such as adding the new
styled-imports.js
module would not be accepted.There are some additional peer dependencies, which would be needed as documented in the following locations:
Where should the reviewer start?
I made a new module in
src/js/styled-imports.js
that imports fromstyled-components/primitives
, and this module is used in theStyledBox.js
,StyledGrommet.js
,hoc.js
, and other common JavaScript sources. The new module was introduced in f3f2b4a & 98fa9fb, then adapted in 8f215db to import fromstyled-components/primitives
rather thanstyled-components
.I made a few workarounds that were needed to work on react-primitives and react-native. Most of the workarounds changes are in individual commits. As I said before I hope the workaround solutions can be replaced by better solutions.
The actual change from
styled-components
tostyled-components/primitives
was done in the following commits:What testing has been done on this PR?
I made a test app in https://github.com/brodybits/grommet-primitives-box-testapp-wip based on code generated by both create-react-app and
expo init
. This test app is able to run a very basic Grommet demo on both web and Expo using react-primitives.The test app uses a git submodule to run a version of Grommet with these changes from https://github.com/brodybits/grommet-primitives-fork.
In the future I would like to do the testing using Storybook and Expobook (see https://blog.expo.io/introducing-expobook-8fbf7a125a9d).
How should this be manually tested?
Major tools needed:
Major steps:
git submodule update --init --recursive
(see https://github.blog/2016-02-01-working-with-submodules/)yarn start-web
(I generally doBROWSER=none yarn start-web
and then navigate to http://localhost:3000/)yarn start-expo
orexpo start
then view the app on my Android & iPhone devicesAny background context you want to provide?
I would like to help make it easier for web and mobile app developers to develop applications that work seamlessly across the major web and device technologies. My idea is that it should be possible for developers to start with online and PWA apps, then be able to make a smooth transition to native mobile GUIs at will. React Primitives was a major step in this direction, and I think another major step has been taken by
styled-components
: https://medium.com/styled-components/announcing-primitives-support-for-truly-universal-component-systems-5772c7d14bc7Grommet seemed like a perfect fit since it is already designed to support Material Design using
styled-components
.I would also like to revive
react-primitives
or a similar kind of framework and think this kind of a port could really prove the usefulness.What are the relevant issues?
Screenshots (if appropriate)
From a web browser:
From React Native Expo on my iPhone:
Do the grommet docs need to be updated?
TBD
Should this PR be mentioned in the release notes?
Not this PR since it is intended to remain a WIP PR.
Is this change backwards compatible or is it a breaking change?
I would definitely consider this to be a breaking change since it would need
react-primitives
and other related packages in order to work at all.