react-native-gifted-messenger
Advanced tools
Comparing version 0.0.13 to 0.0.14
@@ -41,2 +41,6 @@ import React, {Text, View, Animated, Image, StyleSheet} from 'react-native'; | ||
componentWillMount() { | ||
Object.assign(styles, this.props.styles); | ||
} | ||
renderText(text = "", position) { | ||
@@ -43,0 +47,0 @@ |
@@ -1,4 +0,20 @@ | ||
import React, {View, Text, TouchableHighlight} from 'react-native'; | ||
import React, {View, Text, TouchableHighlight, StyleSheet} from 'react-native'; | ||
import GiftedSpinner from 'react-native-gifted-spinner'; | ||
let styles = StyleSheet.create({ | ||
errorButtonContainer: { | ||
marginLeft: 8, | ||
alignSelf: 'center', | ||
justifyContent: 'center', | ||
backgroundColor: '#e6e6eb', | ||
borderRadius: 15, | ||
width: 30, | ||
height: 30, | ||
}, | ||
errorButton: { | ||
fontSize: 22, | ||
textAlign: 'center', | ||
}, | ||
}); | ||
export default class ErrorButton extends React.Component { | ||
@@ -13,4 +29,9 @@ | ||
componentWillMount() { | ||
Object.assign(styles, this.props.styles); | ||
} | ||
onPress() { | ||
this.setState({ | ||
@@ -26,3 +47,3 @@ isLoading: true, | ||
return ( | ||
<View style={[this.props.styles.errorButtonContainer, { | ||
<View style={[styles.errorButtonContainer, { | ||
backgroundColor: 'transparent', | ||
@@ -36,3 +57,3 @@ borderRadius: 0, | ||
return ( | ||
<View style={this.props.styles.errorButtonContainer}> | ||
<View style={styles.errorButtonContainer}> | ||
<TouchableHighlight | ||
@@ -42,3 +63,3 @@ underlayColor='transparent' | ||
> | ||
<Text style={this.props.styles.errorButton}>↻</Text> | ||
<Text style={styles.errorButton}>↻</Text> | ||
</TouchableHighlight> | ||
@@ -45,0 +66,0 @@ </View> |
@@ -20,3 +20,2 @@ 'use strict'; | ||
var moment = require('moment'); | ||
var extend = require('extend'); | ||
@@ -56,2 +55,3 @@ var Button = require('react-native-button'); | ||
forceRenderImage: false, | ||
onChangeText: (text) => {}, | ||
}; | ||
@@ -85,2 +85,3 @@ }, | ||
forceRenderImage: React.PropTypes.bool, | ||
onChangeText: React.PropTypes.func, | ||
}, | ||
@@ -193,2 +194,4 @@ | ||
renderCustomText={this.props.renderCustomText} | ||
styles={this.styles} | ||
/> | ||
@@ -212,2 +215,4 @@ </View> | ||
} | ||
this.props.onChangeText(text); | ||
}, | ||
@@ -571,3 +576,3 @@ | ||
extend(this.styles, this.props.styles); | ||
Object.assign(this.styles, this.props.styles); | ||
}, | ||
@@ -574,0 +579,0 @@ }); |
@@ -34,15 +34,2 @@ import React, {View, Text, StyleSheet, TouchableHighlight, Image} from 'react-native'; | ||
}, | ||
errorButtonContainer: { | ||
marginLeft: 8, | ||
alignSelf: 'center', | ||
justifyContent: 'center', | ||
backgroundColor: '#e6e6eb', | ||
borderRadius: 15, | ||
width: 30, | ||
height: 30, | ||
}, | ||
errorButton: { | ||
fontSize: 22, | ||
textAlign: 'center', | ||
}, | ||
status: { | ||
@@ -63,2 +50,6 @@ color: '#aaaaaa', | ||
} | ||
componentWillMount() { | ||
Object.assign(styles, this.props.styles); | ||
} | ||
@@ -118,6 +109,3 @@ renderName(name, displayNames, diffMessage){ | ||
rowID={rowID} | ||
styles={{ | ||
errorButtonContainer: styles.errorButtonContainer, | ||
errorButton: styles.errorButton, | ||
}} | ||
styles={styles} | ||
/> | ||
@@ -173,2 +161,4 @@ ) | ||
renderCustomText={this.props.renderCustomText} | ||
styles={styles} | ||
/> | ||
@@ -175,0 +165,0 @@ {rowData.position === 'right' ? this.renderImage(rowData, rowID) : null} |
{ | ||
"name": "react-native-gifted-messenger", | ||
"version": "0.0.13", | ||
"version": "0.0.14", | ||
"description": "The chat of your next React-Native Apps", | ||
@@ -13,3 +13,5 @@ "main": "GiftedMessenger.js", | ||
}, | ||
"author": "Farid from Safi", | ||
"author": { | ||
"name": "Farid from Safi" | ||
}, | ||
"license": "MIT", | ||
@@ -31,7 +33,13 @@ "bugs": { | ||
"dependencies": { | ||
"extend": "^3.0.0", | ||
"moment": "^2.10.6", | ||
"react-native-button": "^1.3.1", | ||
"react-native-gifted-spinner": "0.0.3" | ||
} | ||
}, | ||
"gitHead": "a37196cdb9f528825c81c713844e64ccb0d7e223", | ||
"readme": "# Gifted Messenger\nReady-to-use chat interface for iOS and Android React-Native apps\n\nDependency: React-Native >= v0.18.0-rc (onLayout prop on ListView is required)\n\n\n![](https://raw.githubusercontent.com/FaridSafi/react-native-gifted-messenger/master/screenshots/messenger-1.png)\n![](https://raw.githubusercontent.com/FaridSafi/react-native-gifted-messenger/master/screenshots/messenger-2.png)\n\n\n### Changelog\n- 0.0.11 Split into separate components (PR @Froelund), better performance by removing react-native-invertible-scroll-view\n- 0.0.10 forceRenderImage, onCustomSend, renderCustomText props (PR @oney)\n- 0.0.9 Fix iPhone 6 Plus textInput border\n- 0.0.8 Fix issue with RN 0.16.0 Thanks @wenkesj for PR\n- 0.0.7 Temporary disabling react-native-parsed-text plugin\n\n### Example\n\n```js\nvar GiftedMessenger = require('react-native-gifted-messenger');\nvar {Dimensions} = React;\n\nvar GiftedMessengerExample = React.createClass({\n getMessages() {\n return [\n {text: 'Are you building a chat app?', name: 'React-Native', image: {uri: 'https://facebook.github.io/react/img/logo_og.png'}, position: 'left', date: new Date(2015, 0, 16, 19, 0)},\n {text: \"Yes, and I use Gifted Messenger!\", name: 'Developer', image: null, position: 'right', date: new Date(2015, 0, 17, 19, 0)},\n ];\n },\n handleSend(message = {}, rowID = null) {\n // Send message.text to your server\n },\n handleReceive() {\n this._GiftedMessenger.appendMessage({\n text: 'Received message', \n name: 'Friend', \n image: {uri: 'https://facebook.github.io/react/img/logo_og.png'}, \n position: 'left', \n date: new Date(),\n });\n },\n render() {\n return (\n <GiftedMessenger\n ref={(c) => this._GiftedMessenger = c}\n\n messages={this.getMessages()}\n handleSend={this.handleSend}\n maxHeight={Dimensions.get('window').height - 64} // 64 for the navBar\n \n styles={{\n bubbleLeft: {\n backgroundColor: '#e6e6eb',\n marginRight: 70,\n },\n bubbleRight: {\n backgroundColor: '#007aff',\n marginLeft: 70,\n },\n }}\n />\n );\n },\n});\n```\n\n### Advanced example\n\nSee [GiftedMessengerExample/GiftedMessengerExample.js](https://raw.githubusercontent.com/FaridSafi/react-native-gifted-messenger/master/GiftedMessengerExample/GiftedMessengerExample.js)\n\n\n### Installation\n\n```npm install react-native-gifted-messenger --save```\n\n\n### Props\n\n\n| Props name | Type | Description | Platform | Default |\n| ----------------------------- | -------- | -------------------------------------------------------------------------- | -------- | -------------------------------- |\n| messages | Array | List of messages to display | Both | [] |\n| displayNames | Boolean | Display or not the name of the interlocutor(s) | Both | true |\n| placeholder | String | TextInput placeholder | Both | 'Type a message...' |\n| styles | Function | Styles of children components - See GiftedMessenger.js/componentWillMount | Both | {} |\n| autoFocus | Boolean | TextInput auto focus | Both | true |\n| onErrorButtonPress | Function | Called when the re-send button is pressed | Both | (message, rowID) => {} |\n| loadEarlierMessagesButton | Boolean | Display or not the button to load earlier message | Both | false |\n| loadEarlierMessagesButtonText | String | Label of the 'Load Earlier Messages' button | Both | 'Load earlier messages' |\n| onLoadEarlierMessages | Function | Called when 'Load Earlier Message' button is pressed | Both | (oldestMessage, callback) => {} |\n| handleSend | Function | Called when a message is Sent | Both | (message, rowID) => {} |\n| maxHeight | Integer | Max height of the component | Both | Dimensions.get('window').height |\n| senderName | String | Name of the sender of the messages | Both | 'Sender' |\n| senderImage | Object | Image of the sender | Both | null |\n| sendButtonText | String | 'Send' button label | Both | 'Send' |\n| onImagePress | Function | Called when the image of a message is pressed | Both | (rowData, rowID) => {} |\n| parseText | Boolean | If the text has to be parsed with taskrabbit/react-native-parsed-text | iOS | true |\n| handleUrlPress | Function | Called when a parsed url is pressed | iOS | (url) => {} |\n| handlePhonePress | Function | Called when a parsed phone number is pressed | iOS | (phone) => {} |\n| handleEmailPress | Function | Called when a parsed email is pressed | iOS | (email) => {} |\n| hideTextInput | Boolean | Hide or not the text input | Both | false |\n| keyboardDismissMode | String | Method to dismiss the keyboard when dragging (none, interactive, on-drag) | Both | on-drag |\n| returnKeyType | Boolean | Determine if pressing 'send' will trigger handleSend | iOS | false |\n| submitOnReturn | Boolean | Send message when clicking on submit | Both | false |\n| forceRenderImage | Boolean | Always render the users images (avatar) | Both | false |\n| onCustomSend | Function | If you want to implement a progress bar. See PR #16 | Both | (message) => {} |\n| renderCustomText | Function | Implement your own text rendering | Both | (rowData, rowID) => {} |\n\n\n### Props update\n\nThe UI is updated when receiving new ```messages``` prop.\n\n\n### API\n\n- ```appendMessages(messages = [])``` // Add messages at the end of the list view\n\n- ```appendMessage(message = {})``` // Add 1 message at the end of the list view\n\n- ```prependMessages(messages = [])``` // Add messages at the begining of the list view\n\n- ```prependMessage(message = {})``` // Add 1 message at the begining of the list view\n\n- ```setMessageStatus(status = '', rowID)``` // Set the status of a message ('ErrorButton', 'Sent', 'Seen', 'Anything you want')\n\n- ```getMessage(rowID)``` // Get message object by rowID\n\n- ```getPreviousMessage(rowID)``` // Get previous message object of a rowID\n\n- ```getNextMessage(rowID)``` // Get next message object of a rowID\n\n\n### Message object\n\n```js\nvar message = {\n text: 'Message content', \n name: \"Sender's name\", \n image: {uri: 'https://facebook.github.io/react/img/logo_og.png'}, \n position: 'left', // left if received, right if sent\n date: new Date(),\n // ...any attributes you want\n};\n```\n\n### License\n\n[MIT](LICENSE)\n\n\n\nFeel free to ask me questions on Twitter [@FaridSafi](https://www.twitter.com/FaridSafi) !\n", | ||
"readmeFilename": "README.md", | ||
"_id": "react-native-gifted-messenger@0.0.13", | ||
"_shasum": "5323ecac87e6e4467057d6f963304ec9ca128ad7", | ||
"_from": "git+https://github.com/FaridSafi/react-native-gifted-messenger.git", | ||
"_resolved": "git+https://github.com/FaridSafi/react-native-gifted-messenger.git#a37196cdb9f528825c81c713844e64ccb0d7e223" | ||
} |
# Gifted Messenger | ||
Ready-to-use chat interface for iOS and Android React-Native apps | ||
Dependency: React-Native >= v0.18.0-rc (onLayout prop on ListView is required) | ||
Dependency: React-Native >= v0.18.0 (onLayout prop on ListView is required) | ||
@@ -12,2 +12,3 @@ | ||
### Changelog | ||
- 0.0.14 Bugs fixes | ||
- 0.0.11 Split into separate components (PR @Froelund), better performance by removing react-native-invertible-scroll-view | ||
@@ -110,4 +111,4 @@ - 0.0.10 forceRenderImage, onCustomSend, renderCustomText props (PR @oney) | ||
| renderCustomText | Function | Implement your own text rendering | Both | (rowData, rowID) => {} | | ||
| onChangeText | Function | Called on every keypress in the TextInput | Both | (text) => {} | | ||
### Props update | ||
@@ -114,0 +115,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41869
3
791
156
- Removedextend@^3.0.0
- Removedextend@3.0.2(transitive)