Skip to content

Commit

Permalink
Merge branch 'release/0.8.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
Željko Rumenjak committed Sep 1, 2016
2 parents 864eb22 + 3551595 commit d9de702
Show file tree
Hide file tree
Showing 147 changed files with 9,472 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# http://editorconfig.org
root = true

# All files
[*]
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8

# JS files
[*.js]
indent_style = space
indent_size = 2

# JSON files
[*.json]
indent_style = space
indent_size = 2

# Java files
[*.java]
indent_style = space
indent_size = 4

# Objective C files
[*{.h,.m,.mm}]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false
6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
**/dist/*
**/node_modules/*
**/server.js
**/webpack.config*.js
**/test-utils/setup.js

22 changes: 22 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"extends": "airbnb",
"env": {
"mocha": true
},
"plugins": [
"react-native"
],
"parser": "babel-eslint",
"rules": {
"no-empty-label": 0,
"no-console": 0,
"import/no-unresolved": 0,
"global-require": 0,
"no-underscore-dangle": 0,
"space-before-keywords": 0,
"space-after-keywords": 0,
"space-return-throw-case": 0,
"react-native/no-unused-styles": 2,
"react-native/split-platform-components": 2
}
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.idea
node_modules
*.tgz
16 changes: 16 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
node_modules
.idea

# Ignore test files
*_tests_

# Ignore the example app
examples/RestaurantsApp/

# Ignore local/config files
.editorconfig
.npmignore
.gitignore

# Ignore previous builds
*.tgz
30 changes: 30 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
BSD License

For @shoutem/ui software

Copyright (c) 2016-present, Shoutem. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

* Neither the name of the Shoutem nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
116 changes: 116 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Shoutem UI

