mirror of
https://github.com/zhigang1992/react-native-gifted-chat.git
synced 2026-01-12 22:50:22 +08:00
Add prop to always show send button (#717)
* Add prop to always show send button * Clarify alwaysShowSend usage
This commit is contained in:
committed by
Xavier Carpentier
parent
10f0a42d5a
commit
a830d65cb6
@@ -152,6 +152,7 @@ e.g. System Message
|
||||
* **`messageIdGenerator`** _(Function)_ - Generate an id for new messages. Defaults to UUID v4, generated by [uuid](https://github.com/kelektiv/node-uuid)
|
||||
* **`user`** _(Object)_ - User sending the messages: `{ _id, name, avatar }`
|
||||
* **`onSend`** _(Function)_ - Callback when sending a message
|
||||
* **`alwaysShowSend`** _(Bool)_ - Always show send button in input text composer; default `false`, show only when text input is not empty
|
||||
* **`locale`** _(String)_ - Locale to localize the dates
|
||||
* **`timeFormat`** _(String)_ - Format to use for rendering times; default is `'LT'`
|
||||
* **`dateFormat`** _(String)_ - Format to use for rendering dates; default is `'ll'`
|
||||
|
||||
@@ -5,8 +5,8 @@ import React from 'react';
|
||||
import { StyleSheet, Text, TouchableOpacity, View, ViewPropTypes } from 'react-native';
|
||||
import Color from './Color';
|
||||
|
||||
export default function Send({ text, containerStyle, onSend, children, textStyle, label }) {
|
||||
if (text.trim().length > 0) {
|
||||
export default function Send({ text, containerStyle, onSend, children, textStyle, label, alwaysShowSend }) {
|
||||
if (alwaysShowSend || text.trim().length > 0) {
|
||||
return (
|
||||
<TouchableOpacity
|
||||
style={[styles.container, containerStyle]}
|
||||
@@ -45,6 +45,7 @@ Send.defaultProps = {
|
||||
containerStyle: {},
|
||||
textStyle: {},
|
||||
children: null,
|
||||
alwaysShowSend: false,
|
||||
};
|
||||
|
||||
Send.propTypes = {
|
||||
@@ -54,4 +55,5 @@ Send.propTypes = {
|
||||
containerStyle: ViewPropTypes.style,
|
||||
textStyle: Text.propTypes.style,
|
||||
children: PropTypes.element,
|
||||
alwaysShowSend: PropTypes.bool,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user