Open brodycj opened 5 years ago
Keep in mind that this is not enforced by react-primitives
. It's the bundler config that resolves some extensions before others (for the case of react-native, it resolves ios.js
before .js
).
But yes, a bit of documentation about it would be nice.
Here are the convention we follow:
.android.js
-> react-native.ios.js
-> react-native.js
-> react-native-web.sketch.js
-> react-sketchapp.vr.js
-> react-vr (possibly react-360 soon).web.js
-> react-native.web.windows.js
-> react-nativeI hope to contribute some documentation in the near future. For now I would like to focus on Android, iOS, and web. (Examples and documentation for the other platforms would be nice, not sure how much commercial interest there would be.)
P.S. By "hope" I did not mean "promise". That means that there is no commitment, and I think others should feel free to contribute according to their best judgment. I may need a few weeks due to some other priorities. But I did say "near future", not "someday" since I would like to give this much needed task some priority. This may be part of #29 (add docs site).
Two kinds of extensions as described in https://youtu.be/hNwQPJy-XZY:
The trick is that for each primitive there would be JavaScript files such as:
index.js
- for web platform (usingreact-native-web
)index.android.js
- for Android (usingreact-native
)index.ios.js
- for iOS (usingreact-native
)I was not aware of this support for either of the two kinds of extensions until very recently (unfortunately I lost track of which discussion I found https://youtu.be/hNwQPJy-XZY in). I hope we can get this more formally documented in the near future.
P.S. Here are some examples of new "primitive" components (first 2 by myself):
react-primitives-input
react-primitives-scrollview
react-primitives-svg
This description was also updated to make it clear that I meant there are two types of extensions: adding new "primitive" components and supporting additional platforms.