Skip to content

Commit

Permalink
Support latest version of react native
Browse files Browse the repository at this point in the history
  • Loading branch information
charpeni committed Mar 24, 2017
1 parent ee4bdcb commit 4dbb589
Show file tree
Hide file tree
Showing 6 changed files with 1,019 additions and 21 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) Novom Networks Inc.
Copyright (c) Nicolas Charpentier

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# react-native-speech-bubble [![npm version](https://badge.fury.io/js/react-native-speech-bubble.svg)](https://badge.fury.io/js/react-native-speech-bubble)
# react-native-speech-bubble [![CircleCI](https://circleci.com/gh/charpeni/react-native-speech-bubble.svg?style=shield)](https://circleci.com/gh/charpeni/react-native-speech-bubble) [![npm version](https://badge.fury.io/js/react-native-speech-bubble.svg)](https://badge.fury.io/js/react-native-speech-bubble)

A speech bubble dialog component for React Native.

Expand All @@ -12,6 +12,10 @@ npm install --save react-native-speech-bubble

## Usage

```javascript
import SpeechBubble from 'react-native-speech-bubble';
```

```jsx
<SpeechBubble
speeches={[ 'String 1', 'String 2', 'String 3' ]}
Expand Down
10 changes: 7 additions & 3 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
machine:
node:
version: 6.2.1
version: 7

dependencies:
override:
- npm install
- yarn install
cache_directories:
- ~/.cache/yarn

test:
pre:
- mkdir -p $CIRCLE_TEST_REPORTS/eslint
- touch $CIRCLE_TEST_REPORTS/eslint/eslint.xml
override:
- node node_modules/eslint/bin/eslint . -o $CIRCLE_TEST_REPORTS/eslint/eslint.xml -f junit
- yarn lint -- -o $CIRCLE_TEST_REPORTS/eslint/eslint.xml -f junit
28 changes: 14 additions & 14 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ const propTypes = {
};

const styles = StyleSheet.create({
dialogView: {
flex: 1,
flexDirection: 'column',
justifyContent: 'flex-end',
backgroundColor: 'transparent',
},
dialog: {
flexDirection: 'row',
borderRadius: 50,
Expand All @@ -49,16 +43,14 @@ const styles = StyleSheet.create({
overflow: 'hidden',
},
dialogText: {
flex: 1,
flexShrink: 1,
},
dialogNext: {
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
padding: 5,
justifyContent: 'center',
backgroundColor: 'transparent',
},
typeWriter : {
typeWriter: {
backgroundColor: 'transparent',
},
});
Expand Down Expand Up @@ -128,6 +120,7 @@ class SpeechBubble extends React.Component {
toValue: 0.9,
tension: 40,
friction: 3,
useNativeDriver: true,
}).start();
}

Expand All @@ -136,6 +129,7 @@ class SpeechBubble extends React.Component {
toValue: 1,
tension: 40,
friction: 3,
useNativeDriver: true,
}).start();
}

Expand All @@ -147,10 +141,12 @@ class SpeechBubble extends React.Component {
Animated.timing(anim.y, {
toValue: -5,
duration: translateDuration,
useNativeDriver: true,
}),
Animated.timing(anim.y, {
toValue: 5,
duration: translateDuration,
useNativeDriver: true,
}),
]).start(() => {
this.nextSpeechBubbleAnimation();
Expand All @@ -161,7 +157,8 @@ class SpeechBubble extends React.Component {
return !this.state.lastSpeech ? (
<Animated.View
style={[
this.props.nextStyle || styles.dialogNext,
styles.dialogNext,
this.props.nextStyle,
{ transform: [{ translateY: this.state.nextDialogAnimation.y }] },
{ opacity: this.state.typeEnd && !this.state.lastSpeech ? 1 : 0 },
]}
Expand All @@ -179,11 +176,13 @@ class SpeechBubble extends React.Component {
Animated.timing(anim, {
toValue: 100,
duration: rotateDuration,
useNativeDriver: true,
}),
Animated.delay(1000),
Animated.timing(anim, {
toValue: 0,
duration: rotateDuration,
useNativeDriver: true,
}),
]).start(() => {
this.replaySpeechBubbleAnimation();
Expand All @@ -199,7 +198,8 @@ class SpeechBubble extends React.Component {
return this.state.lastSpeech ? (
<Animated.View
style={[
this.props.nextStyle || styles.dialogNext,
styles.dialogNext,
this.props.nextStyle,
{ transform: [{ rotate: interpolatedRotateAnimation }] },
{ opacity: this.state.typeEnd && this.state.lastSpeech ? 1 : 0 },
]}
Expand All @@ -225,7 +225,7 @@ class SpeechBubble extends React.Component {
onPressOut={this.onSpeechBubblePressOut}
>
<View style={this.props.speechBubbleStyle || styles.dialog}>
<View style={this.props.speechBubbleTextStyle || styles.dialogText}>
<View style={[styles.dialogText, this.props.speechBubbleTextStyle]}>
<TypeWriter
text={this.props.speeches[this.state.speechIndex]}
typing={1}
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
"name": "react-native-speech-bubble",
"version": "0.2.0",
"description": "A speech bubble dialog component for React Native.",
"repository": "charpeni/react-native-speech-bubble",
"main": "index.js",
"scripts": {
"test": "eslint ."
"lint": "eslint ."
},
"contributors": [
"Nicolas Charpentier"
Expand All @@ -26,7 +27,7 @@
],
"peerDependencies": {
"react": "*",
"react-native": "*"
"react-native": ">= 0.40.0"
},
"devDependencies": {
"babel-eslint": "^6.0.4",
Expand Down
Loading

0 comments on commit 4dbb589

Please sign in to comment.