Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
10b8e6a
Modified for FlatList
Nov 6, 2017
33dc31f
Removed invertible-scroll-view from the dependencies
gavin-gmlab Nov 21, 2017
1ea1775
chore(lint): merge some new lint
xcarpentier Jan 15, 2018
8ff8f3a
chore(test): update jest snapshot
xcarpentier Jan 15, 2018
6786177
feat(purecomponent): remove state and weird styles
xcarpentier Jan 23, 2018
e1cc214
fix(test): update snapshot
xcarpentier Jan 23, 2018
c41b64d
fix(state): remove state at all
xcarpentier Jan 23, 2018
43b57fa
fix(hash): try without
xcarpentier Jan 23, 2018
d7e8718
fix(hash): re-add hash for local test
xcarpentier Jan 24, 2018
761126d
fix(ref): undefined on scroll
xcarpentier Jan 24, 2018
a490305
chore(appr): get mine
xcarpentier Jan 24, 2018
0fea254
feat(expo): change splash screen
xcarpentier Jan 24, 2018
3903cd9
chore(sentry): add sentry to debug crash
xcarpentier Jan 24, 2018
ffb9c8a
fix(lint): ignore example-expo
xcarpentier Jan 24, 2018
5dc7f1a
fix(ref): try with deprecated string ref
xcarpentier Jan 24, 2018
8abb5a3
fix(scroll): try by removing scroll
xcarpentier Jan 24, 2018
4f07992
chore(e2e): init detox
xcarpentier Jan 24, 2018
a85b9fb
chore(travis): add timeout cache
xcarpentier Jan 24, 2018
75ded90
fix(cache): remove cache
xcarpentier Jan 24, 2018
b2e74d5
clean(comment): remove old comments
xcarpentier Jan 24, 2018
5b35d29
chore(e2e): finish detox
xcarpentier Jan 24, 2018
05281c3
Merge branch 'master' of https://github.com/FaridSafi/react-native-gi…
xcarpentier Jan 24, 2018
a7bfd07
fix(data): add image
xcarpentier Jan 24, 2018
32a268d
fix(test): add snapshot, id for detox
xcarpentier Jan 25, 2018
505d749
fix(FlatList): try to find the best props
xcarpentier Jan 25, 2018
8ccbcd0
feat(chat): maxToRenderPerBatch
xcarpentier Jan 25, 2018
abbbdbe
fix(flatlist): Not Remove subview clipped
xcarpentier Jan 28, 2018
a27677d
fix(scroll blocking): multiply by 2 windowSize
xcarpentier Jan 28, 2018
ad12782
Update Constant.js
xcarpentier Jan 28, 2018
903dabf
fix(test): update snapshot
xcarpentier Jan 29, 2018
b8deab5
fix(test): update snapshot again
xcarpentier Jan 29, 2018
321afe4
upgrade 25 wip
xcarpentier Feb 16, 2018
7cd6d79
chore(yarn): lock
xcarpentier Mar 8, 2018
58b59d7
merge from v0.4.1
xcarpentier Mar 8, 2018
75c7442
fix(expo): ugrade to expo 25
xcarpentier Mar 8, 2018
2412107
chore(travis): log to debug
xcarpentier Mar 8, 2018
7f12e12
fix(coverage): add dummy test to be happy
xcarpentier Mar 9, 2018
5ef003e
chore(travis): appr only on local pr
xcarpentier Mar 9, 2018
e93d2d8
Merge branch 'master' into modified-for-flatlist
brunocascio Mar 13, 2018
e67f3cc
chore(merge): master and fix conflict
xcarpentier Mar 16, 2018
bebe79f
chore(merge): fix conflict on MessageContainer
xcarpentier Mar 16, 2018
30d02be
fix(initialNumToRender): remove settings
xcarpentier Mar 16, 2018
680e4cd
chore(exp): upgrade example
xcarpentier Mar 16, 2018
f60bd71
fix(setPRVersion): save app instead of pkg
xcarpentier Mar 16, 2018
d5f454e
fix(test): regenerate snapshot
xcarpentier Mar 16, 2018
041ffb9
fix(example): version
xcarpentier Mar 16, 2018
5845c41
fix(FlatList): perf by PureComponent and removeClippedSubviews on and…
xcarpentier Mar 21, 2018
a2deae8
refactor(isSame props): remove isSame props like said in next major r…
xcarpentier Mar 21, 2018
ca6f0f5
fix(FlatList): purify Avatar, Bubble, ...
xcarpentier Mar 21, 2018
3eb2ff0
chore(package): remove hash-sum
xcarpentier Mar 21, 2018
f60f1f2
fix(perf): try to use shouldComponentUpdate on MessageText
xcarpentier Mar 21, 2018
b55d841
Merge branch 'master' into modified-for-flatlist
xcarpentier May 29, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ android
ios
example
example-slack-message
example-expo
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ TODO.md

