Code Monkey home page Code Monkey logo

Comments (5)

anzorb avatar anzorb commented on July 21, 2024 1

Any variable would cause this issue because it didn't appear to get interpolated when it was consumed by toJSS(). A console.log(css) in there show this.

If the string is encapsulated in brackets, it all works great.

 const runningColor = 'green';

    const lss = RNC(`
     bla {
        background-color: ${runningColor};
      }
    `);

    return <View style={lss.bla}></View>

Tagged template literals behave different with or without parentesis:
Chrome:

const test = 'literals';

console.log`hello template ${test}`
>["hello template ", "", raw: Array(2)] 
"literals"

console.log(`hello template ${test}`)
>hello template literals

I don't have enough time to keep digging (and I can live with brackets), but maybe above info will make it obvious for you ^

from react-native-css.

yuritoledo avatar yuritoledo commented on July 21, 2024 1

Hi,

Just for information, in the "react-native-css": "^2.1.2" works normally!

from react-native-css.

thabti avatar thabti commented on July 21, 2024

Thank you, I will investigate.

from react-native-css.

thabti avatar thabti commented on July 21, 2024

@anzorb

Does this only happen when using ${runningColor};?

from react-native-css.

thabti avatar thabti commented on July 21, 2024

@anzorb thank you so much for doing all the digging. Please test [email protected].

Add the following test:https://github.com/sabeurthabti/react-native-css/blob/a7ad812fbb346daae052b337467d71e1e3d46fee/test/rnc.test.js#L240

should be working as expected.

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.