Skip to content

line64/react-native-coin-slot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React Native Coin Slot

##A React Native component that simulates a coin slot

How to use:

  • First you need to install the module by npm
    npm install react-native-coin-slot --save
  • Then import module
    import { CoinSlot } from 'react-native-coin-slot';
  • Now you can use the component like this <CoinSlot />

#Example

import React, { Component } from 'react';
import {
  AppRegistry,
  Text,
  View
} from 'react-native';

import { CoinSlot } from 'react-native-coin-slot';

export default class flipCoin extends Component {
  constructor(props){
    super(props);
    this.state = {
      coins : 0
    }
  }
  render() {
    return (
      <View>
        <Text> Coins: { this.state.coins } </Text>
        <CoinSlot 
          disabled={ this.state.coins > 9 }
          onCoinDrop={ ()=> this.setState({ coins :  this.state.coins + 1 })  } />
      </View>
    );
  }
}

AppRegistry.registerComponent('flipCoin', () => flipCoin);

About

A React Native component that simulates a coin slot

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published