Skip to content

Commit bb6fabd

Browse files
committed
conflict fixed
2 parents 671ac01 + 7244d27 commit bb6fabd

File tree

27 files changed

+2410
-2404
lines changed

27 files changed

+2410
-2404
lines changed

CHANGELOG.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
<details open>
2+
<summary>11.0.0 Updates</summary>
3+
<br>
4+
5+
This update target to fix component ref broken problems
6+
7+
Fixed issues:
8+
9+
- https://github.com/Detaysoft/react-chat-elements/issues/158
10+
- https://github.com/Detaysoft/react-chat-elements/issues/157
11+
- https://github.com/Detaysoft/react-chat-elements/issues/142
12+
13+
1. All react-chat-elements components turneded to function component for "ref" property problems.
14+
15+
2. In the [Input](https://github.com/Detaysoft/react-chat-elements#input-component) component `referance={...}` instead of use `ref={...}`
16+
17+
3. **10.16.2** and before vesion usage
18+
19+
**Before usage**: this.refs.input.clear();
20+
21+
After **11.0.0** version usage is:
22+
23+
```js
24+
import { Input } from 'react-chat-elements'
25+
26+
<Input
27+
ref='input'
28+
placeholder="Type here..."
29+
multiline={true}
30+
.
31+
.
32+
.
33+
/>
34+
```
35+
36+
New usage in **class component**: clearRef();
37+
38+
```js
39+
40+
import { Input } from 'react-chat-elements'
41+
let clearRef = () => {};
42+
this.inputReferance = React.createRef();
43+
44+
<Input
45+
referance={this.inputReferance}
46+
clear={(clear) => clearRef = clear}
47+
placeholder="Type here..."
48+
multiline={true}
49+
.
50+
.
51+
.
52+
/>
53+
54+
```
55+
56+
New usage in **function component**: clearRef();
57+
58+
```js
59+
60+
import { Input } from 'react-chat-elements'
61+
let clearRef = () => {};
62+
const inputReferance = React.useRef();
63+
64+
<Input
65+
referance={inputReferance}
66+
clear={(clear) => clearRef = clear}
67+
placeholder="Type here..."
68+
multiline={true}
69+
.
70+
.
71+
.
72+
/>
73+
74+
```
75+
76+
4. In the [MessageList](https://github.com/Detaysoft/react-chat-elements#messagelist-component) component usage `referance={...}` instead of use `ref={...}`
77+
78+
**Class Component:**
79+
80+
```js
81+
import { MessageList } from 'react-chat-elements'
82+
this.messageList = React.createRef();
83+
84+
<MessageList
85+
referance={this.messageList}
86+
className='message-list'
87+
lockable={true}
88+
toBottomHeight={'100%'}
89+
dataSource={[
90+
{
91+
position: 'right',
92+
type: 'text',
93+
text: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit',
94+
date: new Date(),
95+
},
96+
.
97+
.
98+
.
99+
]} />
100+
```
101+
102+
**Function Component:**
103+
104+
```js
105+
import { MessageList } from 'react-chat-elements'
106+
const messageListReferance = React.useRef();
107+
108+
<MessageList
109+
referance={messageListReferance}
110+
className='message-list'
111+
lockable={true}
112+
toBottomHeight={'100%'}
113+
dataSource={[
114+
{
115+
position: 'right',
116+
type: 'text',
117+
text: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit',
118+
date: new Date(),
119+
},
120+
.
121+
.
122+
.
123+
]} />
124+
```
125+
126+
</details>

README.md

Lines changed: 359 additions & 362 deletions
Large diffs are not rendered by default.

example/App.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ function App() {
270270
var list = messageList;
271271
list.push(random('message', mtype));
272272
setMessageList(list);
273+
clearRef();
273274
forceUpdate();
274275
}
275276

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.16.2",
3+
"version": "11.0.0",
44
"description": "Reactjs chat components",
55
"author": "Avare Kodcu <[email protected]>",
66
"main": "dist/main.js",

src/AudioMessage/AudioMessage.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,29 @@ import React from 'react';
22

33
import './AudioMessage.css';
44

5-
export default class AudioMessage extends React.PureComponent {
6-
render() {
7-
const audioURL = this.props.data.audioURL;
8-
const controlsList = this.props.data.controlsList;
5+
function AudioMessage({ data, text }) {
6+
const audioURL = data.audioURL;
7+
const controlsList = data.controlsList;
98

10-
return (
11-
<div className={'rce-mbox-audio'}>
12-
<audio controls controlsList={controlsList ? controlsList : "nodownload"}>
13-
<source src={audioURL} type="audio/mp3"/>
14-
Your browser does not support the audio element.
15-
</audio>
9+
return (
10+
<div className={'rce-mbox-audio'}>
11+
<audio controls controlsList={controlsList ? controlsList : 'nodownload'}>
12+
<source src={audioURL} type='audio/mp3'/>
13+
Your browser does not support the audio element.
14+
</audio>
1615

17-
{
18-
this.props.text &&
19-
<div className='rce-mbox-text'>
20-
{this.props.text}
21-
</div>
22-
}
23-
</div>
24-
);
25-
}
16+
{
17+
text &&
18+
<div className='rce-mbox-text'>
19+
{text}
20+
</div>
21+
}
22+
</div>
23+
);
2624
}
2725

2826
AudioMessage.defaultProps = {
29-
data: {},
27+
data: {},
3028
};
29+
30+
export default AudioMessage;

0 commit comments

Comments
 (0)