Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
react-native-gifted-messenger
Advanced tools
Ready-to-use chat interface for iOS and Android React-Native apps
appendMessage
, prependMessage
are now deprecated, messages list are now managed only using states - See exampleuniqueId
propertysetMessageStatus
is now deprecated, use the message attribute status
insteadisLoadingEarlierMessages
to display a loader when loading earlier messagestypingMessage
for displaying 'User is typing a message...'leftControlBar
- PR @gnlreact-native-parsed-text
has been re-implementedSee GiftedMessengerExample/GiftedMessengerContainer.js
npm install react-native-gifted-messenger --save
Props name | Type | Description | Platform | Default |
---|---|---|---|---|
autoFocus | Boolean | TextInput auto focus | Both | true |
blurOnSubmit | Boolean | Dismiss the keyboard when clicking on submit | Both | false |
displayNames | Boolean | Display or not the name of the interlocutor(s) | Both | true |
displayNamesInsideBubble | Boolean | Display the name of the interlocutor(s) inside the bubble | Both | false |
forceRenderImage | Boolean | Always render the users images (avatar) | Both | false |
handleEmailPress | Function | Called when a parsed email is pressed | iOS | (email) => {} |
handlePhonePress | Function | Called when a parsed phone number is pressed | iOS | (phone) => {} |
handleSend | Function | Called when a message is Sent | Both | (message, rowID) => {} |
handleUrlPress | Function | Called when a parsed url is pressed | iOS | (url) => {} |
hideTextInput | Boolean | Hide or not the text input | Both | false |
isLoadingEarlierMessages | Boolean | Display a loader when loading earlier messages | Both | false |
keyboardDismissMode | String | Method to dismiss the keyboard when dragging (none, interactive, on-drag) | Both | interactive |
keyboardShouldPersistTaps | Boolean | When false, tapping the scrollview dismisses the keyboard. | Both | true |
leftControlBar | Element | Optional control element displayed left of the TextInput | Both | null |
loadEarlierMessagesButton | Boolean | Display or not the button to load earlier message | Both | false |
loadEarlierMessagesButtonText | String | Label of the 'Load Earlier Messages' button | Both | 'Load earlier messages' |
maxHeight | Integer | Max height of the component | Both | Dimensions.get('window').height |
messages | Array | List of messages to display | Both | [] |
onChangeText | Function | Called on every keypress in the TextInput | Both | (text) => {} |
onCustomSend | Function | If you want to implement a progress bar. See PR #16 | Both | (message) => {} |
onErrorButtonPress | Function | Called when the re-send button is pressed | Both | (message, rowID) => {} |
onImagePress | Function | Called when the image of a message is pressed | Both | (rowData, rowID) => {} |
onLoadEarlierMessages | Function | Called when 'Load Earlier Message' button is pressed | Both | (oldestMessage, callback) => {} |
onMessageLongPress | Function | Called when doing long press on a message | Both | () => {} |
parseText | Boolean | If the text has to be parsed with taskrabbit/react-native-parsed-text | iOS | true |
placeholder | String | TextInput placeholder | Both | 'Type a message...' |
placeholderTextColor | String | TextInput text color placeholder | Both | '#ccc' |
renderCustomText | Function | Implement your own text rendering | Both | (rowData) => {} |
scrollAnimated | Boolean | do animation when scrolling | Both | true |
sendButtonText | String | 'Send' button label | Both | 'Send' |
senderImage | Object | Image of the sender | Both | null |
senderName | String | Name of the sender of the messages | Both | 'Sender' |
styles | Function | Styles of children components - See GiftedMessenger.js/componentWillMount | Both | {} |
submitOnReturn | Boolean | Send message when clicking on submit | Both | false |
typingMessage | String | Display a text at the bottom of the list. Eg: 'User is typing a message' | Both | '' |
var message = {
uniqueId: 'XXXXX' // each messages should have an unique identifer - mandatory
text: 'Message content',
name: "Sender's name",
image: {uri: 'https://facebook.github.io/react/img/logo_og.png'},
position: 'left', // left for received messages, right for sent messages
date: new Date(),
view: null, // A custom Bubble view - the view will receive the message attributes as props
status: 'Seen', // if status is 'ErrorButton', a re-send button will be displayed
// ...any attributes you want
};
windowSoftInputMode
in your Android Manifest android/app/src/main/AndroidManifest.xml
<!-- ... -->
android:label="@string/app_name"
android:windowSoftInputMode="adjustResize"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
<!-- ... -->
<GiftedMessenger
// ...
maxHeight={Dimensions.get('window').height - Navigator.NavigationBar.Styles.General.NavBarHeight - ExtraDimensions.get('STATUS_BAR_HEIGHT')}
// ...
/>
Feel free to ask me questions on Twitter @FaridSafi !
FAQs
Chat UI for iOS and Android React-Native apps
We found that react-native-gifted-messenger demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.