# react-native-chatbox **Repository Path**: humengqiao/react-native-chatbox ## Basic Information - **Project Name**: react-native-chatbox - **Description**: 一个类似qq聊天页底部输入组件,可以实现录音,发送文字和表情等 - **Primary Language**: JavaScript - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 6 - **Forks**: 0 - **Created**: 2018-03-22 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ![npm version](https://img.shields.io/npm/v/react-native-chatbox.svg?style=flat) ![npm downloads](https://img.shields.io/npm/dm/react-native-chatbox.svg?style=flat) # react-native-chatbox a multifunctional input box ``` you must place this component last which in a flexbox container ``` # Install ``` npm install react-native-chatbox --save or yarn add react-native-chatbox ``` ## Demo ``` import React, { Component } from 'react'; import { Platform, StyleSheet, Text, View } from 'react-native'; import Chatbox from 'react-native-chatbox'; export default class App extends Component{ render() { const extras = [ { extraStyle: { }, onExtraClick: () => {console.log('click extra1')}, icon: require('./images/11.png'), extraIconStyle: { width: 40, height: 40 }, textStyle: { color: 'red' }, text: 'extra条目1' }, { extraStyle: { }, onExtraClick: () => {console.log('click extra2')}, icon: require('./images/12.png'), extraIconStyle: { width: 40, height: 40 }, textStyle: { color: 'blue' }, text: 'extra条目2' } ] const emojis = new Map( ["grinning", "😀"], ["grin", "😁"], ["joy", "😂"], ["smiley", "😃"], ["smile", "😄"], ["sweat_smile", "😅"], ["laughing", "😆"]) return ( Chatbox Component Demo {console.log('start record')}} onStopRecord={() => {console.log('stop record')}} onSendTextMessage={message => {console.log(message)}} extras={extras} emojis={emojis}/> ); } } const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'flex-end', alignItems: 'center', backgroundColor: '#F5FCFF', } }); ``` ## Props
Prop name Desciption Type Default
emojis render the emoji icon PropTypes.Object
containerStyle chatbox container style ViewPropTypes.style {}
extraContainerStyle extra panel container style ViewPropTypes.style {}
emojiContainerStyle emoji panel container style ViewPropTypes.style {}
onStartRecord record start call the function PropTypes.func.isRequired
onStopRecord record stop call the function PropTypes.func.isRequired
onSendTextMessage click send button call the function(pattern: message => {}) PropTypes.func.isRequired
extras pass this props will expand when you toggle the extra button PropTypes.array(PropTypes.object) []
``` extras param pattern: [ { extraStyle: { }, onExtraClick: () => {console.log('click extra1')}, icon: require('./images/11.png'), extraIconStyle: { width: 40, height: 40 }, textStyle: { color: 'red' }, text: 'extra条目1' } ] ```