Example #1
0
import { theme } from 'reapp-kit';
import iOS from 'reapp-kit/themes/ios';
import components from './constants/components';
import styles from './styles';

import './main.css';

theme({
  constants: [
    iOS.constants.base,
    iOS.constants.components,
    components
  ],
  styles: [
    iOS.styles,
    styles
  ],
  animations: [iOS.animations]
});
Example #2
0
import {
  React, Reapp, List, Button, Swiper,
  Immutable, router, store, action, theme
} from 'reapp-kit';

theme(require('reapp-kit/themes/ios'));

store({
  post: { 1: { id: 1, title: 'Hello World', content: 'Lorem Ipsum' } },
  posts: ['1']
});

action('addPost', (title, content) => {
  const id = Math.random();
  store().withMutations(store => {
    store.setIn(['post', id], Immutable.fromJS({ id, title: 'Another', content: 'Lorem' }));
    store.set('posts', store.get('posts').push(id));
  });
});

action('deletePost', id => {
  store().withMutations(store => {
    store.set('post', store.get('post').delete(id));
    const posts = store.get('posts');
    store.set('posts', posts.delete(posts.indexOf(id)));
  });
})

// higher order component to pass cursor down
const Article = store.cursor(['posts', 'post'], class extends React.Component {
  render() {