Skip to content

Commit bc1fb30

Browse files
authored
Merge pull request #112 from GetStream/vishal/props-fixes
CRNS-49: Docs for missing components
2 parents 46b577a + 9ad3665 commit bc1fb30

20 files changed

+496
-242
lines changed

src/components/AutoCompleteInput.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,17 @@ const InputBox = styled.TextInput`
1212
export class AutoCompleteInput extends React.PureComponent {
1313
static propTypes = {
1414
value: PropTypes.string,
15+
/** @see See [suggestions context](https://getstream.github.io/stream-chat-react-native/#suggestionscontext) */
1516
openSuggestions: PropTypes.func,
17+
/** @see See [suggestions context](https://getstream.github.io/stream-chat-react-native/#suggestionscontext) */
1618
closeSuggestions: PropTypes.func,
19+
/** @see See [suggestions context](https://getstream.github.io/stream-chat-react-native/#suggestionscontext) */
1720
updateSuggestions: PropTypes.func,
1821
triggerSettings: PropTypes.object,
1922
setInputBoxRef: PropTypes.func,
23+
/**
24+
* @param text string
25+
*/
2026
onChange: PropTypes.func,
2127
/**
2228
* Additional props for underlying TextInput component. These props will be forwarded as it is to TextInput component.

src/components/CloseButton.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,5 @@ export const CloseButton = themed(
2727
}
2828
},
2929
);
30+
31+
CloseButton.propTypes = {};

src/components/CommandsItem.js

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

67
const Container = styled.View`
78
flex-direction: column;
@@ -20,26 +21,33 @@ const Title = styled.Text`
2021
${({ theme }) => theme.messageInput.suggestions.command.title.css}
2122
`;
2223

23-
export class CommandsItem extends React.Component {
24-
static propTypes = {
25-
name: PropTypes.string,
26-
args: PropTypes.string,
27-
description: PropTypes.string,
28-
};
24+
/**
25+
* @example ./docs/CommandsItem.md
26+
* @extends PureComponent
27+
*/
28+
export const CommandsItem = themed(
29+
class CommandsItem extends React.Component {
30+
static themePath = 'messageInput.suggestions.command';
31+
static propTypes = {
32+
name: PropTypes.string,
33+
args: PropTypes.string,
34+
description: PropTypes.string,
35+
};
2936

30-
render() {
31-
const {
32-
item: { name, args, description },
33-
} = this.props;
37+
render() {
38+
const {
39+
item: { name, args, description },
40+
} = this.props;
3441

35-
return (
36-
<Container>
37-
<Top>
38-
<Title>/{name} </Title>
39-
<Text>{args}</Text>
40-
</Top>
41-
<Text>{description}</Text>
42-
</Container>
43-
);
44-
}
45-
}
42+
return (
43+
<Container>
44+
<Top>
45+
<Title>/{name} </Title>
46+
<Text>{args}</Text>
47+
</Top>
48+
<Text>{description}</Text>
49+
</Container>
50+
);
51+
}
52+
},
53+
);

src/components/FileIcon.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,6 @@ function mimeTypeToIcon(mimeType) {
201201
return iconDOC;
202202
}
203203

