Skip to content

Commit c74115d

Browse files
PhotoMessage width and height props added.
1 parent 00f832c commit c74115d

4 files changed

Lines changed: 12 additions & 1 deletion

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ import { MessageBox } from 'react-chat-elements'
7979
| onClick | none | function | message on click (message(object) is returned) |
8080
| onOpen | none | function | message on open (file or photo) (message(object) is returned) |
8181
| onDownload | none | function | message on download (file or photo) (message(object) is returned) |
82+
| width | none | int | only photo width (optional) |
83+
| height | none | int | only photo height (optional) |
8284

8385

8486
## SystemMessage Component

example/App.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ export class App extends Component {
6262
position: (this.token() >= 1 ? 'right' : 'left'),
6363
type: type,
6464
text: loremIpsum({ count: 1, units: 'sentences' }),
65+
width: 300,
66+
height: 300,
6567
data: {
6668
uri: `data:image/png;base64,${this.photo(150)}`,
6769
status: {

src/MessageBox/MessageBox.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ export class MessageBox extends Component {
3131
onOpen={this.props.onOpen}
3232
onDownload={this.props.onDownload}
3333
data={this.props.data}
34+
width={this.props.width}
35+
height={this.props.height}
3436
text={this.props.text}/>
3537
}
3638
{

src/PhotoMessage/PhotoMessage.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@ export class PhotoMessage extends Component {
2828

2929
return (
3030
<div className="rce-mbox-photo">
31-
<div className="rce-mbox-photo--img">
31+
<div
32+
className="rce-mbox-photo--img"
33+
style={this.props.width && this.props.height && {
34+
width: this.props.width,
35+
height: this.props.height,
36+
}}>
3237
<img src={this.props.data.uri} alt={this.props.data.alt} onClick={this.props.onOpen}/>
3338
{
3439
this.props.data.status &&

0 commit comments

Comments
 (0)