var label2 = require('ui').label; // will include /android/ui.js on Android // and /iphone/ui.js on iOS // there doesn't even need to be a /ui.js file!
For simple projects, and those that don't use CommonJS
require(), you can use JSS to create platform-specific layouts. Currently, however, our JSS implementation doesn't work well with
require(). For more complex apps, you might consider using:
- platform-specific JS files where you embed the platform-specific formatting within the component definitions.
- using the "Tweetanium technique" where you define a global style object, in which you store style settings determined with platform-branching code. Then, you use that object's properties when setting styles on your UI components.
References and Further Reading