204-
/**
205-
* @example ./examples/FileIcon.md
206-
*/
207204
export class FileIcon extends React.Component {
208205
render() {
209206
const { mimeType, size } = this.props;

src/components/Gallery.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ const ImageContainer = styled.TouchableOpacity`
5353
length !== 3 ? theme.message.gallery.size : theme.message.gallery.halfSize};
5454
${({ theme }) => theme.message.gallery.imageContainer.css}
5555
`;
56+
/**
57+
* UI component for card in attachments.
58+
*
59+
* @example ./docs/Gallery.md
60+
*/
5661

5762
export const Gallery = withMessageContentContext(
5863
themed(

src/components/MessageNotification.js

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

67
const Container = styled.TouchableOpacity`
78
display: flex;
@@ -14,69 +15,74 @@ const Container = styled.TouchableOpacity`
1415
margin-bottom: 0;
1516
border-radius: 13px;
1617
background-color: ${({ theme }) => theme.colors.primary};
17-
color: white;
1818
transform: translateY(9px);
19-
${({ theme }) => theme.messageList.messageNotification.css}
19+
${({ theme }) => theme.messageList.messageNotification.container.css}
2020
`;
2121

2222
const MessageNotificationText = styled.Text`
2323
color: white;
2424
font-size: 12px;
2525
font-weight: 600;
26-
${({ theme }) => theme.messageList.messageNotificationText.css}
26+
${({ theme }) => theme.messageList.messageNotification.text.css}
2727
`;
28-
29-
export class MessageNotification extends PureComponent {
30-
constructor(props) {
31-
super(props);
32-
this.state = {
33-
notificationOpacity: new Animated.Value(0),
28+
/**
29+
* @example ./docs/MessageNotification.md
30+
* @extends PureComponent
31+
*/
32+
export const MessageNotification = themed(
33+
class MessageNotification extends PureComponent {
34+
static themePath = 'messageList.messageNotification';
35+
constructor(props) {
36+
super(props);
37+
this.state = {
38+
notificationOpacity: new Animated.Value(0),
39+
};
40+
}
41+
static propTypes = {
42+
/** If we should show the notification or not */
43+
showNotification: PropTypes.bool,
44+
/** Onclick handler */
45+
onPress: PropTypes.func.isRequired,
3446
};
35-
}
36-
static propTypes = {
37-
/** If we should show the notification or not */
38-
showNotification: PropTypes.bool,
39-
/** Onclick handler */
40-
onPress: PropTypes.func.isRequired,
41-
};
42-
43-
static defaultProps = {
44-
showNotification: true,
45-
};
4647

47-
componentDidMount() {
48-
Animated.timing(this.state.notificationOpacity, {
49-
toValue: this.props.showNotification ? 1 : 0,
50-
duration: 500,
51-
}).start();
52-
}
48+
static defaultProps = {
49+
showNotification: true,
50+
};
5351

54-
componentDidUpdate(prevProps) {
55-
if (prevProps.showNotification !== this.props.showNotification) {
52+
componentDidMount() {
5653
Animated.timing(this.state.notificationOpacity, {
5754
toValue: this.props.showNotification ? 1 : 0,
5855
duration: 500,
5956
}).start();
6057
}
61-
}
6258

63-
render() {
64-
if (!this.props.showNotification) {
65-
return null;
66-
} else {
67-
return (
68-
<Animated.View
69-
style={{
70-
position: 'absolute',
71-
bottom: 0,
72-
opacity: this.state.notificationOpacity,
73-
}}
74-
>
75-
<Container onPress={this.props.onPress}>
76-
<MessageNotificationText>New Messages</MessageNotificationText>
77-
</Container>
78-
</Animated.View>
79-
);
59+
componentDidUpdate(prevProps) {
60+
if (prevProps.showNotification !== this.props.showNotification) {
61+
Animated.timing(this.state.notificationOpacity, {
62+
toValue: this.props.showNotification ? 1 : 0,
63+
duration: 500,
64+
}).start();
65+
}
66+
}
67+
68+
render() {
69+
if (!this.props.showNotification) {
70+
return null;
71+
} else {
72+
return (
73+
<Animated.View
74+
style={{
75+
position: 'absolute',
76+
bottom: 0,
77+
opacity: this.state.notificationOpacity,
78+
}}
79+
>
80+
<Container onPress={this.props.onPress}>
81+
<MessageNotificationText>New Messages</MessageNotificationText>
82+
</Container>
83+
</Animated.View>
84+
);
85+
}
8086
}
81-
}
82-
}
87+
},
88+
);

0 commit comments

Comments
 (0)