npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-dialogs-master

v1.1.0

Published

This is a combination of the pop-up box confirmation react-native components for Android and Ios,you can customize the style and parameters for the component

Downloads

26

Readme

CommonDialog

This is a combination of the pop-up box confirmation react-native components for Android and Ios,you can customize the style and parameters for the component

react-native-dialogs-master

  • A react-native picker/selector component for both Android & iOS.

Features

  • Pure JS.
  • Pop up box and confirm the box together .
  • Custom pop-up box
  • Compatible with both iOS and Android.
  • Highly customizable.(You can change the style you want)
  • Controllable with API by code. (show/hide/valueChange)
  • Flexible change of content

Installation

  • npm i react-native-dialogs-master --save

Usage

Import this module:

  import CommonDialog from 'react-native-dialogs-master';

code

import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  Text,
  View,
  Image,
  ScrollView,
  TouchableHighlight
} from 'react-native';
import TimerMixin from 'react-timer-mixin'; 
import CommonDialog from './mineUI/product/commonDialog';
export default class DialogDemo extends Component { 
  constructor(props){
	 super(props); 
  }
  funAlert(){
	  var options={
		 thide:true,
         innersWidth:300,
         innersHeight:150,	
		 buttons:[
					 {
						txt:'知道了'
					 }
				 ]			 
	  }
	 this.refs.dAlert.show(options) 
  }
  funConfirm(){
	 var options={
		 thide:true, /*不显示头部标题*/
         messText:'投资前需开通第三方存管账户',
         buttons:[
			 {
				txt:'取消'
			 },
			 {
				txt:'确定'
			 }
		 ]				 
	  } 
	 this.refs.dConfirm.show(options) 
  }
  funcustomConfirm(){
	 var options={
		 title:'购买', /*不显示头部标题*/
		 headStyle:{backgroundColor:'#ff6600',color:'#ffffff',fontSize:24},
         messText:'投资前需开通第三方存管账户',
		 buttons:[
			 {
				txt:'暂不投资',
				btnStyle:{backgroundColor:'transparent'},
				txtStyle:{color:'#ff6600'},
				onpress:this.cancels.bind(this)
			 },
			 {
				txt:'立即投资',
				btnStyle:{backgroundColor:'#ff6600'},
				txtStyle:{color:'#ffffff'}, 
				onpress:this.cok.bind(this)
			 }
		 ]		 
	  } 
     this.refs.dcustomConfirm.show(options) 	  
  }
  cok(){
	alert("你点击了确定按钮!")  
  }
  cancels(){
	this.refs.dokAlert.show({
		headStyle:{backgroundColor:'#ff6600',color:'#ffffff',fontSize:24},
		messText:'确定取消投资吗?',
		buttons:[{txt:'确定',btnStyle:{backgroundColor:'transparent'},txtStyle:{color:'#ff6600'}}],
		innersWidth:300,
		innersHeight:150,
		}) 
  }
  funAutofade(){
	  var options={
		animationType:'none',
		title:'自定义组件',
        clickScreen:false		
	  }
	 this.refs.dAutofade.show(options) 
  }
  hides(){
	  this.refs.dAutofade.hide();
  }
  render() {
	 
    return (
       <View style={styles.container}>
	      <TouchableHighlight style={[styles.comBtnBtnView,{width:100}]} underlayColor='transparent' 
	                 onPress={this.funAlert.bind(this)}>  
			<Text style={[styles.comBtnText]}>alert</Text>  
		  </TouchableHighlight>
		  <TouchableHighlight style={[styles.comBtnBtnView,{width:100}]} underlayColor='transparent' 
		        onPress={this.funConfirm.bind(this)}>  
			<Text style={[styles.comBtnText]}>confirm</Text>  
		  </TouchableHighlight>
		  <TouchableHighlight style={[styles.comBtnBtnView,{width:100}]} underlayColor='transparent' 
		        onPress={this.funcustomConfirm.bind(this)}>  
			<Text style={[styles.comBtnText]}>customconfirm</Text>  
		  </TouchableHighlight>
		  <TouchableHighlight style={[styles.comBtnBtnView,{width:100}]} underlayColor='transparent' 
		         onPress={this.funAutofade.bind(this)}>  
			<Text style={[styles.comBtnText]}>Autofade</Text>  
		  </TouchableHighlight>
		  <CommonDialog types={'alert'} components={<DefineCon/>}   ref="dAlert" />
		  <CommonDialog types={'confirm'} ref="dConfirm" />
		  <CommonDialog  ref="dokAlert" />
		  <CommonDialog  ref="dcustomConfirm" />
		  <CommonDialog  ref="dAutofade"  components={<DefineCon2 onclick={this.hides.bind(this)}/>}  />
	   </View>
    );
  }
}
class DefineCon2 extends Component{
	mixins = [TimerMixin];
	constructor(props){
		super(props);
		this.timer=""; 
		this.state={
			times:3
		}
	}
	componentDidMount() {
		this.timer=setInterval(  
			() => {  
			
			  if(this.state.times<=1){
				clearInterval(this.timer)
                this.props.onclick()				
			  }else{
				  this.setState({times:this.state.times-1})
			  }  
			},  
			1000 
		  );
	}
	 componentWillUnmount() {
		 clearInterval(this.timer);
		
    }
	
	render(){
	    return(
		  <View style={[styles.conMid]}>
		      <View style={{flex:1,flexDirection:'column',padding:15,alignItems:'center',justifyContent:'center'}}>
			    <Text style={{flex:1,color:'#000000',textAlignVertical:'center'}}>支付成功,订单已提交审核!</Text>
				<Text style={{flex:1,fontSize:12,textAlignVertical:'center'}}>
				      即将关闭此窗口(<Text style={{color:'#ff0000'}}>{this.state.times}秒</Text>)
				 </Text>
			  </View> 
		  </View>
		)
	}
}
class DefineCon extends Component{
	constructor(props){
		super(props);
	}
	render(){
		return(
		  <View style={[styles.conMid]}>
		     <Image source={require('./mineUI/product/imgs/alert.png')} style={{width:32,height:32}} />
		     <Text style={[styles.tmid,{width:120,paddingLeft:15}]}>我是自定义内容</Text>
		  </View>
		)
	}
} 

Demo

Customization options

  • 'animateType': Change pop up block display animation ('fade','normal','slide') - The animationType prop controls how the modal animates. - slide: slides in from the bottom -fade: fades into view -none: appears without an animation
  • 'thide':(true|false) show or hide header
  • 'title': Custom header text
  • 'headStyle': Change the style of the dialogs header
  • 'innersWidth': Change the width of the dialogs
  • 'innersHeight':Change the height of the dialogs
  • 'clickScreen': (true|false) Transparent area can click
  • 'messText': Prompt text
  • 'buttons':Button group object
      buttons:[
			 {
				txt:'button text',     ---string
				btnStyle:{backgroundColor:'transparent'},  button style---object
				txtStyle:{color:'#ff6600'},    button text style           ---object
				onpress:this.cancels.bind(this) button click event          ---function
			 }
			 ...
            ]

Props

  • 'components': Custom middle context component

Methods

Method | Description ----------------- | ----------- show(options) | Show dialogs ( use the react-native Modal component to always be at the top) hide() | Hide dialogs