Skip to content

Commit 8f8b713

Browse files
Merge pull request #66 from Detaysoft/next
onLoad event added on PhotoMessage
2 parents 187e066 + 5a36009 commit 8f8b713

5 files changed

Lines changed: 13 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ import { MessageBox } from 'react-chat-elements'
133133
| onClick | none | function | message on click (message(object) is returned) |
134134
| onOpen | none | function | message on open (file or photo) (message(object) is returned) |
135135
| onDownload | none | function | message on download (file or photo) (message(object) is returned) |
136+
| onLoad | none | function | message on load photo |
136137
| onTitleClick | none | function | message title on click event |
137138
| onForwardClick | none | function | message forward on click event |
138139
| forwarded | none | boolean | message forward icon |

example/App.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ export class App extends Component {
109109
latitude: '37.773972',
110110
longitude: '-122.431297',
111111
},
112+
onLoad: () => {
113+
console.log('Photo loaded');
114+
},
112115
status: status,
113116
date: new Date(),
114117
dateString: moment(new Date()).format('HH:mm'),

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-chat-elements",
3-
"version": "10.0.0",
3+
"version": "10.0.1",
44
"description": "Reactjs chat components",
55
"author": "Avare Kodcu <abdurrahmaneker58@gmail.com>",
66
"main": "dist/main.js",

src/MessageBox/MessageBox.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ export class MessageBox extends Component {
110110
<PhotoMessage
111111
onOpen={this.props.onOpen}
112112
onDownload={this.props.onDownload}
113+
onLoad={this.props.onLoad}
113114
data={this.props.data}
114115
width={this.props.width}
115116
height={this.props.height}
@@ -220,6 +221,7 @@ MessageBox.defaultProps = {
220221
onClick: null,
221222
onOpen: null,
222223
onDownload: null,
224+
onLoad: null,
223225
forwarded: false,
224226
status: null,
225227
dateString: null,

src/PhotoMessage/PhotoMessage.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ export class PhotoMessage extends Component {
3434
width: this.props.data.width,
3535
height: this.props.data.height,
3636
}}>
37-
<img src={this.props.data.uri} alt={this.props.data.alt} onClick={this.props.onOpen}/>
37+
<img
38+
src={this.props.data.uri}
39+
alt={this.props.data.alt}
40+
onClick={this.props.onOpen}
41+
onLoad={this.props.onLoad}/>
3842
{
3943
this.props.data.status &&
4044
!this.props.data.status.download &&
@@ -75,6 +79,7 @@ PhotoMessage.defaultProps = {
7579
data: {},
7680
onDownload: null,
7781
onOpen: null,
82+
onLoad: null,
7883
};
7984

8085

0 commit comments

Comments
 (0)