1. tab切换 (react-navigation5.x问题总结)
顶部tab切换:npm install @react-navigation/material-top-tabs react-native-tab-view
2.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. 渐变色
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>
网友评论