1.0.8 • Published 7 years ago

react-native-lyhud v1.0.8

Weekly downloads
13
License
ISC
Repository
-
Last release
7 years ago

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

PropsTypeOptionalDefaultDescription
styleView.propTypes.styletrue{backgroundColor: 'black',opacity: OPACITY,borderRadius: 5,padding: 10,}Custom style hud
positionValueReact.PropTypes.numbertrue0Custom hud position marginTop
fadeInDurationReact.PropTypes.numbertrue500Custom hud show duration
fadeOutDurationReact.PropTypes.numbertrue500Custom hud close duration
opacityReact.PropTypes.numbertrue1Custom hud opacity
textStyleView.propTypes.styletrue{color:'white'}Custom style text
sourceImage.propTypes.sourcetruenullCustom image source
textOnlyReact.PropTypes.booltruefalseOnly show text
hudType'info','success','error'truenullhud Type
imageStyleImage.propTypes.styletrue{tintColor: 'white'}Custom Image style
backgroundTouchableReact.PropTypes.booltruetruebackgroundTouchable
MethodTypeOptionalDescription
show(text)functionfalseshow hud with text
close()function-close hud
1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago