lelandrichardson / react-primitives

Primitive React Interfaces Across Targets

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How does react-primitives detect which platform it's running on?

tonyxiao opened this issue · comments

And therefore which set of injection to use? Looking at the source code as well as published node module, it would seem that everything imports

require('./injection/react-native-web');

it's not react-primitives which detect which platform it's running on, it's you build system. So the react-native bundler will take the .ios.js or .android.js files first, etc.

@mathieudutour I understand how .ios and .android works - however how does the web part work?

and sketch also

on the web it's requiring index.js which is require('./injection/react-native-web'); and what you want.

For Sketch, skpm is looking for .sketch.js first.

In the end, it's just dependant of your bundler: what extension it prioritize.

Got it - thank you!