Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
chat-engine-react-native
Advanced tools
Reusable react native components for quickly creating a mobile app with chat functionality using Chat Engine.
To get started with chat-engine-react-native
create-react-native-app <name>
npm install --save chat-engine-react-native
Get a chatroom up in running in just a few lines of code
import React from "react";
import { StyleSheet, Text, View, Platform, StatusBar } from "react-native";
import ChatEngineCore from "chat-engine";
import typingIndicator from "chat-engine-typing-indicator";
import {MessageEntry} from "chat-engine-react-native";
import {MessageList} from "chat-engine-react-native";
const ChatEngine = ChatEngineCore.create({
publishKey: "<Insert PubNub publish key here>",
subscribeKey: "<Insert PubNub subscribe key here>"
});
const now = new Date().getTime();
const username = ['user', now].join('-');
export default class App extends React.Component {
constructor(props) {
super(props);
this.state = {
chat: null,
renderChat: false,
me: null,
};
}
componentDidMount() {
//chatengine throws some warning about timing that is a part of the library itself
console.disableYellowBox = true;
ChatEngine.connect(username, {
signedOnTime: now
}, 'auth-key');
ChatEngine.on("$.ready", data => {
const me = data.me;
let chat = new ChatEngine.Chat('MyChat');
chat.plugin(typingIndicator({ timeout: 5000 })); //set this if you want your message entry to have a typing indicator
this.setState({chat: chat, renderChat: true, me: data.me});
});
}
render() {
return (
<View style={styles.container}>
{!this.state.renderChat ? (
<Text> Loading </Text>
) : (
<View style={{flex:1}}>
{Platform.OS === 'ios' && <StatusBar barStyle="default" />}
{Platform.OS === 'android' && <View style={styles.statusBarUnderlay} />}
<MessageList chat={this.state.chat} me={this.state.me}/>
<MessageEntry chat={this.state.chat} typingIndicator />
</View>
)}
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
},
statusBarUnderlay: {
height: 24,
backgroundColor: 'rgba(0,0,0,0.2)',
},
});
<MessageList chat={someChatObject} me={meUserObject} />
<MessageEntry chat={someChatObject} /> // optional prop of TypingIndicator to show typing indicator
<UserList chat={someChatObject} />
<ChatList chatList={chatList} />
Every component requires passing in a chat prop so the react native component knows what to interact with.
FAQs
Reusable react native components for quickly creating a mobile app with chat functionality using Chat Engine.
The npm package chat-engine-react-native receives a total of 1 weekly downloads. As such, chat-engine-react-native popularity was classified as not popular.
We found that chat-engine-react-native 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.