GithubHelp home page GithubHelp logo

kristerkari / babel-plugin-react-native-stylename-to-style Goto Github PK

View Code? Open in Web Editor NEW
8.0 8.0 4.0 114 KB

Transform styleName property to style property in react-native.

License: MIT License

JavaScript 100.00%
babel babel-plugin react-native style stylename

babel-plugin-react-native-stylename-to-style's People

Contributors

cray0000 avatar kristerkari avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

babel-plugin-react-native-stylename-to-style's Issues

typescript support?

Thanks for build the amazing tools for us.

As you know, we can use kristerkari/react-native-types-for-css-modules to support className in react native. to avoid error in my typescript react-native project.

But I can not use styleName in typescript react-native project.

Support for multiple anonymous imports and combining jsons

Anonymous imports don't work when you have more than one css file to import, even when the other import is a named import. It is very common to have a global css file in addition to the currentFile.css file so certain styles can be reused anywhere in the app.

// Doesn't work
import styles from '../../app.scss';
import './welcome.scss';

// Doesn't work
import '../../app.scss';
import styles from './welcome.scss';

// Doesn't work
import '../../app.scss';
import  './welcome.scss';

// Works
import globalStyles from '../../app.scss';
import localStyles from './welcome.scss';

Is there a way to combine the transformed json objects and overriding based on the order of import: Use "write new property if doesn't exist, overwrite otherwise" strategy when combining?

Is it a deal breaker? Yes.
Because that would allow us to write like,

styleName={[globalStyles.container, localStyles.welcomeContainer]}    // before
styleName="container welcome-container"                               // after


styleName={[globalStyles.button, localStyles.button]}                 // before
styleName="button"                                                    // after

Linked to #29 in the parent sass-transformer repo.

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.