1.0.0 • Published 7 years ago
skits v1.0.0
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!
- Fork it.
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
Or open up a issue.
License
Licensed under the MIT License.