react-native-gifted-messenger
Advanced tools
Comparing version 0.0.20 to 0.0.21
@@ -51,2 +51,3 @@ 'use strict'; | ||
onImagePress: null, | ||
onMessageLongPress: null, | ||
hideTextInput: false, | ||
@@ -65,2 +66,3 @@ submitOnReturn: false, | ||
onErrorButtonPress: React.PropTypes.func, | ||
loadMessagesLater: React.PropTypes.bool, | ||
loadEarlierMessagesButton: React.PropTypes.bool, | ||
@@ -83,2 +85,3 @@ loadEarlierMessagesButtonText: React.PropTypes.string, | ||
onImagePress: React.PropTypes.func, | ||
onMessageLongPress: React.PropTypes.func, | ||
hideTextInput: React.PropTypes.bool, | ||
@@ -193,2 +196,3 @@ forceRenderImage: React.PropTypes.bool, | ||
onImagePress={this.props.onImagePress} | ||
onMessageLongPress={this.props.onMessageLongPress} | ||
renderCustomText={this.props.renderCustomText} | ||
@@ -227,5 +231,8 @@ | ||
} else { | ||
this.setState({ | ||
allLoaded: true | ||
}); | ||
// Set allLoaded, unless props.loadMessagesLater is set | ||
if (!this.props.loadMessagesLater) { | ||
this.setState({ | ||
allLoaded: true | ||
}); | ||
} | ||
} | ||
@@ -256,4 +263,12 @@ | ||
onKeyboardDidShow(e) { | ||
if(React.Platform.OS == 'android') { | ||
this.onKeyboardWillShow(e); | ||
} | ||
this.scrollToBottom(); | ||
}, | ||
onKeyboardDidHide(e) { | ||
if(React.Platform.OS == 'android') { | ||
this.onKeyboardWillHide(e); | ||
} | ||
}, | ||
@@ -273,4 +288,4 @@ scrollToBottom() { | ||
this.scrollResponder.scrollTo({ | ||
y: -scrollDistance, | ||
x: 0, | ||
y: -scrollDistance, | ||
x: 0, | ||
animated: false, | ||
@@ -292,3 +307,3 @@ }); | ||
} else { | ||
var rowID = this.appendMessage(message); | ||
var rowID = this.appendMessage(message, true); | ||
this.props.handleSend(message, rowID); | ||
@@ -459,2 +474,3 @@ this.onChangeText(''); | ||
onKeyboardWillHide={this.onKeyboardWillHide} | ||
onKeyboardDidHide={this.onKeyboardDidHide} | ||
@@ -506,2 +522,3 @@ /* | ||
onSubmitEditing={this.props.submitOnReturn ? this.onSend : null} | ||
enablesReturnKeyAutomatically={true} | ||
@@ -512,2 +529,3 @@ blurOnSubmit={false} | ||
style={this.styles.sendButton} | ||
styleDisabled={this.styles.sendButtonDisabled} | ||
onPress={this.onSend} | ||
@@ -514,0 +532,0 @@ disabled={this.state.disabled} |
@@ -79,3 +79,2 @@ import React, {View, Text, StyleSheet, TouchableHighlight, Image} from 'react-native'; | ||
onPress={() => onImagePress(rowData, rowID)} | ||
style={styles.imagePosition} | ||
> | ||
@@ -138,3 +137,4 @@ <Image source={rowData.image} style={[styles.imagePosition, styles.image, (rowData.position === 'left' ? styles.imageLeft : styles.imageRight)]}/> | ||
forceRenderImage, | ||
onImagePress | ||
onImagePress, | ||
onMessageLongPress, | ||
} = this.props; | ||
@@ -152,21 +152,33 @@ | ||
return ( | ||
var messageView = ( | ||
<View> | ||
{position === 'left' ? this.renderName(rowData.name, displayNames, diffMessage) : null} | ||
<View style={[styles.rowContainer, { | ||
justifyContent: position==='left'?"flex-start":"flex-end" | ||
}]}> | ||
{position === 'left' ? this.renderImage(rowData, rowID, diffMessage, forceRenderImage, onImagePress) : null} | ||
{position === 'right' ? this.renderErrorButton(rowData, rowID, onErrorButtonPress) : null} | ||
<RowView | ||
{...rowData} | ||
renderCustomText={this.props.renderCustomText} | ||
styles={styles} | ||
/> | ||
{rowData.position === 'right' ? this.renderImage(rowData, rowID, diffMessage, forceRenderImage, onImagePress) : null} | ||
{position === 'left' ? this.renderName(rowData.name, displayNames, diffMessage) : null} | ||
<View style={[styles.rowContainer, { | ||
justifyContent: position==='left'?"flex-start":"flex-end" | ||
}]}> | ||
{position === 'left' ? this.renderImage(rowData, rowID, diffMessage, forceRenderImage, onImagePress) : null} | ||
{position === 'right' ? this.renderErrorButton(rowData, rowID, onErrorButtonPress) : null} | ||
<RowView | ||
{...rowData} | ||
renderCustomText={this.props.renderCustomText} | ||
styles={styles} | ||
/> | ||
{rowData.position === 'right' ? this.renderImage(rowData, rowID, diffMessage, forceRenderImage, onImagePress) : null} | ||
</View> | ||
{rowData.position === 'right' ? this.renderStatus(rowData.status) : null} | ||
</View> | ||
{rowData.position === 'right' ? this.renderStatus(rowData.status) : null} | ||
</View> | ||
) | ||
); | ||
if (typeof onMessageLongPress === 'function') { | ||
return ( | ||
<TouchableHighlight | ||
underlayColor='transparent' | ||
onLongPress={() => onMessageLongPress(rowData, rowID)}> | ||
{messageView} | ||
</TouchableHighlight> | ||
); | ||
} else { | ||
return messageView; | ||
} | ||
} | ||
} |
{ | ||
"name": "react-native-gifted-messenger", | ||
"version": "0.0.20", | ||
"version": "0.0.21", | ||
"description": "The chat of your next React-Native Apps", | ||
@@ -5,0 +5,0 @@ "main": "GiftedMessenger.js", |
# Gifted Messenger | ||
Ready-to-use chat interface for iOS and Android React-Native apps | ||
Dependency: React-Native >= v0.18.0 (onLayout prop on ListView is required) | ||
Dependency: React-Native >= v0.20.0 (scrollTo is now using {x, y, animated}) | ||
@@ -12,2 +12,3 @@ | ||
### Changelog | ||
- 0.0.21 Updating example for RN 0.20.0 | ||
- 0.0.20 scrollTo support for react-native 0.20.0 | ||
@@ -14,0 +15,0 @@ - 0.0.19 Fix scrollWithoutAnimationTo for react-native 0.19.0 |
193531
44
1108
161