Reputation: 826
I am learning how develop react native development and I am curious if you could put all the styles into one style.js file and then export it which allow all the components to be able to use the styles.
Upvotes: 4
Views: 1111
Reputation: 4199
Yes you can. u can write styles in seperate file.
import React, { Component, PropTypes } from 'react';
import { StyleSheet } from 'react-native';
var styles = StyleSheet.create({
...
});
module.exports = styles;
Then import it in componnet class like
import styles from './styles'
Upvotes: 9