GithubHelp home page GithubHelp logo

oliversisson / react-native-lyhud Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lxooxl/react-native-lyhud

0.0 2.0 0.0 199 KB

A react native module to show hud, it works on iOS and Android.

JavaScript 100.00%

react-native-lyhud's Introduction

react-native-lyhud

A react native module to show hud, it works on iOS and Android.

This is base on react-native-easy-toast

Installation

  • 1.Run npm i react-native-lyhud --save
  • 2.import Hud from 'react-native-lyhud'

GIF

image

Getting started

Add react-native-lyhud to your js file.

import Hud from 'react-native-lyhud'

Inside your component's render method, use hud:

 render() {
         return (
             <View style={styles.container}>
                 ...
                 <Hud ref="hud"/>
             </View>
         );
 }

Note: Add it in the bottom of the root view.

Then you can use it like this:

 this.refs.hud.show('hello world!');

Basic usage

render() {
        return (
            <View style={styles.container}>
                <TouchableHighlight
                    style={{padding: 10}}
                    onPress={()=>{
                        this.refs.hud.show('hello world!');
                    }}>
                    <Text>Press me</Text>
                </TouchableHighlight>
                <Hud ref="hud"/>
            </View>
        );
    }

API

Props Type Optional Default Description
style View.propTypes.style true {backgroundColor: 'black',opacity: OPACITY,borderRadius: 5,padding: 10,} Custom style hud
positionValue React.PropTypes.number true 0 Custom hud position marginTop
fadeInDuration React.PropTypes.number true 500 Custom hud show duration
fadeOutDuration React.PropTypes.number true 500 Custom hud close duration
opacity React.PropTypes.number true 1 Custom hud opacity
textStyle View.propTypes.style true {color:'white'} Custom style text
source Image.propTypes.source true null Custom image source
textOnly React.PropTypes.bool true false Only show text
hudType 'info','success','error' true null hud Type
imageStyle Image.propTypes.style true {tintColor: 'white'} Custom Image style
backgroundTouchable React.PropTypes.bool true true backgroundTouchable

Method | Type | Optional | Description ----------------- | -------- | -------- | ----------- | ----------- show(text) | function | false | show hud with text close() | function | - | close hud

react-native-lyhud's People

Contributors

lxooxl avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.