.idea
.vscode
*.log
Exponent-*.app
*.log
4 changes: 3 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
example/
example-expo/
example-slack-message/
TODO.md
screenshots/
.babelrc
tests/
README.md
ISSUE_TEMPLATE.md
circle.yml
codecov.yml
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ node_js:
- "node"
cache: false
before_install:
- yarn global add exp
- yarn global add exp@50.0.0
script:
- 'export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo "$TRAVIS_REPO_SLUG"; else echo "$TRAVIS_PULL_REQUEST_SLUG#$TRAVIS_PULL_REQUEST_BRANCH"; fi)'
- 'echo "BRANCH=$BRANCH"'
- 'export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then yarn deploy; else yarn appr; fi)'
- 'export BRANCH="$TRAVIS_PULL_REQUEST_SLUG#$TRAVIS_PULL_REQUEST_BRANCH"'
- 'echo $BRANCH'
- 'if [ "$TRAVIS_PULL_REQUEST_SLUG" != "FaridSafi/react-native-gifted-chat" ]; then echo "No appr because external PR"; else yarn appr; fi'
2 changes: 1 addition & 1 deletion .watchmanconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"ignore_dirs": [".git", "node_modules", "example"]
"ignore_dirs": [".git", "node_modules"]
}
23 changes: 16 additions & 7 deletions example-expo/App.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
/* eslint no-alert: 0, jsx-a11y/accessible-emoji: 0 */

import React, { Component } from 'react';
import { Asset, AppLoading } from 'expo';
import { View, StyleSheet, Linking } from 'react-native';

import { GiftedChat } from 'react-native-gifted-chat';
import Sentry from 'sentry-expo';

import messagesData from './data';
import NavBar from './NavBar';
import CustomView from './CustomView';

Sentry.config('https://[email protected]/276804').install();

const styles = StyleSheet.create({
container: { flex: 1 },
});
Expand All @@ -20,18 +22,21 @@ export default class App extends Component {

constructor(props) {
super(props);

this.state = {
messages: [],
step: 0,
appIsReady: false,
};

this.onSend = this.onSend.bind(this);
this.parsePatterns = this.parsePatterns.bind(this);
}

componentWillMount() {
async componentWillMount() {
// init with only system messages
this.setState({ messages: messagesData.filter((message) => message.system) });
await Asset.fromModule(require('./assets/avatar.png')).downloadAsync();
this.setState({ messages: messagesData.filter((message) => message.system), appIsReady: true });
}

onSend(messages = []) {
Expand All @@ -40,7 +45,7 @@ export default class App extends Component {
messages: GiftedChat.append(previousState.messages, [{ ...messages[0], sent: true, received: true }]),
step,
}));
setTimeout(() => this.botSend(step), 1500 + Math.round(Math.random() * 1000));
setTimeout(() => this.botSend(step), 1200 + Math.round(Math.random() * 1000));
}

