
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
react-native-chat-bubble
Advanced tools
React Native Chat bubble is a simple lightweight component for your React Native Applications which uses react-native-svg and react-native-size-matters to create a highly customizable chat bubble for you with curved tail or without.
react-native-chat-bubble
has two peer dependencies:
react-native-svg
and react-native-size-matters
You must install these alongside react-native-chat-bubble
.
Install the package using npm or yarn:
npm install react-native-chat-bubble react-native-svg react-native-size-matters
yarn add react-native-chat-bubble react-native-svg react-native-size-matters
If you're using Expo, make sure to use the expo install command to install these packages to ensure compatibility with your Expo SDK version:
expo install react-native-chat-bubble
expo install react-native-svg
expo install react-native-size-matters
import ChatBubble from 'react-native-chat-bubble';
<ChatBubble
isOwnMessage={true}
bubbleColor='#1084ff'
tailColor='#1084ff'
withTail={true}
onPress={() => console.log("Bubble Pressed!")}
>
<Text>Your message content</Text>
</ChatBubble>
Check the example
The SwipeableFlatList component accepts the following props:
If you don't pass onPress function, the chat bubble wrapper will be a View from react-native and you can also pass the rest of the ViewProps, which you can check here
If you pass the onPress function, the package will wrap the ChatBubble in Pressable from react-native to call your function when the user presses the message, so you can also pass the rest of the PressableProps, which you can check here
boolean
Prop to identify the message and therefore the alignment.
ReactNode
The message content.
string
Color of your chat bubble. Defaults to #1084ff for own messages and grey for others.
string
Color of the tail of the chat bubble. If you pass a bubbleColor prop and your tail and the bubble are the same color, you don't need to use this prop, they'll match automatically.
boolean
Prop which defines if the tail is displayed with your message. Defaults to true
.
boolean
Prop which defines if the tail is displayed with your message. Defaults to true
.
({top: number, bottom: number, left: number, right: number})
increase the touchable area of the chat bubble.
number
Maximum width of your chat bubble. When adjusting maxWidth this prop should be used instead of a style override, in order to use moderateScale
. Defaults to 250
StyleProp<ViewStyle>
Additional styles or style overrides for the chat bubble.
This project is licensed under the MIT License.
react-native-chat-bubble
has a peer dependency on react-native-svg
and react-native-size-matters
. It will be installed automatically when you install this package. However, please ensure that your project meets the requirements for both of these libraries.
import React from 'react';
import { Alert, Image, StyleSheet, Text, View } from 'react-native';
import ChatBubble from "react-native-chat-bubble";
const App: React.FC = () => {
return (
<View style={styles.container}>
<ChatBubble
isOwnMessage={true}
bubbleColor="#1084ff"
tailColor="#1084ff"
withTail={true}
style={styles.chatBubble}
>
<Text style={styles.textOwn}>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quas atque repudiandae alias nisi aut? Ut perferendis similique non vel! Blanditiis nihil enim culpa ex numquam commodi saepe? Non, ex recusandae.</Text>
</ChatBubble>
<ChatBubble
onPress={() => Alert.alert("Hi", "This is alert")}
isOwnMessage={false}
bubbleColor="lightgrey"
withTail={true}
style={styles.chatBubble}
>
<Text style={styles.text}>hi.</Text>
</ChatBubble>
<ChatBubble
isOwnMessage={true}
bubbleColor="#1084ff"
tailColor="#1084ff"
withTail={true}
style={styles.chatBubble}
>
<Text style={styles.textOwn}>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quas atque repudiandae alias nisi aut? Ut perferendis similique non vel! Blanditiis nihil enim culpa ex numquam commodi saepe? Non, ex recusandae.</Text>
</ChatBubble>
<ChatBubble
isOwnMessage={true}
bubbleColor="#1084ff"
tailColor="#1084ff"
withTail={true}
style={styles.chatBubble}
>
<Image style={{height:100, width:100}}
resizeMode="contain"
resizeMethod="resize"
source={{uri: "https://raw.githubusercontent.com/GFean/rn-gesture-swipeable-flatlist-example/main/assets/favicon.png"}}/>
</ChatBubble>
</View>
);
};
const styles = StyleSheet.create({
container: {
marginTop:100,
flex: 1,
paddingHorizontal:10
},
chatBubble: {
padding: 10,
},
text: {
color: 'black',
},
textOwn: {
color: 'white',
},
});
export default App
FAQs
"chat bubble for react-native"
The npm package react-native-chat-bubble receives a total of 71 weekly downloads. As such, react-native-chat-bubble popularity was classified as not popular.
We found that react-native-chat-bubble 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.