Code Monkey home page Code Monkey logo

Comments (5)

brentvatne avatar brentvatne commented on July 21, 2024

Also I'm a bit confused how this is beneficial over:

module.exports = StyleSheet.create({
  description: {
    marginBottom: 20,
    fontSize: 18,
    textAlign: center,
    color: #656656,
  }
})

Seems to lose out on a bunch of important features like using variables for styles (eg, a colour variable) and integrating PixelRatio when that helps. Curious what your solution is for this.

from react-native-css.

thabti avatar thabti commented on July 21, 2024

@brentvatne
for the first question, that was just a typo. margin-bottom will be converted to marginBottom. Everything will be camelCased, I need to add validation for the CSS subset.

As for the second question, I am hoping of solving this by introducing SASS, that way we can have partials, nested css, mixins and variables. I mainly did this project for my basic styling needs. I will look into pixelRatio.

Benefits:

  • writing styles in pure css
  • separating styles from code
  • improve style reusability

from react-native-css.

johanneslumpe avatar johanneslumpe commented on July 21, 2024

Isn't the reusability of those styles limited anyway since you're not using class or id prefixes? I assume those could be added in a pre-processor step, but somehow i doubt that you'd have the same classes on a website. (naming-wise).

The funny thing is that you're doing exactly the opposite of what react wants to promote (keeping styles in code) ;)

from react-native-css.

thabti avatar thabti commented on July 21, 2024

@johanneslumpe
https://github.com/iSimar/HackerNews-React-Native/blob/master/App/Views/Posts/Elements/PostCell/style.js

I agree but it might not be what everyone wants. Example above, where styling is outside of the react component.

from react-native-css.

thabti avatar thabti commented on July 21, 2024

@johanneslumpe agreed. I am using that approach. thanks for that example.

from react-native-css.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.