botSend(step = 0) {
Expand All @@ -59,19 +64,23 @@ export default class App extends Component {
return [
{
pattern: /#(\w+)/,
style: { ...linkStyle, color: 'orange' },
style: { ...linkStyle, color: 'darkorange' },
onPress: () => Linking.openURL('http://gifted.chat'),
},
];
}
render() {
if (!this.state.appIsReady) {
return <AppLoading />;
}
return (
<View style={styles.container}>
<View style={styles.container} accessible accessibilityLabel="main" testID="main">
<NavBar />
<GiftedChat
messages={this.state.messages}
onSend={this.onSend}
renderCustomView={CustomView}
keyboardShouldPersistTaps="never"
user={{
_id: 1,
}}
Expand Down
1 change: 0 additions & 1 deletion example-expo/CustomView.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export default function CustomView(props) {
zoomEnabled={false}
>
<MapView.Marker
pinColor={'#fff'}
coordinate={{
latitude: props.currentMessage.location.latitude,
longitude: props.currentMessage.location.longitude,
Expand Down
7 changes: 6 additions & 1 deletion example-expo/NavBar.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
/* eslint jsx-a11y/accessible-emoji: 0 */
import React from 'react';
import { Text } from 'react-native';
import NavBar, { NavTitle, NavButton } from 'react-native-nav';
import app from './app.json';

export default function NavBarCustom() {
return (
<NavBar>
<NavButton />
<NavTitle>💬 Gifted Chat</NavTitle>
<NavTitle>
💬 Gifted Chat{'\n'}
<Text style={{ fontSize: 10, color: '#aaa' }}>({app.expo.version})</Text>
</NavTitle>
<NavButton />
</NavBar>
);
Expand Down
20 changes: 16 additions & 4 deletions example-expo/app.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"expo": {
"name": "example-expo",
"description": "This project is really great.",
"name": "gifted-chat-example",
"description": "Gifted Chat Expo Example",
"slug": "example-expo",
"privacy": "public",
"sdkVersion": "24.0.0",
"sdkVersion": "25.0.0",
"platforms": ["ios", "android"],
"version": "1.0.0",
"version": "0.4.1",
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
Expand All @@ -19,6 +19,18 @@
},
"androidStatusBar": {
"backgroundColor": "#000000"
},
"hooks": {
"postPublish": [
{
"file": "sentry-expo/upload-sourcemaps",
"config": {
"organization": "xavier-carpentier-sas",
"project": "giftedchat",
"authToken": "d32ac87517964ac2b5b778bf5c7b544e59dcab60d1df4fafb6fab65a9d8019ff"
}
}
]
}
}
}
Binary file added example-expo/assets/avatar.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 modified example-expo/assets/icon.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 modified example-expo/assets/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions example-expo/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default [
user: {
_id: 2,
name: 'React Native',
avatar: require('./assets/avatar.png'),
},
image: 'https://lh3.googleusercontent.com/-uXipYA5hSKc/VVWKiFIvo-I/AAAAAAAAAhQ/vkjLyZNEzUA/w800-h800/1.jpg',
sent: true,
Expand All @@ -36,6 +37,7 @@ export default [
user: {
_id: 2,
name: 'React Native',
avatar: require('./assets/avatar.png'),
},
sent: true,
received: true,
Expand All @@ -60,6 +62,7 @@ export default [
user: {
_id: 2,
name: 'React Native',
avatar: require('./assets/avatar.png'),
},
sent: true,
received: true,
Expand Down
3 changes: 3 additions & 0 deletions example-expo/e2e/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"setupTestFrameworkScriptFile": "./init.js"
}
52 changes: 52 additions & 0 deletions example-expo/e2e/e2e.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
const { reloadApp } = require('detox-expo-helpers');

const composerId = 'Type a message...';
const sendId = 'send';
const timeout = 3000;

async function expectTypeText(text) {
await waitFor(element(by.id(composerId)))
.toBeVisible()
.withTimeout(timeout);
await element(by.id(composerId)).tap();
await element(by.id(composerId)).typeText(text);
await waitFor(element(by.id(sendId)))
.toBeVisible()
.withTimeout(timeout);
await element(by.id(sendId)).tap();
await waitFor(element(by.text(text)))
.toBeVisible()
.withTimeout(timeout);
}

describe('GiftedChat', () => {
beforeAll(async () => {
await reloadApp();
});

it('should have main screen', async () => {
await waitFor(element(by.id('main')))
.toBeVisible()
.withTimeout(timeout);
});

it('should type text 1', async () => {
await expectTypeText('Are you building a chat app?');
});

it('should type text 2', async () => {
await expectTypeText('Where are you?');
});

it('should type text 3', async () => {
await expectTypeText('Send me a picture!');
});

it('should type text 4', async () => {
await expectTypeText('#awesome !!!');
});

it('should type text 5', async () => {
await expectTypeText("Will *Star GiftedChat's repo!");
});
});
12 changes: 12 additions & 0 deletions example-expo/e2e/init.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const detox = require('detox');
const config = require('../package.json').detox;

jasmine.DEFAULT_TIMEOUT_INTERVAL = 500000;

beforeAll(async () => {
await detox.init(config);
});

afterAll(async () => {
await detox.cleanup();
});
22 changes: 22 additions & 0 deletions example-expo/e2e/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

set -e

if [[ -z "$1" ]]
then
echo "No arguments supplied!"
echo "Please specified expo versions..."
versions=`ls -l ~/.expo/ios-simulator-app-cache | rev | cut -d' ' -f 1 | rev | grep Exponent | cut -d'-' -f 2 | tr ap " "`
echo "${versions}"
exit 1
fi

rm -rf e2e/Exponent-*.app
DEST="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/../e2e/"
EXPO_APP_PATH="$HOME/.expo/ios-simulator-app-cache/Exponent-$1.app"

echo "Copy file from $EXPO_APP_PATH to $DEST"

cp -r $EXPO_APP_PATH $DEST

exit 0
33 changes: 26 additions & 7 deletions example-expo/package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,37 @@
{
"name": "react-native-gifted-chat-expo",
"main": "node_modules/expo/AppEntry.js",
"version": "0.4.1",
"private": true,
"scripts": {
"cleaning": "watchman watch-del-all && rm -f yarn.lock && rm -rf node_modules && rm -rf $TMPDIR/react-* && yarn cache clean"
"e2e:init": "./e2e/init.sh 2.3.0",
"test:e2e": "exp r -c & detox test -c ios.sim; pkill -f exp",
"cleaning":
"watchman watch-del-all && rm -f yarn.lock && rm -rf node_modules && rm -rf $TMPDIR/react-* && yarn cache clean"
},
"dependencies": {
"expo": "^24.0.0",
"react": "16.0.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-24.0.0.tar.gz",
"react-native-gifted-chat": "https://github.com/FaridSafi/react-native-gifted-chat.git",
"react-native-nav": "2.0.2"
"expo": "^25.0.0",
"react": "16.2.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-25.0.0.tar.gz",
"react-native-gifted-chat": "FaridSafi/react-native-gifted-chat",
"react-native-nav": "2.0.2",
"sentry-expo": "1.7.0"
},
"devDependencies": {
"appr": "xcarpentier/appr"
"appr": "xcarpentier/appr",
"detox": "7.0.0-alpha.1",
"detox-expo-helpers": "0.2.0",
"jest": "22.1.4"
},
"detox": {
"test-runner": "jest",
"runner-config": "e2e/config.json",
"configurations": {
"ios.sim": {
"binaryPath": "./e2e/Exponent-2.3.0.app",
"type": "ios.simulator",
"name": "iPhone 7"
}
}
}
}
14 changes: 9 additions & 5 deletions example-expo/setPRVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

/* eslint-disable */

const fs = require('fs')
const pkg = require('./package.json')
const fs = require('fs');
const pkg = require('./package.json');
const app = require('./app.json');
const { TRAVIS_BUILD_NUMBER, BRANCH } = process.env;

pkg.dependencies['react-native-gifted-chat'] = process.env.BRANCH
pkg.dependencies['react-native-gifted-chat'] = BRANCH;
app.expo['version'] = `${pkg.version}.${TRAVIS_BUILD_NUMBER || 'dev'}`;

fs.writeFileSync('./package.json', JSON.stringify(pkg, null, 2), 'utf8')
fs.writeFileSync('./package.json', JSON.stringify(pkg, null, 1), 'utf8');
fs.writeFileSync('./app.json', JSON.stringify(app, null, 1), 'utf8');

process.exit()
process.exit();
Loading