当前位置: 首页 > news >正文

网站流量统计怎么做的东莞软件有限公司

网站流量统计怎么做的,东莞软件有限公司,广州最好的网站建设,一个工程项目的整个流程在 React Native 中要实现可触摸的组件方式有三种,第一种方式就是使用TouchableHighlight组件,第二种方式就是使用TouchableOpacity组件,最后一种方式就是使用TouchableWithoutFeedback组件。 TouchableHighlight TouchableHighlight组件主…

在 React Native 中要实现可触摸的组件方式有三种,第一种方式就是使用TouchableHighlight组件,第二种方式就是使用TouchableOpacity组件,最后一种方式就是使用TouchableWithoutFeedback组件。

TouchableHighlight

TouchableHighlight组件主要是响应触摸的组件。当用户按下此组件时,此组件的亮度会变成高亮显示(由透明改为不透明),从而让用户感知到进行了交互。TouchableHighlight假如不设置underlayColor属性的话,underlayColor 的默认值为黑色。假如此组件的子元素也有样式的话,可能会发生颜色重叠导致一些问题。

TouchableHighlight组件必须有一个子级(不能为零个或多个)。如果您希望有多个子组件,请将它们包装在视图中。具体实例如下:

import { StyleSheet, Text, TouchableHighlight, View } from "react-native";
import React, { useState } from "react";export default function TouchComponent() {const [count, setCount] = useState<number>(0);return (<View style={styles.container}><Text style={styles.mainTitle}>触摸组件实例</Text><TouchableHighlightactiveOpacity={0.4}underlayColor="#DDDDDD"onPress={() => setCount(count + 1)}><View style={styles.button}><Text>点击加1</Text></View></TouchableHighlight><Text>{count}</Text></View>);
}const styles = StyleSheet.create({container: {margin: 8,},mainTitle: {fontSize: 22,fontWeight: "bold",padding: 10,borderBottomWidth: 1,borderColor: "#e3e3e3",},button: {alignItems: "center",backgroundColor: "#DDDDDD",padding: 10,},
});

TouchableOpacity

TouchableOpacity组件跟TouchableHighlight的作用一致,此组件的透明度会发生改变(由不透明改为透明),从而能让用户感知到进行了交互。假如此组件的子元素也有样式的话,可能会发生颜色重叠导致一些问题。

通过将子组件包装在 Animated.View 中(添加到视图层次结构中)来控制不透明度。请注意,这可能会影响布局。具体的实例如下:

import {StyleSheet,Text,TouchableHighlight,TouchableOpacity,View,
} from "react-native";
import React, { useState } from "react";export default function TouchComponent() {const [count, setCount] = useState<number>(0);return (<View style={styles.container}><Text style={styles.mainTitle}>触摸组件实例</Text><TouchableOpacity onPress={() => setCount(count + 1)}><Text style={styles.button}>点击加1</Text></TouchableOpacity><Text>{count}</Text></View>);
}const styles = StyleSheet.create({container: {margin: 8,},mainTitle: {fontSize: 22,fontWeight: "bold",padding: 10,borderBottomWidth: 1,borderColor: "#e3e3e3",},button: {alignItems: "center",backgroundColor: "#DDDDDD",padding: 10,},
});

TouchableWithoutFeedback

TouchableWithoutFeedback此组件是不会发生任何视觉反馈信息的。TouchableWithoutFeedback 仅支持一个孩子。如果您希望有多个子组件,请将它们包装在视图中。重要的是,TouchableWithoutFeedback 的工作原理是克隆其子级并向其应用响应者道具。因此,任何中间组件都需要通过这些 props 传递给底层的 React Native 组件。

import {StyleSheet,Text,TouchableHighlight,TouchableOpacity,TouchableWithoutFeedback,View,
} from "react-native";
import React, { useState } from "react";export default function TouchComponent() {const [count, setCount] = useState<number>(0);return (<View style={styles.container}><Text style={styles.mainTitle}>触摸组件实例</Text><TouchableWithoutFeedback onPress={() => setCount(count + 1)}><View style={styles.button}><Text>点击加1</Text></View></TouchableWithoutFeedback><Text>{count}</Text></View>);
}const styles = StyleSheet.create({container: {margin: 8,},mainTitle: {fontSize: 22,fontWeight: "bold",padding: 10,borderBottomWidth: 1,borderColor: "#e3e3e3",},button: {alignItems: "center",backgroundColor: "#DDDDDD",padding: 10,},
});
http://www.yayakq.cn/news/163139/

相关文章:

  • 网站建设心得感想如何用python做一个网站
  • 成都网站排名优化开发seo神马网站推广器
  • 长沙企业官方网站建设地推项目平台
  • 湛江怎么做网站关键词优化怎样下载建设银行信用卡网站
  • 企业自建网站 备案微信微网站开发报价单
  • dw和vs做网站制作网页常用的软件有哪些
  • 湖州建设企业网站手机设计软件门窗
  • 长沙网站开发制作长沙楼市最新消息
  • h5响应式网站模板云主机建网站
  • 专业的网站制作开发公司南阳哪里做网站
  • 自己建设网站引流制作头像的软件
  • 高端网站设计平台济南建设工程业绩公示的网站
  • 在线设计软件关键词seo是什么意思
  • 优良网站山东省市场监督管理局
  • 建立网站解析会员视频是犯什么罪uiapp界面设计模板
  • 博客移动端网站模板旅游论坛网站建设
  • 网站开发一个模板费用下载手机软件的app
  • 蚌埠做网站的公司学院网站建设建议
  • 关于网站建设培训临夏州建设银行网站
  • 杭州富阳网站建设87网站建设工作室
  • 哪个电商平台最好seo值怎么提高
  • 郑州做网站建设公司建设网站怎么做
  • 专业外贸网站wordpress主题手机版
  • 广州网站建设公司哪个好行情宝app下载
  • 东阳网站建设方案wordpress自媒体二号
  • 研究生院 网站 建设重庆seo网站管理
  • 拓展培训东莞网站建设网站建设策划书色彩设计方案
  • 天津做app和网站的公司建设网站有哪些目的
  • 免费的舆情网站app下载app软件开发的费用设计
  • 电商网站维护做网站有什么比较好看的动效