GithubHelp home page GithubHelp logo

react-native-hud-view's Introduction

react-native-hud-view

HudView is a React Native Component for showing HUDs. HudView is based on react-native-vector-icons but can also be used with custom components.

Supports the following vector icons:

  • Ionicons
  • Entypo
  • EvilIcons
  • FontAwesome
  • MaterialIcons
  • Octicons
  • Zocial
  • Foundation

Props

Name Type Default
fadeDuration Number 700
hudBackgroundColor String #000000
hudOpacity Number 0.8
hudWidth Number 80
hudHeight Number 80
hudBorderRadius Number 5
hudAdditionalStyles Object {}
iconSize Number 42
iconColor Number #FFFFFF
isVisible Boolean false
type String (success, error, customComponent, customIcon, spinner) success
successComponent React Native Component react-native-vector-icons FontAwesome check icon
errorComponent React Native Component react-native-vector-icons FontAwesome exclamation-triangle icon
spinnerComponent React Native Component react-native-vector-icons FontAwesome circle-o-notch icon

Methods

Methods Args Values
showSpinner None
showSuccess None
showError None
showCustomIcon setName, iconName, rotate, hideOnCompletion
showCustomComponent component, rotate, hideOnCompletion
show type (default: spinner) success, error, customComponent, customIcon, spinner
hide None

Method Args

Name Type Default Alternatives
setName String fontawesome ionicons, entypo, evilicons, fontawesome, materialicons, octicons, zocial, foundation
iconName String null See font icon documentation
rotate Boolean false true/false
hideOnCompletion Boolean true true/false
component React Native Component null N/A

Example of usage

render() {
  return(<HudView ref="hudView">
  </HudView>)
}

#####Show Spinner HUD

this.refs.hudView.showSpinner()

#####Hide HUD

this.refs.hudView.hide()

#####Show Error HUD

this.refs.hudView.showError()

#####Show Custom Icon HUD

this.refs.hudView.showCustomIcon('ionicons', 'star')

#####Show Custom Icon HUD as Spinner

this.refs.hudView.showCustomIcon('ionicons', 'star', true, false)

#####Show custom component HUD

var customComponent = (<Text style={{color: "#ffffff"}}>Loading</Text>)
this.refs.hudView.showCustomComponent(customComponent)

#####Show custom component HUD as spinner

var customComponent = (<Text style={{color: "#ffffff"}}>Spinning</Text>)
this.refs.hudView.showCustomComponent(customComponent, true, false)

#####Do something on HUD completion All methods returns a promise if hideOnCompletion is set to true.

hudView.showSuccess().then(() => {
  alert("Success view did complete.")
})

Example of usage with a declarative API

render() {
  return(<HudView isVisible={this.state.isHudVisible} type={this.state.hudType}>
  </HudView>)
}

react-native-hud-view's People

Contributors

paulwcy avatar rafauke 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.