a fully customisable chat component
npm i @devpranavsharma/react-native-chat-boximport { ChatBox } from 'react-native-chat-box';
// ...
const [messages, setMessages] = React.useState([
{ text: 'Hey', user: false, id: '123' },
{ text: 'Hey! How are you', user: true, id: '124' },
]);
return (
<SafeAreaView>
<ChatBox
name={'Pranav Sharma'}
messages={messages}
onSend={(message) => setMessages([...messages, message])}
/>
</SafeAreaView>
);name(String) - Name of the person to show in the headermessages(TMessage[]) - Messages to display e.g [{ text: 'Hey', user: false, id: '123' }]onSend(Function) - Callback when sending a messageheaderColor(ColorValue) - value for header background colorheaderTextColor(ColorValue) - value for header text colorheaderTextStyles(Object) - styles for header textheaderStyles(Object) - styles for header textchatBubbleColor(ColorValue) - chat bubble colorchatBubbleTextColor(Object) - color for bubble textchatBubbleStyle(Object) - styles for chat bubble viewchatBubbleTextStyle(Object) - styles for chat bubble textlistScrollProps(Object) - props for the FlatListlistScrollStyle(Object) - styles for the FlatListtextInputProps(Object) - props for the text inputtextInputStyle(Object) - styles for the text inputsendBtnStyle(Object) - styles for the send Button ContainerCustomSend(Component) - Custom component to replace Send button
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT