LDO*_*DOB 5 react-native react-native-paper
我正在为我的应用程序使用Button组件react-native-paper。我按背景设置为某个值。如何更改触摸时出现的波纹颜色。
我的按钮组件
<Button
mode="contained"
style={styles.button}
labelStyle={styles.buttonLabel}
uppercase={false}
onPress={() => {}}
>
Click Here
</Button>
Run Code Online (Sandbox Code Playgroud)
使用的样式
button: {
marginTop: 30,
backgroundColor: Colors.BRIGHT_YELLOW,
padding: 5,
borderRadius: 10
},
buttonLabel: {
fontFamily: FONT_FAMILY.POPPINS_MEDIUM,
fontSize: FONT_SIZE[18],
color: Colors.PURE_WHITE
}
Run Code Online (Sandbox Code Playgroud)
工作示例:世博小吃
您可以使用TouchableRipple:
import * as React from 'react';
import { View } from 'react-native';
import { Text, TouchableRipple } from 'react-native-paper';
const MyComponent = () => (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<TouchableRipple
onPress={() => console.log('Pressed')}
rippleColor="rgba(255,0,0, 1)"
style={{ backgroundColor: 'grey', padding: 10, borderRadius: 5 }}>
<Text>Press anywhere</Text>
</TouchableRipple>
</View>
);
export default MyComponent;
Run Code Online (Sandbox Code Playgroud)
文档:可触摸的波纹
| 归档时间: |
|
| 查看次数: |
4888 次 |
| 最近记录: |