From c74115de2815250264b6a6ec693fa3983f79d18e Mon Sep 17 00:00:00 2001 From: abdurrahmanekr Date: Tue, 5 Sep 2017 16:01:56 +0300 Subject: [PATCH] PhotoMessage width and height props added. --- README.md | 2 ++ example/App.js | 2 ++ src/MessageBox/MessageBox.js | 2 ++ src/PhotoMessage/PhotoMessage.js | 7 ++++++- 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6519e6a5..ef2dc544 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,8 @@ import { MessageBox } from 'react-chat-elements' | onClick | none | function | message on click (message(object) is returned) | | onOpen | none | function | message on open (file or photo) (message(object) is returned) | | onDownload | none | function | message on download (file or photo) (message(object) is returned) | +| width | none | int | only photo width (optional) | +| height | none | int | only photo height (optional) | ## SystemMessage Component diff --git a/example/App.js b/example/App.js index 10bc0a1c..4bea86d7 100644 --- a/example/App.js +++ b/example/App.js @@ -62,6 +62,8 @@ export class App extends Component { position: (this.token() >= 1 ? 'right' : 'left'), type: type, text: loremIpsum({ count: 1, units: 'sentences' }), + width: 300, + height: 300, data: { uri: `data:image/png;base64,${this.photo(150)}`, status: { diff --git a/src/MessageBox/MessageBox.js b/src/MessageBox/MessageBox.js index 69c78df8..66b2a028 100644 --- a/src/MessageBox/MessageBox.js +++ b/src/MessageBox/MessageBox.js @@ -31,6 +31,8 @@ export class MessageBox extends Component { onOpen={this.props.onOpen} onDownload={this.props.onDownload} data={this.props.data} + width={this.props.width} + height={this.props.height} text={this.props.text}/> } { diff --git a/src/PhotoMessage/PhotoMessage.js b/src/PhotoMessage/PhotoMessage.js index a8653c1f..bec154ab 100644 --- a/src/PhotoMessage/PhotoMessage.js +++ b/src/PhotoMessage/PhotoMessage.js @@ -28,7 +28,12 @@ export class PhotoMessage extends Component { return (
-
+
{this.props.data.alt} { this.props.data.status &&