lelandrichardson / react-primitives

Primitive React Interfaces Across Targets

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Future of primitives?

ktj opened this issue · comments

I've been using this project for a while and I think that the idea is great!

Recently I started thinking, which way is to project heading to?

You have said that you aren't sure yet, which components are the right primitives.
Many people have proposed the idea of adding TextInput as a primitive since it's desperatly needed for many apps.
First I thought that TextInput should be added as a primitive since you can't even make a simple (login) form without it.
I think that it's needed in all the targets mentioned in this projects issues (web, mobile, vr, sketchapp, console), but after a while I've also have come to the same conclusion that it shouldn't be added.

The reason is that TextInput has platform specific logic and some targets can't even implement it.

Even when the basic idea for TextInput is the same across most of the targets, the platform specific nuances make it a different kind of a component on each target. I think that the same issues arise with Touchable.

What if we remove all those problematic components/apis?

Then we face an issue where no developer would choose to use react-primitives in their library since it lacks most of the required components for their needs. The developer would have to use platform extensions for a lot of stuff if they decided to use react-primitives.

This becomes an issue because now let's say we have some cool library for mobile and the developer used react-primitives, but the library uses TextInput from react-native.
Now a new developer wants to use this for some other target (that can implement TextInput somehow).
The new developer can't use it unless the libs developer refactors that TextInput usage in a separate file and uses platform extensions to support that new target.

This adds lots of frustration for developers and libraries will most likely just keep supporting that one target.

One possible solution:
Split primitives into multiple smaller projects (lerna monorepo?)
Keep primitives base very small. Example just View, Text, Image, StyleSheet.
Now we can have the more problematic components/apis in separate projects.
Then we don't have to bloat base with ”must have components” and introducing new targets isn't so exhausting.

The maintainer(s) of the new target could make PRs for each react-primitives-X project that they see fit.

This doesn't necessarily solve any problems, but could make primitives more usable across all targets.

Now in that mobile lib example the new developer could just ask react-primitives-input library developer to support the new target instead of asking dozens of some other library developers to support his/her target.

Any thoughts on this @lelandrichardson ?

Quite interested for an answer. Any feedback ?

So I found primitives through react-sketchapp, which allows you to create Sketch documents with React. Pretty cool. I've got a simple question: what is react-primitives? It has a dependency on react-native-web - which already provides View, Text, etc. - so I'm not quite sure. ? Thanks!

I watched it. I understand the concept, but I still don't know what primitives does, sorry :)
"We are now moving towards react-native-web as the web target implementation."

Does that mean src/web/* components aren't used? Or can you use them without having react-native-web dependency?

My question is connection to the subject but might be a bit on the tangent. Is there anyone who is using this on production level? I see that the last contribution made to this project was 4 months ago. And it only has 5 contributors. With such a small community supporting this, what's the future looking like? Or is React native for web a better alternative?

see the discussion in #54

I would love to see react-primitives driven forward as a base library to make it easier for web developers to build apps that are prepared to work on React Native, maybe together with some higher-level libraries such as Emotion js, Styled Components, Styled System, etc. Maybe with some help from a user community group?