React native 的弹出层(输入)效果

/*弹出层测试*/
import React,{Component} from ‘react‘;
import {
  StyleSheet,
  View,
  Image,
  Text,
  TouchableOpacity,
  ScrollView,
  Navigator,
  Alert, //引入Alert组件
  TouchableHighlight,
  AlertIOS  //引入AlertIOS组件
} from ‘react-native‘;
//创建一个组件
class CustomButton extends Component {
  render() {
    return (
      <TouchableHighlight
        style={styles.button}
        underlayColor="red"   //触摸的时候颜色改变
        onPress={this.props.onPress}>  //当前触发时间
        <Text style={styles.buttonText}>{this.props.text}</Text>
      </TouchableHighlight>
    );
  }
}
//默认输出组件
export default class AlertDemo extends Component {
  render() {
    return (
      <View style={styles.container}>
        <Text style={{height:30,color:‘black‘,margin:8}}>
          弹出框实例
        </Text>
        //触发事件
        <CustomButton text=‘点击弹出默认Alert‘
          onPress={()=>Alert.alert(‘温馨提醒‘,‘确定退出吗?‘)}
          />
        <CustomButton text=‘点击弹出两个按钮的Alert‘
          onPress={()=>Alert.alert(‘温馨提醒‘,‘确定退出吗?‘,[
            {text:‘取消‘},
            {text:‘确定‘,}
            ])}
          />
        <CustomButton text=‘点击弹出三个按钮的Alert‘
          onPress={()=>AlertIOS.alert(‘温馨提醒‘,‘确定退出吗?‘,[
            {text:‘One‘},
            {text:‘Two‘},
            {text:‘Two‘},
            {text:‘Two‘},
            {text:‘Two‘},
            {text:‘Two‘},
            {text:‘Two‘},
            {text:‘Two‘},
            {text:‘Two‘},
            {text:‘Two‘},
            {text:‘Two‘},
            {text:‘Two‘},
            ])}
          />
          <CustomButton text=‘点击出现输入框‘
            onPress={()=>AlertIOS.prompt(‘温馨提醒‘,‘确定退出吗?‘,[
              {text:‘取消‘},
              {text:‘确定‘,}
              ])}
            />

      </View>
    );
  }
}

var styles = StyleSheet.create({
  container:{
    backgroundColor:"#fff",
    flex:1,
    marginTop:65,
},
button: {
  margin:5,
  backgroundColor: ‘white‘,
  padding: 15,
  borderBottomWidth: StyleSheet.hairlineWidth,
  borderBottomColor: ‘#cdcdcd‘,
}

})

  

时间: 2024-08-03 09:47:11

React native 的弹出层(输入)效果的相关文章

React native 的弹出层组件使用

组件名称:Alert.AlertIOS  具体代码如下 /*弹出层测试*/ import React,{Component} from 'react'; import {   StyleSheet,   View,   Image,   Text,   TouchableOpacity,   ScrollView,   Navigator,   Alert, //引入Alert组件   TouchableHighlight,   AlertIOS  //引入AlertIOS组件 } from '

html+javascript实现可拖动可提交的弹出层对话框效果

本文为大家介绍下使用html+javascript实现可拖动弹出层.对话框.可提交,具体代码如下,感兴趣的朋友可以参考下,希望对大家有所帮助 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd"> <html xmlns="http://www.w3

div弹出层的效果带关闭按钮

下面我做的这个是个进度条的弹出层 <style type="text/css"> #tuxiang { width: 57px; } /*div弹出框的css*/ .tcck { width: 440px; height: 132px; border: 1px solid #6E665A; border-radius: 5px; background: #fff; padding-top: 10px; position: absolute; z-index: 9999999

React native 无法弹出调试控件的问题

React Native 在debug模式下,可以通过摇动手机,弹出调试选项.但是今天利用了cocoapods 把react native 文件整理后,调试界面就弹不出了,其他功能正常.查了好久,发现是少在pods的 spec里写了DevSupport 这个模块. 下面发一份pods 的 spec 文件作为参考: # Uncomment the next line to define a global platform for your project platform :ios, '8.0'

react学习之弹出层

原文地址:https://www.cnblogs.com/yuyuan-bb/p/10980834.html

Javascript实现页面弹出层效果

弹出层效果是一个很实用的功能,很多网站都采用了这种方式实现登录和注册,比如百度: 弹出层的特点:点击登录或注册的时候在页面的中间部分弹出一个登录或注册区域并且页面有一个遮罩层,而且登录框在遮罩层之上,也就是登陆框的z-index值要大于遮罩层的z-index值.当点击关闭或者遮罩层时关闭登录或者注册框(有的网页没有实现点击遮罩层关闭登录或注册区域的功能.). 最近也做了一个类似的弹出层的效果,先展示一下最终效果: 简单的说一下实现的过程. 首先是遮罩层.遮罩层是在页面动态加载的过程中创建的,因为

asp.net中获取Layer弹出层返回值

1.MainPage.aspx中点击按钮利用Layer弹出层,代码如下: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MainPage.aspx.cs" Inherits="demo.MainPage" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xh

React练习 10:弹出层效果

需求:点击按钮后弹出一个遮罩.点击 X 后关闭. import React,{useState,useEffect} from 'react'; import ReactDOM from 'react-dom'; import './index.css'; function Overlay(){ const [isShow,setShow]=useState(false); return( <> <div id="overlay" className={isShow

求出数组中所有数字的和&amp;&amp;弹出层效果

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-