1.0.2 • Published 5 years ago

react-native-hype-card v1.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

Hype Card with gradient for react native 🔥

npm Platform - Android and iOS License: MIT styled with prettier

Screenshot

Installation

$ npm i --save react-native-hype-card

Peer Dependencies

IMPORTANT! You need install them.
"react-native-linear-gradient": "^2.5.4",

Basic Usage

import { HypeCard } from 'react-native-hype-card'

<HypeCard />

Advanced Usage

You can check the example for the advanced usage

import { HypeCard } from 'react-native-hype-card'

<HypeCard
  key={id}
  style={{ margin: 10 }}
  leftComponent={<UserAvatar size="50" name="Peliharaan" />}
  title="Peliharaan"
  subtitle="Cat food"
  centerTitle="22-08-2019"
  centerSubtitle="400.000"
  centerSubtitleStyle={{
    fontSize: 12,
    marginLeft: 8,
    textAlign: "center",
    color: "white"
  }}
  gradientColors={
    type_id == 1
      ? ["#70a1ff", "#5352ed", "#3742fa"]
      : ["#ff7675", "#ff6b81", "#ff4757"]
  }
  onPress={() => // do what you want}
/>

Configuration - Props

PropertyTypeDefaultDescription
start{x,y}{ x: 0, y: 0 }change the direction of the gradient
end{x,y}{ x: 1, y: 0 }change the direction of the gradient
gradientColorscolorcheck the examplechange the gradient's color array
stylestylenulladd any style to the whole container
shadowStylestylecheck the exampleset your own shadow style
shadowColorcolor#595959change the shadow color
outerContainerstylestyleset your own outer container style (NOT recommended!)
heightnumber70change the card's height
widthnumberdevice width * 0.95change the card's width
borderRadiusnumber20change the card's border radius
innerContainerstylestyleset your own inner container style (NOT recommended!)
leftComponentcomponentnullset your own component
titlestringnullchange the title string with your data
subtitlestringnullchange the subtitle string with your data
centerTitlestringnullchange the center title string with your data
centerSubtitlestringnullchange the center subtitle string with your data
titleStylestylestyleset your own style for title component
subtitleStylestylestyleset your own style for subtitle component
centerTitleStylestylestyleset your own style for center title component
centerSubtitleStylestylestyleset your own style for center subtitle component
centerComponentcomponenttext based componentset your component for the center part
rightComponentcomponentnullset your own component for the right component

Author

NicoAudy, nicoaudy1994@gmail.com

License

React Native Hype Card Library is available under the MIT license. See the LICENSE file for more info.