Comments (14)
Perhaps Touchable
should be generalized to Input
since it is also responding to a form of input. TextInput
implies input from a keyboard. If we had a general Input
primitive it could be bound to different input types, like mouse, touch, keyboard, gyroscope, location, etc.
from react-primitives.
Might be worth listing it in the Readme alongside react-primitives
svg`
from react-primitives.
I'm interested on this as well, @lelandrichardson do you have any further insight on the topic? Happy to contribute if needed
from react-primitives.
FWIW, you can prototype that / try it out in your environment by setting up your own injection (e.g., web injection). For Sketch, you could create a faux TextInput
from Views/Text elements.
from react-primitives.
I agree I think TextInput
or even just Input
(a base input component) should be a primitive. I started prototyping a version today but would love to hear from you guys as to what it should support.
My first stab was modeling it more after the react-native-web
interface but I'm not 100% sold on that.
from react-primitives.
My first stab was modeling it more after the react-native-web interface but I'm not 100% sold on that
It's the same as React Native
from react-primitives.
@necolas yes you are right but what I found is that the browser supports more HTML5 input types (ie. dates, numbers, etc.) and a bunch of the RN interface doesn't make a whole lot of sense for web (ie. keyboard options, potentially capitalization, etc.).
A lot of the current components in here are quite similar across all platforms. What is the pattern that you guys are thinking for handling stuff where there is more variance?
- Do as you did with
react-native-web
and mark certain props as platform specific and abstract/polyfill as best a possible? or... - Do you have a base component that implements all common functionality and then the platform specifics are left to the developer to determine?
from react-primitives.
TextInput
is not a replacement for all HTML inputs, so there's no problem there
from react-primitives.
So after re-reading #54, now I actually take it back. @lelandrichardson gave an example of other interfaces like console or something where TextInput
might not make as much sense.
Given what @lelandrichardson identified in the RFC:
We want to be careful in choosing these "primitives". We need enough to be able to build bigger more complex things, but need to keep it minimal enough so that it's reasonable to expect a new platform to be able to implement the full set of them. I believe things like TextInput may be really important in terms of some platforms, but not others, and so should maybe not be a primitive. This will have to be defined over time, but I think being conservative at first is ideal.
To be honest, I'm actually not sure if I'm even confident about the primitives listed above. For instance, if we wanted to add a platform like "console" and create something like react-curses, it's not clear if Image or Touchable actually make sense. These components were mainly chosen because after creating a fairly complete Component Library for Airbnb in React Native, I noticed that almost 95% of it could be implemented with just these primitives. The four that seem really clear to me are StyleSheet, View, Text, and Platform, but it's a balance.
My thought is that maybe react-primitives
should have an Input
component which has a subset API and we don't presume that it is a TextInput
, Checkbox
, Picker/Select
, etc. Instead those would be core components (outside of react-primitives
) built on top of the Input
primitive.
So in this case an Input
component would be more like an API and implement:
value
- getter and setteronChange
onLayout
onFocus
onBlur
blur
focus
clear
disabled
- accessibility attributes
Thoughts??
from react-primitives.
Hi, I believe that this would be a good way to adopt the accessibility notion of interactive and non-interactive element. So I agree that both Touchable and Input are interactive elements for example.
from react-primitives.
I created better primitives with support TextInput and FlatList
Also, it's not use react-native-web
package
So you can use latest react v16+ and react-native v0.48+
Take a look the repo https://github.com/dwicao/react-universal-rendering
from react-primitives.
see #54 for the discussion
from react-primitives.
I just published react-primitives-input
in case it may help anyone.
from react-primitives.
Might be worth listing it in the Readme alongside
react-primitives-svg
I just added them to the description of #136
from react-primitives.
Related Issues (20)
- How does react-primitives detect which platform it's running on? HOT 5
- Compilation issue when used with Next.js
- Touchable delay and sticking
- Should Change to peer dependencies due to [email protected] BC HOT 4
- Use of normal CSS or JSS ? HOT 2
- TypeError: Cannot read property 'injection' of undefined HOT 1
- Future/current state of project HOT 8
- Can you define what is a "primitive"? HOT 1
- add node-webrender HOT 3
- react-primitives will no longer work with RNW 0.11.2+
- Build issue with RNW 0.11.2 persists in a demo app HOT 6
- Add example app build that uses expo
- lint error in src/injection/react-native-web.js HOT 1
- Document extensions HOT 2
- Recent react-native version range in peerDependencies HOT 1
- Remove StyleSheet.resolve method on web HOT 1
- Remove react-art from doc & examples HOT 1
- New platform proposal: React Figma HOT 1
- Is this in active development? HOT 6
- Support RNW 0.18
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-primitives.