Handling Touches - RN3
1. basic button
format:
<tag event caption />
<Button
onPress={{}}
title="I am button"
/>
<Button
onPress={() => {
Alert.alert("You are Right!");
}}
title="Push me"
/>
Usage:
(1) import
import {Button, Alert} from "react-native";
(2) src
import React from 'react';
import { StyleSheet, Text, View, Button, Alert } from 'react-native'; export default class App extends React.Component {
render() {
return (
<View style={styles.container}>
<Text>Open up App.js to start working on your app!</Text>
<Button
onPress={() => {
Alert.alert("You are Right!");
}}
title="Push me"
/>
</View>
);
}
} const styles = StyleSheet.create({
container: {
flex: ,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
2. Actual button
format:
<tag event caption />
<TouchableHighlight event>
<View>
<Text>caption</Text>
</View>
</TouchableHighlight>
for example:
<TouchableHighlight onPress={this._onPressButton} underlayColor="white">
<View style={styles.button}>
<Text style={styles.buttonText}>I am a rounded button</Text>
</View>
</TouchableHighlight>
Usage:
(1) import
import {Platform, TouchableHightlight} from "react-native"
(2) src
import React from 'react';
import { StyleSheet, Text, View, Platform, TouchableHighlight, Alert } from 'react-native'; export default class App extends React.Component {
_onPressButton() {
Alert.alert('You tapped the button!')
} render() {
return (
<View style={styles.container}>
<TouchableHighlight onPress={this._onPressButton} underlayColor="white">
<View style={styles.button}>
<Text style={styles.buttonText}>I am a rounded button</Text>
</View>
</TouchableHighlight>
</View>
);
}
} const styles = StyleSheet.create({
container: {
paddingTop: ,
alignItems: 'center'
},
button: {
marginBottom: ,
width: ,
alignItems: 'center',
backgroundColor: '#2196F3',
borderRadius:
},
buttonText: {
padding: ,
color: 'white'
}
});
Reference:
1. Handling Touches - Displaying a basic button
2. Handling Touches - Touchables
Handling Touches - RN3的更多相关文章
- Event Handling Guide for iOS--(一)--About Events in iOS
About Events in iOS Users manipulate their iOS devices in a number of ways, such as touching the scr ...
- UIImageWriteToSavedPhotosAlbum
UIImageWriteToSavedPhotosAlbum: Next UIKit Function Reference Overview The UIKit framework defines a ...
- 【IOS笔记】About Events in iOS
About Events in iOS Users manipulate their iOS devices in a number of ways, such as touching the scr ...
- iOS苹果官方Demo合集
Mirror of Apple’s iOS samples This repository mirrors Apple’s iOS samples. Name Topic Framework Desc ...
- Event Handling Guide for iOS--(三)---Event Delivery: The Responder Chain
Event Delivery: The Responder Chain 事件传递:响应链 When you design your app, it’s likely that you want to ...
- Event Handling Guide for iOS--(二)---Gesture Recognizers
Gesture Recognizers 手势识别器 Gesture recognizers convert low-level event handling code into higher-leve ...
- 移动端事件对象touches的误区
不想长篇大论,也是自己遗留下的一个错误的理解 在移动端触屏事件有四个 // 手势事件 touchstart //当手指接触屏幕时触发 touchmove //当已经接触屏幕的手指开始移动后触发 tou ...
- touch事件中的touches、targetTouches和changedTouches详解
touches: 当前屏幕上所有触摸点的列表; targetTouches: 当前对象上所有触摸点的列表; changedTouches: 涉及当前(引发)事件的触摸点的列表 通过一个例子来区分一下触 ...
- touches 事件捕获不到
在UIView上加载了一个UIScrollView(全屏),touches 事件捕获不到了 原因:UIView的touch事件被UIScrollView捕获了,无法传递下去 解决方法:写一个UIScr ...
随机推荐
- Win10系列:C#应用控件基础18
WebView控件 使用WebView控件可以在应用中添加一个简易的网页浏览器窗口,将指定地址的网页内容显示出来,并可以通过WebView控件所提供的方法.属性及事件,实现如页面导航.HTML文本解析 ...
- 各大型网站架构分析收集-原网址http://blog.csdn.net/lovingprince/article/details/3379710
1. PlentyOfFish 网站架构学习http://www.dbanotes.net/arch/plentyoffish_arch.html 采取 Windows 技术路线的 Web 2.0 站 ...
- String.valueOf() ,其他类型转为字符型
1. 由 基本数据型态转换成 String String 类别中已经提供了将基本数据型态转换成 String 的 static 方法 也就是 String.valueOf() 这个参数多载的方法 有下 ...
- FS:[0] 链条
0x01 用户态 在x86系统中,当线程在用户态执行时,段寄存器fs总是指向当前线程的TEB. 在Ntdll中有一个未公开的函数NtCurrentTeb() ,用来取得当前线程的TEB地址.FS:[ ...
- UI自动化selenium
1.什么是UI自动化?模拟人用代码的方式去操作页面2.为什么要做UI自动化?后期迭代的时候,老功能比较多,人工维护成本较大,重复性工作较多,这个时候就考虑因为UI自动化3.什么时候做UI自动化?项目稳 ...
- JS类小功能
工作中,总是要处理一些前端的小功能.都是网上搜的JS脚本 <script> //防止页面后退 history.pushState(null, null, document.URL); wi ...
- 18-09-20 关于Excel 表格重复问题解决示例
代码实现:b=a.drop_duplicates(subset=None, keep='first', inplace=False) Excel 去除重复项 在测试过程中,会经常遇到多张表格筛选比对的 ...
- 集群容器管理之swarm ---集群部署
集群部署及节点管理 使用swarm前提: Docker版本1.12+ 集群节点之间保证TCP 2377.TCP/UDP 7946和UDP 4789端口通信 节点规划: 操作系统:centos7.4.1 ...
- JAVA基础部分复习(七、JAVA枚举类型使用)
/** * java中的枚举 * 枚举(enum),是指一个经过排序的.被打包成一个单一实体的项列表.一个枚举的实例可以使用枚举项列表中任意单一项的值. * 枚举在各个语言当中都有着广泛的应用,通常用 ...
- 跨源资源共享(CORS)概念、实现(用Spring)、起源介绍
本文内容引用自: https://howtodoinjava.com/spring5/webmvc/spring-mvc-cors-configuration/ https://developer.m ...