Socket
Socket
Sign inDemoInstall

@dotmind/rn-shadow-generator

Package Overview
Dependencies
0
Maintainers
3
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @dotmind/rn-shadow-generator

React Native Shadow Generator is a tool to quickly generate your shadow's Components. Tool builded by .mind team.


Version published
Weekly downloads
6
increased by500%
Maintainers
3
Created
Weekly downloads
 

Readme

Source
header

@dotmind/rn-shadow-generator

React Native Shadow Generator to quickly generate shadow of your components. Builded by .mind.io

Menu

🚀 Roadmap

  • Android full compatibility (shadowOffset support)

🔍 Preview

preview

💻 Installation

yarn add @dotmind/rn-shadow-generator

or

npm i @dotmind/rn-shadow-generator --save

👷‍♂️ How it's work

ShadowView usage

import { ShadowView } from '@dotmind/rn-shadow-generator';

const BasicComponent = () => {
  return (
    <ShadowView>
      <Text>My Shadow View</Text>
    </ShadowView>
  );
}

const MyCustomComponent = () => {
  return (
    <ShadowView level={4} shadowColor={'#000'} direction={'bottom'}>
      <Text>My Shadow View</Text>
    </ShadowView>
  );
}

propsdescriptionrequireddefault value
levelIncrease shadow dimensionsfalse4
shadowColorChange shadowColor style attributefalse#000
directionChange shadow directionfalsebottom

generateShadow usage

Returns a full shadow object depending on OS (iOS or Android).

import { generateShadow } from '@dotmind/rn-shadow-generator';

const BasicComponent = () => {
  return (
    <View style={{ ...generateShadow() }}>
      <Text>My Shadow View</Text>
    </View>
  );
}

const MyCustomComponent = () => {
  return (
    <View style={{ ...generateShadow({ level: 4, shadowColor: '#000', direction: 'bottom' }) }}>
      <Text>My Shadow View</Text>
    </View>
  );
}

attributesdescriptionrequireddefault value
levelIncrease shadow dimensionsfalse4
shadowColorChange shadowColor style attributefalse#000
directionChange shadow directionfalsebottom

Object returned

{
  ...Platform.select({
    ios: {
      shadowColor,
      shadowOffset,
      shadowOpacity,
      shadowRadius,
    },
    android: {
      shadowColor,
      elevation: level,
    },
  }),
}

🧪 Example app

To see full app integration example please refer to here.

⚠️ To run the app please run here yarn build that the @dotmind/rn-shadow-generator npm package be able to link itselfs.

⚡️ Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

🔐 License

MIT

Keywords

FAQs

Last updated on 20 Apr 2021

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc