react-native - 如何在 react-native-paper 中更改按钮的波纹颜色
问题描述
我正在为我的应用程序使用Button组件。react-native-paper
我通过背景设置了一些值。如何更改触摸时出现的波纹颜色。
我的按钮组件
<Button
mode="contained"
style={styles.button}
labelStyle={styles.buttonLabel}
uppercase={false}
onPress={() => {}}
>
Click Here
</Button>
使用的样式
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
}
解决方案
工作示例:世博小吃
您可以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;
推荐阅读
- javascript - 居中 Facebook“发送到 Messenger”按钮和文本
- assembly - 如何将标签推送到可重定位共享库中的堆栈中,其对象应使用-fPIC编译?
- c - 我的 sscanf 格式有什么问题
- html - iFrame 中的 Base 64 PDF 数据 URL 未在移动设备上显示
- apache-nifi - NiFi 键值对文本到 json/avro
- wordpress - WordPress 音频播放器停止视频背景
- php - 如何在没有等待响应的情况下重复 PHP
- perl - Mojo 用户代理,创建连接池
- symfony - Symfony2 查询以显示今天发生的事件,然后是其余的 DESC 顺序
- java - 基于文件内容的 AspectJ 切入点动态字符串值