Closed shubhi15 closed 6 years ago
Hi @shubhi15!
Do you call EStyleSheet.build()
in your code?
I'm with the same error, and I called EStyleSheet.build() in my App.js file.
I think this is because styles are imported (and executed) before EStyleSheet.build()
call.
Imagine you have app.js
:
import styles from './styles'; // <-- occurs before EStyleSheet.build()
EStyleSheet.build();
and styles.js
is:
import EStyleSheet from 'react-native-extended-stylesheet';
const styles = EStyleSheet.create({
background: {
backgroundColor: '#fff',
flex: 1,
},
});
console.log("exported category styles");
console.log(styles); // <-- here styles are not builded yet and console shows {}
export default styles;
If this does not help, please show your code as Expo snack using this template: https://snack.expo.io/@vitalets/extended-stylesheet-simple
Thanks @vitalets you're right, I've forgotten to call the js file where EStyleSheet.build(); was configured.
You are welcome!
Hello
I am trying to use EStyleSheet.create method to create my styles but it is returning me empty object. Code refrence import EStyleSheet from 'react-native-extended-stylesheet';
const styles = EStyleSheet.create({ background: { backgroundColor: '#fff', flex: 1, }, }); console.log("exported category styles"); console.log(styles) export default styles;
my console statement returning styles as empty object.
Regards Shubhi