Shoutem UI is a set of styleable components that enables you to build beautiful React Native applications for iOS and Android. All of our components are built to be both composable and [customizable](http://github.com/shoutem/theme). Each component has a predefined style that is compatible with the rest of the Shoutem UI, which makes it possible to build complex components that look great without the need to manually define complex styles.

## Install

```
$ npm install --save @shoutem/ui
$ rnpm link
```

## Docs

All the documentation is available on the [Developer portal](http://shoutem.github.io/docs/ui-toolkit/introduction).

## Examples

To see how Shoutem UI works, you can:

- include the `Examples` component into your React Native app or
- run `Restaurants` app in `examples` folder.

### Examples component

Create new React Native project:

```bash
$ react-native init HelloWorld
```

Locate to project and install `@shoutem/ui` in your project:

```bash
$ cd HelloWorld
$ npm install --save @shoutem/ui
```

Run `rnpm` to link fonts that the toolkit is using:

```bash
$ rnpm link
```

Now, simply copy the following to your `index.ios.js` files of the React Native project:

```JavaScript
import React, { Component } from 'react';
import { AppRegistry } from 'react-native';
import { Examples } from '@shoutem/ui';

class HelloWorld extends Component {
render() {
return (
<Examples />
);
}
}

AppRegistry.registerComponent('HelloWorld', () => HelloWorld);
```

Finally, run the app!

```bash
$ react-native run-ios
```

To see other components, just import them from `@shoutem/ui` and render them.

You can also use standard React Native components in your layouts anywhere you want, but they will not inherit either the theme or the parent styles, so you will need to style them manually.


### Restaurants app

Clone the [Shoutem UI](https://github.com/shoutem/ui) repository:

```bash
git clone https://github.com/shoutem/ui.git
```

Locate to `RestaurantsApp` folder:

```bash
cd ui/examples/RestaurantsApp
```

Install and link dependencies:

```bash
npm install
rnpm link
```

Finally, run the app!

```bash
react-native run-ios
react-native run-android
```

## UI Toolkit

Shoutem UI is a part of the Shoutem UI Toolkit that enables you to build professionally looking React Native apps with ease.

It consists of three libraries:

- [@shoutem/ui](https://github.com/shoutem/ui): beautiful and customizable UI components
- [@shoutem/theme](https://github.com/shoutem/theme): “CSS-way” of styling entire app
- [@shoutem/animation](https://github.com/shoutem/animation): declarative way of applying ready-made animations

## License

[The BSD License](https://opensource.org/licenses/BSD-3-Clause)
Copyright (c) 2016-present, [Shoutem](http://shoutem.github.io)


55 changes: 55 additions & 0 deletions _tests_/VideoSourceReader.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { assert } from 'chai';
import VideoSourceReader from '../components/Video/VideoSourceReader';

describe('VideoSource', () => {
describe('YouTube source', () => {
const testSource = 'http://www.youtube.com/embed/M7lc1UVf-VE?autoplay=1';
const videoSourceReader = new VideoSourceReader(testSource);
describe('isWebVideo', () => {
it('returns true', () => {
const expected = true;
assert.equal(videoSourceReader.isWebVideo(), expected, 'web video not recoginized');
});
});
describe('getUrl', () => {
it('returns an embedded YouTube video url', () => {
const expected = 'http://www.youtube.com/embed/M7lc1UVf-VE';
assert.equal(videoSourceReader.getUrl(), expected, 'video url not correct');
});
});
});

describe('Vimeo source', () => {
const testSource = 'https://player.vimeo.com/video/122732445';
const videoSourceReader = new VideoSourceReader(testSource);
describe('isWebVideo', () => {
it('returns true', () => {
const expected = true;
assert.equal(videoSourceReader.isWebVideo(), expected, 'web video not recoginized');
});
});
describe('getUrl', () => {
it('returns an embedded YouTube video url', () => {
const expected = 'http://player.vimeo.com/video/122732445?title=0&byline=0&portrait=0';
assert.equal(videoSourceReader.getUrl(), expected, 'video url not correct');
});
});
});

describe('Non web video source', () => {
const testSource = 'https://falcon479.startdedicated.com/files/round_boxes.mp4';
const videoSourceReader = new VideoSourceReader(testSource);
describe('isWebVideo', () => {
it('returns false', () => {
const expected = false;
assert.equal(videoSourceReader.isWebVideo(), expected, 'web video recoginized incorrectly');
});
});
describe('getUrl', () => {
it('returns unmodified source url', () => {
const expected = 'https://falcon479.startdedicated.com/files/round_boxes.mp4';
assert.equal(videoSourceReader.getUrl(), expected, 'video url not correct');
});
});
});
});
Binary file added assets/examples/road.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/transparent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions components/Button.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React, { Component } from 'react';
import {
TouchableOpacity,
} from 'react-native';

import { connectStyle } from '@shoutem/theme';
import { connectAnimation } from '@shoutem/animation';

class Button extends Component {
render() {
// The underlayColor is not a valid RN style
// property, so we have to unset it here.
const style = {
...this.props.style,
};
delete style.underlayColor;

return (
<TouchableOpacity
{...this.props}
style={style}
underlayColor={this.props.style.underlayColor}
/>
);
}
}

Button.propTypes = {
...TouchableOpacity.propTypes,
};

const AnimatedButton = connectAnimation(Button);
const StyledButton = connectStyle('shoutem.ui.Button')(AnimatedButton);
export {
StyledButton as Button,
};
11 changes: 11 additions & 0 deletions components/Card.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { View } from 'react-native';

import { connectStyle } from '@shoutem/theme';
import { connectAnimation } from '@shoutem/animation';

const AnimatedCard = connectAnimation(View);
const Card = connectStyle('shoutem.ui.Card', {})(AnimatedCard);

export {
Card,
};
11 changes: 11 additions & 0 deletions components/Divider.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { View } from 'react-native';

import { connectStyle } from '@shoutem/theme';
import { connectAnimation } from '@shoutem/animation';

const AnimatedDivider = connectAnimation(View);
const Divider = connectStyle('shoutem.ui.Divider')(AnimatedDivider);

export {
Divider,
};
Loading

0 comments on commit d9de702

Please sign in to comment.