Alex Shkolnikov
Alex Shkolnikov

Reputation: 124

React-native not applying styles

Styles not applying from require. Here is sample app, describing the problem: https://github.com/alexshk/react-native-style

Versions:

➜  stylestest git:(master) npm version
{ stylestest: '0.0.1',
  npm: '3.8.6',
  ares: '1.10.1-DEV',
  http_parser: '2.7.0',
  icu: '56.1',
  modules: '48',
  node: '6.1.0',
  openssl: '1.0.2h',
  uv: '1.9.0',
  v8: '5.0.71.35',
  zlib: '1.2.8' }

Upvotes: 0

Views: 524

Answers (2)

Xeijp
Xeijp

Reputation: 873

Because you're using ES5 require with ES6 export syntax, you should either change

var styles = require('./styles')

to

import style from ./styles'

or change

export default StyleSheet.create(...)

to

module.exports = StyleSheet.create(...)

Upvotes: 1

Alex Shkolnikov
Alex Shkolnikov

Reputation: 124

Figured it myself:

I was using export default StyleSheet.create({ instead of module.exports = StyleSheet.create({

Upvotes: 0

Related Questions