1.0.0 • Published 7 years ago

skits v1.0.0

Weekly downloads
9
License
MIT
Repository
github
Last release
7 years ago

Install

$ npm install skits
# OR
$ yarn add skits

Usage

import Skits, { inject } from 'skits'
import {Router, Scene} from 'react-native-router-flux'
import React from 'react'
import { View, Button, Text, AppRegistry } from 'react-native'

const skits = new Skits()

skits.store({
  name: 'counter',
  state: {
    count: 0
  },
  actions: {
    increase() {
      ++this.count
    },
    decrease() {
      --this.count
    }
  },
  computed: {
    description() {
      return `Current Count: ${this.count}`
    }
  }
})

const Counter = inject(({ stores }) =>
  <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
    <Text>
      {stores.counter.description}
    </Text>
    <Button title="+" onPress={stores.counter.increase} />
    <Button title="-" onPress={stores.counter.decrease} />
  </View>
)

skits.router(() =>
  <Router>
    <Scene key="root">
      <Scene key="counter" component={Counter} title="Counter" />
    </Scene>
  </Router>
)

AppRegistry.registerComponent('skitsExample', () => skits.App);

Acknowledgements

This module is inspired/based on cans.

Contributing

Contributions are welcome!

  1. Fork it.
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Or open up a issue.

License

Licensed under the MIT License.

1.0.0

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago