All Projects → atlanteh → React Native Slot Machine

atlanteh / React Native Slot Machine

Licence: mit
Text slot machine for react-native

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Native Slot Machine

App
Just a little analytics insight for your personal or indie project
Stars: ✭ 40 (-63.3%)
Mutual labels:  counter
React Native Modal Dropdown
A react-native dropdown/picker/selector component for both Android & iOS.
Stars: ✭ 1,103 (+911.93%)
Mutual labels:  react-native-component
Dipstick
Configurable metrics toolkit for Rust applications
Stars: ✭ 92 (-15.6%)
Mutual labels:  counter
React Native Circularprogress
A pure React Native Component for circular progress bars
Stars: ✭ 44 (-59.63%)
Mutual labels:  react-native-component
React Countup
💫 A configurable React component wrapper around CountUp.js
Stars: ✭ 1,063 (+875.23%)
Mutual labels:  counter
Xena
Lightweight, lighting-fast Java Based Cross-Platform CSGO Cheat
Stars: ✭ 69 (-36.7%)
Mutual labels:  counter
Madoka Python
Memory-efficient Count-Min Sketch Counter (based on Madoka C++ library)
Stars: ✭ 24 (-77.98%)
Mutual labels:  counter
Hit Counter
Easily count hits 📈 on a website by requesting a SVG displaying hit count 🎯
Stars: ✭ 103 (-5.5%)
Mutual labels:  counter
React Arkit
AR library for React-Native based on ARKit
Stars: ✭ 57 (-47.71%)
Mutual labels:  react-native-component
Social Links
Simple library to count shares and generate share buttons
Stars: ✭ 91 (-16.51%)
Mutual labels:  counter
Inferno Most Fp Demo
A demo for the ReactJS Tampa Bay meetup showing how to build a React+Redux-like architecture from scratch using Inferno, Most.js, reactive programmning, and various functional programming tools & techniques
Stars: ✭ 45 (-58.72%)
Mutual labels:  counter
React Native Hide Show Password Input
React-Native Hide Show Password InputText Component
Stars: ✭ 50 (-54.13%)
Mutual labels:  react-native-component
React Native Ios Context Menu
A react-native component to use context menu's (UIMenu) on iOS 13/14+
Stars: ✭ 80 (-26.61%)
Mutual labels:  react-native-component
Omg Counters
😍 Increment decrement counters using various frontend frameworks.
Stars: ✭ 44 (-59.63%)
Mutual labels:  counter
React Native Contacts
React Native Contacts
Stars: ✭ 1,369 (+1155.96%)
Mutual labels:  react-native-component
Vue Twitter Counter
Counter component inspired in Twitter with Vue
Stars: ✭ 29 (-73.39%)
Mutual labels:  counter
React Native Action Sheet Component
React Native Action Sheet Component for iOS & Android.
Stars: ✭ 60 (-44.95%)
Mutual labels:  react-native-component
React Native Barcode Scanner Google
Barcode scanner for react native, which implements barcode detection from Google's Vision API.
Stars: ✭ 105 (-3.67%)
Mutual labels:  react-native-component
React Native Otp Inputs
OTP inputs for React-Native
Stars: ✭ 101 (-7.34%)
Mutual labels:  react-native-component
React Native Deck Swiper
tinder like react-native deck swiper
Stars: ✭ 1,261 (+1056.88%)
Mutual labels:  react-native-component

react-native-slot-machine

Text slot machine for react-native is an easy and fully customizable Slot Machine for React Native app.

Usage

<View>
    <SlotMachine text={1234} />
    <SlotMachine text="hello" range="abcdefghijklmnopqrstuvwxyz" />
</View>

Props

The following props can be used to modify the slot machine's style and/or behaviour:

Prop Type Opt/Required Default Note
text String|Number Required 0 The text the slot machine animates to.
width Number Optional 37 The width of each slot.
height Number Optional 50 The height of each slot.
padding Number Optional 4 minimum number of slots. Added slots will be filled with 'defaultChar'
duration Number Optional 2000 The total time of the animation of all the slots.
delay Number Optional 4 Time to wait since componentDidMount until animation begins.
slotInterval Number Optional 500 The added animation time per slot. last slot animation time = 'duration'.
defaultChar Number Optional 0 The default character to be used until animation starts & with 'padding'
range String Optional 9876543210 The range of characters to be used when animating the slot machine.
initialAnimation Boolean Optional true Should initial animation be activated or only subsequent text changes animations
renderTextContent Function Optional (char, index, range) => char Allows replacing the inner content of the Text element
renderContent Function Optional (char, index, range) => char Allows replacing the entire Text element with your own implementation
styles Object Optional {} Allows overriding each of the inner components (container, slotWrapper, slotInner, innerBorder, outerBorder, overlay, text)
useNativeDriver Boolean Optional false Enable use of NativeDriver on Animation. See https://facebook.github.io/react-native/docs/animations.html#using-the-native-driver

Methods

spinTo(text)

Spins the slot machine from current position to the specified text position.


Advanced Example

class App extends React.Component {
    constructor(props) {
        super(props);
        this.state = {duration: 4000, slot1: 1234, slot2: 'hello', slot3: '2351'};
    }

    componentDidMount() {
        setTimeout(() => this.setState({duration: 1000, slot1: '4321', slot2: 'world', slot3: '1234'}), 5000);
        setTimeout(() => this.setState({duration: 4000, slot1: '1234', slot2: 'hello', slot3: '2351'}), 7000);
        setTimeout(() => this.refs.slot.spinTo('prize'), 12000);
    }
    render() {
        const symbols = ['🍏', '🍎', '🍐', '🍊', '🍋', '🍌']; // can't use emojies in SlotMachine because some of them are comprised of 2 chars
        return (
            <View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
                <View style={{height: 200, justifyContent: 'space-between', alignItems: 'center'}}>
                    <SlotMachine text={this.state.slot1} duration={this.state.duration} />
                    <SlotMachine
                        text={this.state.slot2}
                        range="abcdefghijklmnopqrstuvwxyz"
                        width={45} duration={this.state.duration}
                        ref="slot"
                    />
                    <SlotMachine text={this.state.slot3} range="012345" renderContent={c => <Text style={{fontSize: 25}}>{symbols[c]}</Text>} duration={this.state.duration} />
                </View>
            </View>
        );
    }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].