Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
xcarpentier committed Dec 20, 2017
2 parents c0281d5 + 940ff59 commit 5e94773
Show file tree
Hide file tree
Showing 28 changed files with 1,074 additions and 883 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
android
ios
example
33 changes: 22 additions & 11 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
{
"extends": "cooperka/react-native",

"env": {
"browser": true,
"jest": true
},

// Any rules here will override those from
// https://github.com/cooperka/eslint-config-cooperka.
"rules": {}
}
"extends": "cooperka/react-native",
"env": {
"browser": true,
"jest": true
},
"rules": {
"no-underscore-dangle": 0,
"import/no-unresolved": [
2,
{
"ignore": [
"react",
"react-native"
]
}
],
"import/no-extraneous-dependencies": 0,
"import/extensions": 0,
"react/no-unused-prop-types": 0,
"react/no-typos": 0
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ npm-debug.log
TODO.md

.idea
.vscode
2 changes: 2 additions & 0 deletions ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

#### Additional Information

* Nodejs version: [FILL THIS OUT]
* React version: [FILL THIS OUT]
* React Native version: [FILL THIS OUT]
* react-native-gifted-chat version: [FILL THIS OUT]
* Platform(s) (iOS, Android, or both?): [FILL THIS OUT]
43 changes: 33 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,31 @@
# Gifted Chat
<p align="center">
<img alt="react-native-linkedin" src="https://raw.githubusercontent.com/FaridSafi/react-native-gifted-chat/master/screenshots/gifted-chat-1.png" width=200>
<img alt="react-native-linkedin" src="https://raw.githubusercontent.com/FaridSafi/react-native-gifted-chat/master/screenshots/gifted-chat-2.png" width=200>
</p>

<h3 align="center">
💬 Gifted Chat
</h3>
<p align="center">
The most complete chat UI for React Native <br/>
<small>formerly known as Gifted Messenger</small>
</p>
<p align="center">
<!--a href="https://www.npmjs.com/package/react-native-gifted-chat">
<img alt="npm dowloads" src="https://img.shields.io/npm/dm/react-native-gifted-chat.svg"/></a -->
<a href="https://www.npmjs.com/package/react-native-gifted-chat"><img alt="npm version" src="https://badge.fury.io/js/react-native-gifted-chat.svg"/></a>
 <a href="https://circleci.com/gh/FaridSafi/react-native-gifted-chat"><img src="https://circleci.com/gh/FaridSafi/react-native-gifted-chat.svg?style=svg" alt="build"></a>
<a href="https://greenkeeper.io/"><img src="https://badges.greenkeeper.io/FaridSafi/react-native-gifted-chat.svg" alt="build"></a>
</p>

<p align="center">
<img src="https://api.qrserver.com/v1/create-qr-code/?size=100x100&data=exp://expo.io/@xcarpentier/gifted-chat">
<br>
<a href="https://snack.expo.io/@xcarpentier/gifted-chat">Demo on snack (Expo)</a>
</p>

[![npm downloads](https://img.shields.io/npm/dm/react-native-gifted-chat.svg)](https://www.npmjs.com/package/react-native-gifted-chat)
[![npm version](https://img.shields.io/npm/v/react-native-gifted-chat.svg)](https://www.npmjs.com/package/react-native-gifted-chat)
[![Latest GitHub tag](https://img.shields.io/github/tag/FaridSafi/react-native-gifted-chat.svg)](https://github.com/FaridSafi/react-native-gifted-chat)

The most complete chat UI for React Native (formerly known as Gifted Messenger).

![screenshot 1](https://raw.githubusercontent.com/FaridSafi/react-native-gifted-chat/master/screenshots/gifted-chat-1.png)
![screenshot 2](https://raw.githubusercontent.com/FaridSafi/react-native-gifted-chat/master/screenshots/gifted-chat-2.png)

## Features

- Fully customizable components
- Composer actions (to attach photos, etc.)
- Load earlier messages
Expand Down Expand Up @@ -233,3 +248,11 @@ If you have any issues, you can clear your watches using `watchman watch-del-all
## Author
Feel free to ask me questions on Twitter [@FaridSafi](https://www.twitter.com/FaridSafi)!
## Contributors
- Kevin Cooper [cooperka](https://github.com/cooperka)
- Kfir Golan [kfiroo](https://github.com/kfiroo)
- Bruno Cascio [brunocascio](https://github.com/brunocascio)
- Xavier Carpentier [xcarpentier](https://github.com/xcarpentier)
- [more](https://github.com/FaridSafi/react-native-gifted-chat/graphs/contributors)
29 changes: 29 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
machine:
environment:
PATH: "${PATH}:${HOME}/${CIRCLE_PROJECT_REPONAME}/node_modules/.bin"
node:
version: 8.2.0

dependencies:
override:
- yarn global add codecov
- yarn install --no-progress --no-emoji --ignore-engines
cache_directories:
- "node_modules"
- ~/.yarn
- ~/.cache/yarn

test:
override:
- yarn run lint
# TODO: - yarn run flow
# TODO: - yarn run test -- --coverage
# TODO: - codecov

# TODO: deployment:
# release:
# tag: /v[0-9]+(\.[0-9]+)*/
# commands:
# - echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> ~/.npmrc
# - yarn publish --new-version `./scripts/version.js`
24 changes: 13 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,29 @@
},
"homepage": "https://github.com/FaridSafi/react-native-gifted-chat#readme",
"scripts": {
"lint": "eslint . --ext .js,.jsx"
"lint": "eslint . --ext .js,.jsx",
"precommit": "yarn lint"
},
"devDependencies": {
"eslint": "3.19.0",
"eslint-config-airbnb": "15.0.2",
"eslint-config-cooperka": "0.2.3",
"eslint-plugin-import": "2.6.1",
"eslint-plugin-jsx-a11y": "5.1.1",
"eslint-plugin-react": "7.1.0",
"eslint-plugin-react-native": "2.3.2"
"eslint": "^4.9.0",
"eslint-config-airbnb": "16.1.0",
"eslint-config-cooperka": "0.2.9",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-react": "^7.4.0",
"eslint-plugin-react-native": "3.2.0",
"husky": "0.14.3"
},
"dependencies": {
"@expo/react-native-action-sheet": "^1.0.1",
"md5": "2.2.1",
"moment": "^2.19.0",
"prop-types": "15.5.10",
"prop-types": "15.6.0",
"react-native-communications": "2.2.1",
"react-native-invertible-scroll-view": "^1.1.0",
"react-native-lightbox": "^0.7.0",
"react-native-parsed-text": "^0.0.19",
"react-native-parsed-text": "^0.0.20",
"shallowequal": "1.0.2",
"uuid": "3.1.0"
}
}
}
70 changes: 34 additions & 36 deletions src/Actions.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
/* eslint no-use-before-define: ["error", { "variables": false }] */

import PropTypes from 'prop-types';
import React from 'react';
import {
StyleSheet,
Text,
TouchableOpacity,
View,
ViewPropTypes,
} from 'react-native';
import { StyleSheet, Text, TouchableOpacity, View, ViewPropTypes } from 'react-native';
import Color from './Color';

export default class Actions extends React.Component {

constructor(props) {
super(props);
this.onActionsPress = this.onActionsPress.bind(this);
Expand All @@ -17,38 +15,34 @@ export default class Actions extends React.Component {
onActionsPress() {
const options = Object.keys(this.props.options);
const cancelButtonIndex = Object.keys(this.props.options).length - 1;
this.context.actionSheet().showActionSheetWithOptions({
options,
cancelButtonIndex,
tintColor: this.props.optionTintColor
},
(buttonIndex) => {
let i = 0;
for (let key in this.props.options) {
if (this.props.options.hasOwnProperty(key)) {
if (buttonIndex === i) {
this.props.options[key](this.props);
return;
this.context.actionSheet().showActionSheetWithOptions(
{
options,
cancelButtonIndex,
tintColor: this.props.optionTintColor,
},
function handle(buttonIndex) {
let i = 0;
Object.keys(this.props.options).forEach(function launch(key) {
if (this.props.options[key]) {
if (buttonIndex === i) {
this.props.options[key](this.props);
return;
}
i += 1;
}
i++;
}
}
});
});
},
);
}

renderIcon() {
if (this.props.icon) {
return this.props.icon();
}
return (
<View
style={[styles.wrapper, this.props.wrapperStyle]}
>
<Text
style={[styles.iconText, this.props.iconTextStyle]}
>
+
</Text>
<View style={[styles.wrapper, this.props.wrapperStyle]}>
<Text style={[styles.iconText, this.props.iconTextStyle]}>+</Text>
</View>
);
}
Expand All @@ -63,6 +57,7 @@ export default class Actions extends React.Component {
</TouchableOpacity>
);
}

}

const styles = StyleSheet.create({
Expand All @@ -74,15 +69,15 @@ const styles = StyleSheet.create({
},
wrapper: {
borderRadius: 13,
borderColor: '#b2b2b2',
borderColor: Color.defaultColor,
borderWidth: 2,
flex: 1,
},
iconText: {
color: '#b2b2b2',
color: Color.defaultColor,
fontWeight: 'bold',
fontSize: 16,
backgroundColor: 'transparent',
backgroundColor: Color.backgroundTransparent,
textAlign: 'center',
},
});
Expand All @@ -92,12 +87,14 @@ Actions.contextTypes = {
};

Actions.defaultProps = {
onSend: () => {},
onSend: () => { },
options: {},
optionTintColor: '#007AFF',
optionTintColor: Color.optionTintColor,
icon: null,
containerStyle: {},
iconTextStyle: {},
wrapperStyle: {},
onPressActionButton: () => { },
};

Actions.propTypes = {
Expand All @@ -106,6 +103,7 @@ Actions.propTypes = {
optionTintColor: PropTypes.string,
icon: PropTypes.func,
onPressActionButton: PropTypes.func,
wrapperStyle: ViewPropTypes.style,
containerStyle: ViewPropTypes.style,
iconTextStyle: Text.propTypes.style,
};
Loading

0 comments on commit 5e94773

Please sign in to comment.