Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
react-native-gifted-chat
Advanced tools
The most complete chat UI for React Native (formerly known as Gifted Messenger)
Use 0.0.10
for RN < 0.40.0
Use 0.1.0
for RN >= 0.40.0
npm install react-native-gifted-chat --save
android:windowSoftInputMode="adjustResize"
to your Android Manifest android/app/src/main/AndroidManifest.xml
<!-- ... -->
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:windowSoftInputMode="adjustResize"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
<!-- ... -->
GiftedChat
inside a Modal
, see #200import { GiftedChat } from 'react-native-gifted-chat';
class Example extends React.Component {
constructor(props) {
super(props);
this.state = {messages: []};
this.onSend = this.onSend.bind(this);
}
componentWillMount() {
this.setState({
messages: [
{
_id: 1,
text: 'Hello developer',
createdAt: new Date(Date.UTC(2016, 7, 30, 17, 20, 0)),
user: {
_id: 2,
name: 'React Native',
avatar: 'https://facebook.github.io/react/img/logo_og.png',
},
},
],
});
}
onSend(messages = []) {
this.setState((previousState) => {
return {
messages: GiftedChat.append(previousState.messages, messages),
};
});
}
render() {
return (
<GiftedChat
messages={this.state.messages}
onSend={this.onSend}
user={{
_id: 1,
}}
/>
);
}
}
See example/App.js
{
_id: 1,
text: 'My message',
createdAt: new Date(Date.UTC(2016, 5, 11, 17, 20, 0)),
user: {
_id: 2,
name: 'React Native',
avatar: 'https://facebook.github.io/react/img/logo_og.png',
},
image: 'https://facebook.github.io/react/img/logo_og.png',
// additional custom parameters
}
messages
(Array) - messages to displaymessageIdGenerator
(Function) - generate id for new message. By default is a UUID v4 generated by uuid.user
(Object) - user sending the messages {_id, name, avatar}
onSend
(Function) - function to call when sending a messagelocale
(String) - localize the datesisAnimated
(Bool) - animates the view when the keyboard appearsloadEarlier
(Bool) - enables the load earlier message buttononLoadEarlier
(Function) - function to call when loading earlier messagesisLoadingEarlier
(Bool) - display an ActivityIndicator when loading earlier messagesrenderLoading
(Function) - render a loading view when initializingrenderLoadEarlier
(Function) - render the load earlier buttonrenderAvatar
(Function) - renders the message avatar. Set to null
to not render any avatar for the messageonPressAvatar
(Function(user
)) - callback when a message avatar is tappedrenderAvatarOnTop
(Bool) - render the message avatar, on top of consecutive messages. The default value is false
.renderBubble
(Function) - render the message bubbleonLongPress
(Function(context
, message
)) - callback when a message bubble is long-pressed (default is to show action sheet with "Copy Text"). See code for example using context.actionSheet().showActionSheetWithOptions()
.renderMessage
(Function) - render the message containerrenderMessageText
(Function) - render the message textrenderMessageImage
(Function) - render the message imageimageProps
(Object) - extra props to be passed to the <Image>
component created by the default renderMessageImage
lightboxProps
(Object) - extra props to be passed to the MessageImage's LightboxrenderCustomView
(Function) - render a custom view inside the bubblerenderDay
(Function) - render the day above a messagerenderTime
(Function) - render the message timerenderFooter
(Function) - renders a fixed bottom view. Can be used for 'is typing message', see example/App.jsrenderInputToolbar
(Function) - render the composer containerrenderActions
(Function) - renders an action button on the left of the message composerrenderComposer
(Function) - render the text input message composerrenderSend
(Function) - render the send buttonrenderAccessory
(Function) - renders a second line of actions below the message composeronPressActionButton
(Function) - callback to perform custom logic when the Action button is pressed (the default actionSheet
will not be used)bottomOffset
(Integer) - distance of the chat from the bottom of the screen, useful if you display a tab barminInputToolbarHeight
(Integer) - minimum height of the input toolbar. The default value is 44
.listViewProps
(Object) - extra props to be passed to the <ListView>
, some props can not be override, see the code in render
method of MessageContainer
for detailkeyboardShouldPersistTaps
(Enum) - determines when the keyboard should stay visible after a tap <ScrollView>
onInputTextChanged
(Function) - function that will be called when input text changesmaxInputLength
(Integer) - max Composer TextInput lengthFeel free to ask me questions on Twitter @FaridSafi !
FAQs
The most complete chat UI for React Native
The npm package react-native-gifted-chat receives a total of 39,587 weekly downloads. As such, react-native-gifted-chat popularity was classified as popular.
We found that react-native-gifted-chat demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.