Comments (5)
Not sure if React-native css supports media queries. I might make this to be compatible with React. Please note, this module isn't fully complete. @pukhalski
from react-native-css.
from react-native-css.
@pukhalski yep I noticed that error.
facebook/react-native#971, checking if react-native has support for FS. I will work on it tonight.
from react-native-css.
@pukhalski
I will update the doc soon.
I think React-native doesn't have support for node modules. So i found this alternative:
- please update to version 1.1.1 of this project:
npm install [email protected] --save
- make a
style.css
file with some css styles within your project - add the follow to your package.json scripts json path:
"scripts": {
"css": "node_modules/.bin/rncss -i style.css -o style.js",
"start": "npm run css && node_modules/react-native/packager/packager.sh"
}
notice rncss
!
node_modules/.bin/rncss -i SOURCE_CSS_PATH_AND_FILE_NAME.css -o PATH_TO_AND_JS_FILENAME.js
what css script will do is, take an input (-i
) css file and out (`-o') javascript file name, it will generate the follow:
module.exports = require('react-native').StyleSheet.create({"description":{"marginBottom":20,"fontSize":18,"textAlign":"center","color":"#656656"},"container":{"padding":30,"marginTop":65,"alignItems":"center"}});
then within index.ios.js' just require in the generated
style.js`:
var styles = require('./style')
full example of the demo app:
'use strict';
var React = require('react-native');
var {
AppRegistry,
StyleSheet,
Text,
View,
} = React;
var styles = require('./style')
var saybrrlinksapps = React.createClass({
render: function() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to React Native!
</Text>
<Text style={styles.instructions}>
To get started, edit index.ios.js
</Text>
<Text style={styles.instructions}>
Press Cmd+R to reload,{'\n'}
Cmd+Control+Z for dev menu
</Text>
</View>
);
}
});
AppRegistry.registerComponent('saybrrlinksapps', () => saybrrlinksapps);
We lose the refresh command, I will see if I can hooking the packager and get it to execute this module. For now just open another terminal and run:
node_modules/.bin/rncss -i SOURCE_CSS_PATH_AND_FILE_NAME.css -o PATH_TO_AND_JS_FILENAME.js
from react-native-css.
@pukhalski a new version with file watching has been added, ignore the text above.
[email protected]
improves the cli
from react-native-css.
Related Issues (20)
- Can i write LESS like CSS just like that in webpages with this tool? HOT 2
- Doesn't work with Windows OS HOT 1
- value auto is set like null HOT 3
- Can't generate shadowOffset HOT 4
- Shorthands aren't properly expanding HOT 1
- Update purpose and scope HOT 1
- Add validation
- Interest in Integrating? HOT 5
- Convert properties that don't match their CSS equivalent HOT 5
- Compatibility with other css preprocessors - Stylus HOT 1
- nesting styles HOT 9
- Ability to use predefined features from StyleSheet object.
- shadowOpacity
- No Longer under active development.
- [enhancement] Create gulp plugin HOT 2
- Version 2
- V2: package.json points to incorrect main HOT 10
- undefined is not a function (Symbol.iterator) HOT 2
- Unable to use interpolation in CSS HOT 5
- Little hack for code complete to who use VSCode! [suggestion] HOT 1
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-native-css.