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的更多相关文章

  1. 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 ...

  2. UIImageWriteToSavedPhotosAlbum

    UIImageWriteToSavedPhotosAlbum: Next UIKit Function Reference Overview The UIKit framework defines a ...

  3. 【IOS笔记】About Events in iOS

    About Events in iOS Users manipulate their iOS devices in a number of ways, such as touching the scr ...

  4. iOS苹果官方Demo合集

    Mirror of Apple’s iOS samples This repository mirrors Apple’s iOS samples. Name Topic Framework Desc ...

  5. 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 ...

  6. Event Handling Guide for iOS--(二)---Gesture Recognizers

    Gesture Recognizers 手势识别器 Gesture recognizers convert low-level event handling code into higher-leve ...

  7. 移动端事件对象touches的误区

    不想长篇大论,也是自己遗留下的一个错误的理解 在移动端触屏事件有四个 // 手势事件 touchstart //当手指接触屏幕时触发 touchmove //当已经接触屏幕的手指开始移动后触发 tou ...

  8. touch事件中的touches、targetTouches和changedTouches详解

    touches: 当前屏幕上所有触摸点的列表; targetTouches: 当前对象上所有触摸点的列表; changedTouches: 涉及当前(引发)事件的触摸点的列表 通过一个例子来区分一下触 ...

  9. touches 事件捕获不到

    在UIView上加载了一个UIScrollView(全屏),touches 事件捕获不到了 原因:UIView的touch事件被UIScrollView捕获了,无法传递下去 解决方法:写一个UIScr ...

随机推荐

  1. 密码机制(PGP)

    01 PGP概念 02 PGP认证加密体系

  2. python函数进阶(函数参数、返回值、递归函数)

    函数进阶 目标 函数参数和返回值的作用 函数的返回值 进阶 函数的参数 进阶 递归函数 01. 函数参数和返回值的作用 函数根据 有没有参数 以及 有没有返回值,可以 相互组合,一共有 4 种 组合形 ...

  3. Codeforces Round #207 (Div. 1) A. Knight Tournament (线段树离线)

    题目:http://codeforces.com/problemset/problem/356/A 题意:首先给你n,m,代表有n个人还有m次描述,下面m行,每行l,r,x,代表l到r这个区间都被x所 ...

  4. SVN 的搭建及使用(一)下载和搭建SVN服务器

    (本文是从博客园上的文章改编而来,其中有些关于版本问题的截图是直接引用原文的,与当前版本有可能不同) Subversion是优秀的版本控制工具,其具体的的优点和详细介绍,这里就不再多说. 首先来下载和 ...

  5. wpf UI 元素类型

  6. 基于Verilog的串口接收程序

    一.模块框图及基本思路 detect_module:检测输入引脚的下降沿,以此判断一帧数据的开始 rx_bps_module:波特率时钟产生模块 rx_control_module:串口接收的核心控制 ...

  7. AlwaysOn环境下的压缩Log文件方法

    Step1.将DB脱离可用性组 Step2.修改为简单恢复模式>收缩文件>修改回完整恢复模式 -- Truncate the log by changing the database re ...

  8. 未能加载或程序集“XXXX,Version=0.0.0.0,Culter=neutral,PublicKeyToken=null”或它的某一个依赖项。试图加载格式不正确的程序。

    问题描述:在VS中运行一个C#程序,出现错误: 未能加载或程序集“XXXX,Version=0.0.0.0,Culter=neutral,PublicKeyToken=null”或它的某一个依赖项.试 ...

  9. Error: No EPCS layout data - looking for section [EPCS-C84018]

    /********************************************************************** * Error: No EPCS layout data ...

  10. 《Linux内核原理与分析》第九周作业

    课本:第八章 进程的切换和系统的一般执行过程 进行进程调度的时机 Linux内核通过schedule函数实现进程调度,schedule函数在运行队列中找到一个进程,把CPU分配给它 调用schedul ...