美文网首页react native
react-native常用插件

react-native常用插件

作者: 进击韭菜 | 来源:发表于2020-09-03 16:07 被阅读0次

1. tab切换   (react-navigation5.x问题总结

顶部tab切换:npm install @react-navigation/material-top-tabs react-native-tab-view

2.shadow阴影

react-native-shadow

npm install react-native-shadow --save

import { BoxShadow }from 'react-native-shadow';

let shadowSetting = {

    width: 170,

    height: 132,

    color:'#455A64',

    border:10,

    radius:scaleSizeW(12),

    opacity:0.1,

    x:0,

    y:1

};

<BoxShadow setting={shadowSetting}>...</BoxShadow >

3. 渐变色

react-native-linear-gradient

npm install react-native-linear-gradient --save

import LinearGradientfrom 'react-native-linear-gradient';

// 例:从左到右渐变(start、end,值0 ~ 1 ,不写默认从上到下)

// 红色0~10%,绿色10%~40%,黑色40%~70%,黄色70%~100%

<LinearGradient

    start={{x: 0, y: 0}}

    end={{x: 1, y: 0}}

    locations={[0.1, 0.4, 0.7, 1.0]}

    colors={['red', 'green', 'black', ;yellow']}

    style={styles.linearBox}

>...</LinearGradient>

相关文章

网友评论

    本文标题:react-native常用插件

    本文链接:https://www.haomeiwen.com/subject/ixhosktx.html