mirror of
https://github.com/zhigang1992/react-native-gifted-chat.git
synced 2026-04-29 12:45:47 +08:00
Add timeFormat prop (#273)
* Added property for time format * Added property to readme
This commit is contained in:
committed by
Kevin Cooper
parent
1e79078265
commit
187cf521c7
@@ -107,6 +107,7 @@ e.g.
|
||||
- **`user`** _(Object)_ - User sending the messages: `{ _id, name, avatar }`
|
||||
- **`onSend`** _(Function)_ - Callback when sending a message
|
||||
- **`locale`** _(String)_ - Locale to localize the dates
|
||||
- **`timeFormat`** _(String)_ - Format to use for rendering times; default is 'LT'
|
||||
- **`isAnimated`** _(Bool)_ - Animates the view when the keyboard appears
|
||||
- **`loadEarlier`** _(Bool)_ - Enables the "Load earlier messages" button
|
||||
- **`onLoadEarlier`** _(Function)_ - Callback when loading earlier messages
|
||||
|
||||
@@ -14,7 +14,7 @@ export default class Time extends React.Component {
|
||||
return (
|
||||
<View style={[styles[this.props.position].container, this.props.containerStyle[this.props.position]]}>
|
||||
<Text style={[styles[this.props.position].text, this.props.textStyle[this.props.position]]}>
|
||||
{moment(this.props.currentMessage.createdAt).locale(this.context.getLocale()).format('LT')}
|
||||
{moment(this.props.currentMessage.createdAt).locale(this.context.getLocale()).format(this.props.timeFormat)}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
@@ -65,6 +65,7 @@ Time.defaultProps = {
|
||||
},
|
||||
containerStyle: {},
|
||||
textStyle: {},
|
||||
timeFormat: 'LT'
|
||||
};
|
||||
|
||||
Time.propTypes = {
|
||||
@@ -78,4 +79,5 @@ Time.propTypes = {
|
||||
left: Text.propTypes.style,
|
||||
right: Text.propTypes.style,
|
||||
}),
|
||||
timeFormat: React.PropTypes.string
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user