Socket
Socket
Sign inDemoInstall

@startupjs/babel-plugin-rn-stylename-inline

Package Overview
Dependencies
Maintainers
6
Versions
215
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@startupjs/babel-plugin-rn-stylename-inline

Use styleName attributes with inline css and styl template strings


Version published
Weekly downloads
739
increased by128.09%
Maintainers
6
Weekly downloads
 
Created
Source

@startupjs/babel-plugin-rn-stylename-inline

Adds support for in-JS template strings css\`andstyl``` for CSS styles for react-native.

Must be used together with @startupjs/babel-plugin-rn-stylename library.

Options

platform -- what platform the compilation is on. For example, web or ios or android.

Example

File-level scope (global to file)

import React from 'react'
import { View } from 'react-native'
import { css } from 'startupjs'

export default function Card () {
  return <View styleName='card active'><Line /></View>
}
function Line () {
  return <View styleName='line' />
}
css`
  .card {
    padding: 8px 16px;
  }
  .line {
    margin-top: 16px;
    border-radius: 8px;
  }
  .active {
    background-color: red;
  }
`

Local component scope (inside particular react component function)

import React from 'react'
import { View } from 'react-native'
import { css, styl } from 'startupjs'

export default function Card () {
  return <View styleName='root active'><Line /></View>
  // .root will be scoped only to this specific component
  styl`
    .root
      padding: 8px 16px
  `
}
function Line () {
  return <View styleName='root' />
  // .root will be scoped only to this specific component
  css`
    .root {
      margin-top: 16px;
      border-radius: 8px;
    }
  `
}
// you can use global- and local- scoped styles together
styl`
  .active
    background-color red
`

License

MIT

Keywords

FAQs

Package last updated on 22 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc