Skip to content

Commit c93fa27

Browse files
author
Dan Carbonell
committed
Merge branch 'master' into feature/async-image-upload
2 parents 27c4152 + fc07b17 commit c93fa27

File tree

8 files changed

+31
-40
lines changed

8 files changed

+31
-40
lines changed

docs/cookbook.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,11 +1326,14 @@ For setup regarding push notifications, first of all make sure you have followed
13261326

13271327
### Requirements
13281328

1329-
- User must be a member of channel, if he expects a push notification for a message on that channel.
1329+
- User must be a member of channel if they expect a push notification for a message on that channel.
13301330

13311331
- We only send a push notification, when user is **NOT** connected to chat, or in other words, if user does **NOT** have any active WS (websocket) connection. WS connection is established when you do
13321332

1333-
`await client.setUser({ id: 'user_id' })`.
1333+
```js
1334+
await client.setUser({ id: 'user_id' })
1335+
await client.addDevice(token.token, token.os === 'ios' ? 'apn' : 'firebase')
1336+
```
13341337

13351338
### Caveats
13361339

src/components/Attachment.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,28 +48,28 @@ export const Attachment = withMessageContentContext(
4848
additionalTouchableProps: PropTypes.object,
4949
/**
5050
* Custom UI component to display enriched url preview.
51-
* Deaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Card.js
51+
* Defaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Card.js
5252
*/
5353
UrlPreview: PropTypes.oneOfType([
5454
PropTypes.node,
5555
PropTypes.elementType,
5656
]),
5757
/**
5858
* Custom UI component to display Giphy image.
59-
* Deaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Card.js
59+
* Defaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Card.js
6060
*/
6161
Giphy: PropTypes.oneOfType([PropTypes.node, PropTypes.elementType]),
6262
/**
6363
* Custom UI component to display group of File type attachments or multiple file attachments (in single message).
64-
* Deaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/FileAttachmentGroup.js
64+
* Defaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/FileAttachmentGroup.js
6565
*/
6666
FileAttachmentGroup: PropTypes.oneOfType([
6767
PropTypes.node,
6868
PropTypes.elementType,
6969
]),
7070
/**
7171
* Custom UI component to display File type attachment.
72-
* Deaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/FileAttachment.js
72+
* Defaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/FileAttachment.js
7373
*/
7474
FileAttachment: PropTypes.oneOfType([
7575
PropTypes.node,
@@ -85,12 +85,12 @@ export const Attachment = withMessageContentContext(
8585
]),
8686
/**
8787
* Custom UI component to display image attachments.
88-
* Deaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Gallery.js
88+
* Defaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Gallery.js
8989
*/
9090
Gallery: PropTypes.oneOfType([PropTypes.node, PropTypes.elementType]),
9191
/**
9292
* Custom UI component to display generic media type e.g. giphy, url preview etc
93-
* Deaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Card.js
93+
* Defaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Card.js
9494
*/
9595
Card: PropTypes.oneOfType([PropTypes.node, PropTypes.elementType]),
9696
/**
@@ -116,7 +116,7 @@ export const Attachment = withMessageContentContext(
116116
]),
117117
/**
118118
* Custom UI component to display attachment actions. e.g., send, shuffle, cancel in case of giphy
119-
* Deaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/AttachmentActions.js
119+
* Defaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/AttachmentActions.js
120120
*/
121121
AttachmentActions: PropTypes.oneOfType([
122122
PropTypes.node,

src/components/ChannelInner.js

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ class ChannelInner extends PureComponent {
140140
getInitialStateFromProps(props) {
141141
return {
142142
error: false,
143-
// Loading the intial content of the channel
143+
// Loading the initial content of the channel
144144
loading: true,
145145
// Loading more messages
146146
loadingMore: false,
@@ -155,7 +155,6 @@ class ChannelInner extends PureComponent {
155155
threadMessages: [],
156156
threadLoadingMore: false,
157157
threadHasMore: true,
158-
kavEnabled: true,
159158
/** We save the events in state so that we can display event message
160159
* next to the message after which it was received, in MessageList.
161160
*
@@ -651,8 +650,6 @@ class ChannelInner extends PureComponent {
651650
this.props.disableIfFrozenChannel,
652651
});
653652

654-
renderComponent = () => this.props.children;
655-
656653
renderLoading = () => {
657654
const Indicator = this.props.LoadingIndicator;
658655
return <Indicator listType="message" />;
@@ -665,7 +662,7 @@ class ChannelInner extends PureComponent {
665662

666663
render() {
667664
let core;
668-
const { KeyboardCompatibleView, t } = this.props;
665+
const { children, KeyboardCompatibleView, t } = this.props;
669666
if (this.state.error) {
670667
this.props.logger(
671668
'Channel component',
@@ -693,14 +690,7 @@ class ChannelInner extends PureComponent {
693690
enabled={!this.props.disableKeyboardCompatibleView}
694691
>
695692
<ChannelContext.Provider value={this.getContext()}>
696-
<SuggestionsProvider
697-
handleKeyboardAvoidingViewEnabled={(trueOrFalse) => {
698-
if (this._unmounted) return;
699-
this.setState({ kavEnabled: trueOrFalse });
700-
}}
701-
>
702-
{this.renderComponent()}
703-
</SuggestionsProvider>
693+
<SuggestionsProvider>{children}</SuggestionsProvider>
704694
</ChannelContext.Provider>
705695
</KeyboardCompatibleView>
706696
);

src/components/Chat.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ export const Chat = themed(
165165
this._unmounted = true;
166166
this.props.client.off('connection.recovered');
167167
this.props.client.off('connection.changed');
168-
this.props.client.off(this.handleEvent);
169168
this.unsubscribeNetInfo && this.unsubscribeNetInfo();
170169
}
171170

src/components/MessageInput.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,7 @@ class MessageInput extends PureComponent {
918918
break;
919919
default:
920920
}
921-
}, 10);
921+
}, 201); // 201ms to fire after the animation is complete https://github.com/beefe/react-native-actionsheet/blob/master/lib/ActionSheetCustom.js#L78
922922
}}
923923
styles={this.props.actionSheetStyles}
924924
/>

src/components/MessageSimple/MessageContent.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -298,25 +298,25 @@ class MessageContent extends React.PureComponent {
298298
MessageText: PropTypes.oneOfType([PropTypes.node, PropTypes.elementType]),
299299
/**
300300
* Custom UI component to display enriched url preview.
301-
* Deaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Card.js
301+
* Defaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Card.js
302302
*/
303303
UrlPreview: PropTypes.oneOfType([PropTypes.node, PropTypes.elementType]),
304304
/**
305305
* Custom UI component to display Giphy image.
306-
* Deaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Card.js
306+
* Defaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Card.js
307307
*/
308308
Giphy: PropTypes.oneOfType([PropTypes.node, PropTypes.elementType]),
309309
/**
310310
* Custom UI component to display group of File type attachments or multiple file attachments (in single message).
311-
* Deaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/FileAttachmentGroup.js
311+
* Defaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/FileAttachmentGroup.js
312312
*/
313313
FileAttachmentGroup: PropTypes.oneOfType([
314314
PropTypes.node,
315315
PropTypes.elementType,
316316
]),
317317
/**
318318
* Custom UI component to display File type attachment.
319-
* Deaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/FileAttachment.js
319+
* Defaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/FileAttachment.js
320320
*/
321321
FileAttachment: PropTypes.oneOfType([
322322
PropTypes.node,
@@ -332,12 +332,12 @@ class MessageContent extends React.PureComponent {
332332
]),
333333
/**
334334
* Custom UI component to display image attachments.
335-
* Deaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Gallery.js
335+
* Defaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Gallery.js
336336
*/
337337
Gallery: PropTypes.oneOfType([PropTypes.node, PropTypes.elementType]),
338338
/**
339339
* Custom UI component to display generic media type e.g. giphy, url preview etc
340-
* Deaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Card.js
340+
* Defaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Card.js
341341
*/
342342
Card: PropTypes.oneOfType([PropTypes.node, PropTypes.elementType]),
343343
/**
@@ -357,7 +357,7 @@ class MessageContent extends React.PureComponent {
357357
CardFooter: PropTypes.oneOfType([PropTypes.node, PropTypes.elementType]),
358358
/**
359359
* Custom UI component to display attachment actions. e.g., send, shuffle, cancel in case of giphy
360-
* Deaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/AttachmentActions.js
360+
* Defaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/AttachmentActions.js
361361
*/
362362
AttachmentActions: PropTypes.oneOfType([
363363
PropTypes.node,

src/components/MessageSimple/index.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,25 +77,25 @@ export const MessageSimple = themed(
7777
MessageText: PropTypes.oneOfType([PropTypes.node, PropTypes.elementType]),
7878
/**
7979
* Custom UI component to display enriched url preview.
80-
* Deaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Card.js
80+
* Defaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Card.js
8181
*/
8282
UrlPreview: PropTypes.oneOfType([PropTypes.node, PropTypes.elementType]),
8383
/**
8484
* Custom UI component to display Giphy image.
85-
* Deaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Card.js
85+
* Defaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Card.js
8686
*/
8787
Giphy: PropTypes.oneOfType([PropTypes.node, PropTypes.elementType]),
8888
/**
8989
* Custom UI component to display group of File type attachments or multiple file attachments (in single message).
90-
* Deaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/FileAttachmentGroup.js
90+
* Defaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/FileAttachmentGroup.js
9191
*/
9292
FileAttachmentGroup: PropTypes.oneOfType([
9393
PropTypes.node,
9494
PropTypes.elementType,
9595
]),
9696
/**
9797
* Custom UI component to display File type attachment.
98-
* Deaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/FileAttachment.js
98+
* Defaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/FileAttachment.js
9999
*/
100100
FileAttachment: PropTypes.oneOfType([
101101
PropTypes.node,
@@ -111,12 +111,12 @@ export const MessageSimple = themed(
111111
]),
112112
/**
113113
* Custom UI component to display image attachments.
114-
* Deaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Gallery.js
114+
* Defaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Gallery.js
115115
*/
116116
Gallery: PropTypes.oneOfType([PropTypes.node, PropTypes.elementType]),
117117
/**
118118
* Custom UI component to display generic media type e.g. giphy, url preview etc
119-
* Deaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Card.js
119+
* Defaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Card.js
120120
*/
121121
Card: PropTypes.oneOfType([PropTypes.node, PropTypes.elementType]),
122122
/**
@@ -136,7 +136,7 @@ export const MessageSimple = themed(
136136
CardFooter: PropTypes.oneOfType([PropTypes.node, PropTypes.elementType]),
137137
/**
138138
* Custom UI component to display attachment actions. e.g., send, shuffle, cancel in case of giphy
139-
* Deaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/AttachmentActions.js
139+
* Defaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/AttachmentActions.js
140140
*/
141141
AttachmentActions: PropTypes.oneOfType([
142142
PropTypes.node,

types/index.d.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// TypeScript Version: 2.8
22

33
import * as React from 'react';
4-
import { Text, GestureResponderEvent, FlatList } from 'react-native';
4+
import { FlatList, GestureResponderEvent } from 'react-native';
55
import * as Client from 'stream-chat';
66
import * as SeamlessImmutable from 'seamless-immutable';
77
import * as i18next from 'i18next';
@@ -100,7 +100,6 @@ export interface ChannelContextValue {
100100
threadMessages?: Client.MessageResponse[];
101101
threadLoadingMore?: boolean;
102102
threadHasMore?: boolean;
103-
kavEnabled?: boolean;
104103

105104
sendMessage?(message: Client.Message): void;
106105
/** The function to update a message, handled by the Channel component */

0 commit comments

Comments
 (0)