0.1.2 • Published 2 years ago
@devpranavsharma/react-native-chat-box v0.1.2
react-native-chat-box
a fully customisable chat component
Installation
npm i @devpranavsharma/react-native-chat-boxUsage
import { 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>
);Props
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
Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT