• Stars
    star
    257
  • Rank 158,728 (Top 4 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 10 years ago
  • Updated over 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Amazing cross platform UI's with React and JavaScript

The Reapp User Interface

If you're not using reapp-kit, you can use reapp-ui by itself with no extra dependencies. It will require a little more work to get running, but we've purposely kept everything modular so you can choose how much you want to use.

reapp-ui is a set of React components for building beautiful user interfaces for all platforms. It has a few goals:

  • Powerful interaction and animations
  • Easy to use what you want, and leave the rest
  • Themeable in every way
  • High performance

Usage

The simplest way of using reapp-ui is to load one of our themes, and then import the components you want to use. Here's an example of this;

import iOSTheme from 'reapp-ui/themes/ios/theme'
import Theme from 'reapp-ui/helpers/Theme';
import Button from 'reapp-ui/components/Button';
import React from 'react';

export default React.createClass({
  render() {
    return (
      <Theme {...iOSTheme}>
        <Button color="red" />
      </Theme>
    );
  }
});

This will bundle every style for every component in the iOS theme. It's simple and easy to get started with. Reapp themes are very powerful, though, and they allow you to customize every aspect of them.

Let's see how they work. If you open the reapp-ui/themes/ios/theme.js file you'll see how we load the iOS theme:

import UI from 'reapp-ui';

UI.addConstants(
  require('./constants/base'),
  require('./constants/components')
);

UI.addAnimations(require('./animations'));
UI.addStyles(require('./styles'));

export default UI.makeTheme();

As you can see, we're basically loading three different pieces: constants, styles, and animations. We're also loading the stylesheets file which includes our base.css styles that are used to normalize everything.

You could easily override each of these steps by adding in new constants, styles, or animations, or overwriting the ones we use!

Using Reapp

The rest of the docs here describe the internals of reapp-ui. If you want to learn more on how Reapp works, check out:

Demos

You can add these demos to your home screen or emulate mobile on your browser:

A note on speed: Your apps will run significantly faster when they are built. When running in dev mode they are not only checking PropTypes and for a variety of warnings, but they also aren't running using requestAnimationFrame which means they tax the CPU a lot more (but in exchange are easier to debug).

Internal Documentation

Structure

  /assets
    Icons, etc
  /behaviors
    (!) Used within components, can be passed in to override
  /components
    The UI components
  /helpers
    Components which don't map directly to user-viewable, helper components
  /lib
    Internally used functions
  /mixins
    All mixins (used internally and externally)
  /stores
    Internal: should be removable once parent-based contexts are in React
  /themes
    Theme files users can require

index.js

Used to set up reapp-ui.

reapp-ui uses three different things that must be imported at initialization. These things are imported so they can be mixed and matched for use with adapting theme or behavior.

For now it has three relevant methods:

  • addConstants: constants allow users to customize themes easily. They are used in styles (and in the future could be used with animations and more). See /themes/ios/constants/ for examples.*

  • addStyles: styles objects, keys map to the names of components and values are objects that are CSS styles in JS. Values can optionally be a function, that takes in the constants as the argument. See /themes/ios/styles/ for examples.*

  • addAnimations: animations are objects, keys are names, values are functions that take an object with index, step as keys, an optionally extra keys with more info. See /themes/ios/animations.js for examples.

To see how you'd make a theme, we suggest looking at /themes/ios/theme.js. You can require that file to have the entire iOS theme setup for you automatically.

component.js

component is a decorator that is used internally by reapp-ui to make components. It was extracted out and is a nice set of mixins that allow the ui components to avoid repetitious code.

This is an important file to inspect before understanding how this library works, and from there, the Mixins that are used here make the foundation of the UI kit.

Contributing

Because Reapp is split into a number of modules, you'll probably need to do a little more work than usual to contribute. For the UI, the best setup is to do the following:

  1. Create a reapp folder
  2. Clone the kitchen sink repository
  3. Clone this repository
  4. Run sudo npm link inside this repository
  5. Important: Run rm -r node_modules/react in reapp-ui and be sure react isn't duplicated in Webpack build
  6. Run npm run build in this directory, this will build your reapp-ui for the first time and put it into the ./build folder.
  7. Run npm run copyAssets in this directory to copy assets to the babel output directory.
  8. Run npm run watch in this directory to start babel compiler. Note: Be sure to edit in ./src directory only.
  9. Run ln -s $PREFIX/lib/node_modules/reapp-ui/build node_modules/reapp-ui inside the kitchen sink repository. The placeholder $PREFIX is the prefix used for the installation of node. Usually this is /usr/local. The command npm config get prefix can also be used to find the prefix. (The npm link command will not work here because it will reference the project root instead of build output directory.)

This will link your reapp-ui module into your kitchen sink repo. Now you can:

  1. Run reapp run -d inside kitchen sink
  2. Go to localhost:3010
  3. Make edits inside reapp-ui and they will automatically compile into the kitchen sink.

Warning: When running locally you may run into some unique bugs. Because npm link runs an npm install, it will often install multiple versions of React into your modules folders, causing Webpack to bundle multiple versions of it into your app. This can cause a variety of errors. If you see stuff that warns about Mount, Link, Context, it is most likely because of this. Delete the react folder inside reapp-ui and any other sub-modules and re-run Webpack.

Credits

Original inspiration was thanks to Pete Hunt's React Mobile Demo. The Framework7 Kitchen Sink was used as reference when building the kitchen sink.

SVG Icons included in this repo are originally from flaticon and are licensed under Creative Commons 3.0. If you use them with your project, you must include attribution "in any reasonable manner, but not in any way that suggests the licensor endorses you or your use".

A big part of react-tappable was imported for use as a mixin, and will be sent back as a pull request soon!

Help throughout was given in the #reactjs freenode channel, and from various great members of the react community including:

and many more.

More Repositories

1

reapp

[deprecated!] Make hybrid mobile apps with power
JavaScript
3,406
star
2

hacker-news-app

Hacker News Reader demo app built on Reapp http://hn.reapp.io
JavaScript
147
star
3

kitchen-sink

Kitchen sink demo app on Reapp http://kitchen.reapp.io
JavaScript
67
star
4

reapp-kit

Make apps in no time
JavaScript
46
star
5

reapp-routes

Simple route DSL
JavaScript
34
star
6

example-cordova-app

This is our hacker news app bundled for cordova
HTML
21
star
7

reapp-component

small library for factories with decorators and dependency injection
JavaScript
19
star
8

demo-flickr

Demo app searches and shows photos from Flickr
JavaScript
13
star
9

reapp-kit-demo

Simplest usage of reapp kit, List with add/delete, Flux, Immutable, in < 100 lines
JavaScript
12
star
10

reapp-pack

Webpack config generator for React apps
JavaScript
12
star
11

reapp-platform

Small helpers for Reapp apps
JavaScript
12
star
12

reapp-todo-mvc

TodoMVC demo using reapp-kit
CSS
11
star
13

reapp-server

a webpack and express setup for serving hot or isomorphic react apps
JavaScript
8
star
14

reapp-starter

starter repo for reapp apps
JavaScript
6
star
15

starter-default

Base scaffold when running `reapp new` www.reapp.io
JavaScript
5
star
16

reapp-request

thin wrapper around superagent + superagent-bluebird-promise that adds runtime and localstorage caching
JavaScript
4
star
17

reapp-reducer

simple function to reduce arrays/objects into normalized form with a status and id key
JavaScript
3
star
18

reapp-object-assign

shim for object assign, globally inserted
JavaScript
3
star
19

reapp-raf-batching

batching strategy for react, taken from Facebook
JavaScript
2
star
20

reapp.github.io

NOTE: all files here are generated from /new-site or READMEs in other repos here
HTML
1
star
21

oldreapp..github.io

website for reapp.io
HTML
1
star
22

new-site

Hexo/Gulp generator for the reapp.github.io repository
HTML
1
star