Skip to content

Commit dced018

Browse files
Merge pull request #106 from GetStream/vishal/props-fixes
CRNS-49 and CRNS-50: Exporting all the components and fixing props
2 parents 7b3610a + 9e3064d commit dced018

23 files changed

+423
-40
lines changed

src/components/AutoCompleteInput.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ export class AutoCompleteInput extends React.PureComponent {
1414
value: PropTypes.string,
1515
openSuggestions: PropTypes.func,
1616
closeSuggestions: PropTypes.func,
17+
updateSuggestions: PropTypes.func,
1718
triggerSettings: PropTypes.object,
18-
getUsers: PropTypes.func,
1919
setInputBoxRef: PropTypes.func,
20+
onChange: PropTypes.func,
2021
/**
2122
* Additional props for underlying TextInput component. These props will be forwarded as it is to TextInput component.
2223
*

src/components/Card.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export const Card = withMessageContentContext(
4747
static themePath = 'card';
4848
static propTypes = {
4949
/** Title retured by the OG scraper */
50-
title: PropTypes.string.isRequired,
50+
title: PropTypes.string,
5151
/** Link retured by the OG scraper */
5252
title_link: PropTypes.string,
5353
/** The scraped url, used as a fallback if the OG-data doesnt include a link */

src/components/ChannelListMessenger.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const ChannelListMessenger = withChatContext(
2525
}),
2626
PropTypes.object,
2727
]).isRequired,
28+
setActiveChannel: PropTypes.func,
2829
/** UI Component to display individual channel item in list.
2930
* Defaults to [ChannelPreviewMessenger](https://getstream.github.io/stream-chat-react-native/#channelpreviewmessenger) */
3031
Preview: PropTypes.oneOfType([PropTypes.node, PropTypes.elementType]),

src/components/ChannelPreview.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export class ChannelPreview extends PureComponent {
1717
static propTypes = {
1818
channel: PropTypes.object.isRequired,
1919
client: PropTypes.object.isRequired,
20-
setActiveChannel: PropTypes.func.isRequired,
20+
setActiveChannel: PropTypes.func,
2121
Preview: PropTypes.oneOfType([PropTypes.node, PropTypes.elementType]),
2222
};
2323

src/components/ChannelPreviewMessenger.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ export const ChannelPreviewMessenger = themed(
120120
</Title>
121121
<Date>{this.props.latestMessage.created_at}</Date>
122122
</DetailsTop>
123-
<Message unread={this.props.unread > 0}>
123+
<Message
124+
unread={this.props.unread > 0 ? this.props.unread : undefined}
125+
>
124126
{!this.props.latestMessage
125127
? 'Nothing yet...'
126128
: truncate(

src/components/Chat.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export const Chat = themed(
9393
this.props.client.off('connection.recovered');
9494
this.props.client.off('connection.changed');
9595
this.props.client.off(this.handleEvent);
96-
this.unsubscribeNetInfo();
96+
this.unsubscribeNetInfo && this.unsubscribeNetInfo();
9797
}
9898

9999
notifyChatClient = (isConnected) => {

src/components/CommandsItem.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
22
import { Text } from 'react-native';
33
import styled from '@stream-io/styled-components';
4+
import PropTypes from 'prop-types';
45

56
const Container = styled.View`
67
flex-direction: column;
@@ -20,6 +21,12 @@ const Title = styled.Text`
2021
`;
2122

2223
export class CommandsItem extends React.Component {
24+
static propTypes = {
25+
name: PropTypes.string,
26+
args: PropTypes.string,
27+
description: PropTypes.string,
28+
};
29+
2330
render() {
2431
const {
2532
item: { name, args, description },

src/components/DateSeparator.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22
import styled from '@stream-io/styled-components';
33
import Moment from 'moment';
44
import { themed } from '../styles/theme';
5+
import PropTypes from 'prop-types';
56

67
const Container = styled.View`
78
display: flex;
@@ -45,6 +46,11 @@ const Date = styled.Text`
4546

4647
export const DateSeparator = themed(
4748
class DateSeparator extends React.PureComponent {
49+
static propTypes = {
50+
message: PropTypes.object.isRequired,
51+
formatDate: PropTypes.func,
52+
};
53+
4854
static themePath = 'messageList.dateSeparator';
4955

5056
render() {

src/components/EventIndicator.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22
import styled from '@stream-io/styled-components';
33
import Moment from 'moment';
44
import { Avatar } from './Avatar';
5+
import PropTypes from 'prop-types';
56

67
const Date = styled.Text`
78
font-size: 10;
@@ -58,4 +59,8 @@ const EventIndicator = ({ event }) => {
5859
return null;
5960
};
6061

62+
EventIndicator.propTypes = {
63+
event: PropTypes.object,
64+
};
65+
6166
export { EventIndicator };

src/components/Gallery.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ export const Gallery = withMessageContentContext(
6666
thumb_url: PropTypes.string,
6767
}),
6868
),
69+
onLongPress: PropTypes.func,
70+
alignment: PropTypes.string,
6971
};
7072

7173
constructor(props) {

0 commit comments

Comments
 (0)