Skip to content

Commit 276d5b7

Browse files
CRNS-49 and CRNS-50: Exporting all the components and fixing props
1 parent 7b3610a commit 276d5b7

File tree

8 files changed

+240
-8
lines changed

8 files changed

+240
-8
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/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) {

src/components/MessageInput.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,6 @@ const MessageInput = withKeyboardContext(
815815
updateSuggestions={this.props.updateSuggestions}
816816
value={this.state.text}
817817
onChange={this.onChange}
818-
getUsers={this.getUsers}
819818
getCommands={this.getCommands}
820819
setInputBoxRef={this.setInputBoxRef}
821820
triggerSettings={ACITriggerSettings({

src/components/MessageList.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ const MessageList = withChannelContext(
651651
{this.state.newMessagesNotification && (
652652
<MessageNotification
653653
showNotification={this.state.newMessagesNotification}
654-
onClick={this.goToNewMessages}
654+
onPress={this.goToNewMessages}
655655
/>
656656
)}
657657
{!this.state.online && (

src/components/MessageNotification.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ export class MessageNotification extends PureComponent {
3737
/** If we should show the notification or not */
3838
showNotification: PropTypes.bool,
3939
/** Onclick handler */
40-
onClick: PropTypes.func.isRequired,
41-
/** Style overrides */
42-
style: PropTypes.object,
40+
onPress: PropTypes.func.isRequired,
4341
};
4442

4543
static defaultProps = {
@@ -74,7 +72,7 @@ export class MessageNotification extends PureComponent {
7472
opacity: this.state.notificationOpacity,
7573
}}
7674
>
77-
<Container onPress={this.props.onClick} onClick={this.props.onClick}>
75+
<Container onPress={this.props.onPress}>
7876
<MessageNotificationText>New Messages</MessageNotificationText>
7977
</Container>
8078
</Animated.View>

src/components/index.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
export { AutoCompleteInput } from './AutoCompleteInput';
2+
export { Card } from './Card';
3+
export { CommandsItem } from './CommandsItem';
4+
export { DateSeparator } from './DateSeparator';
5+
export { EmptyStateIndicator } from './EmptyStateIndicator';
6+
export { EventIndicator } from './EventIndicator';
7+
export { FileAttachmentGroup } from './FileAttachmentGroup';
8+
export { FileUploadPreview } from './FileUploadPreview';
9+
export { Gallery } from './Gallery';
10+
export { IconSquare } from './IconSquare';
11+
export { ImageUploadPreview } from './ImageUploadPreview';
12+
export { KeyboardCompatibleView } from './KeyboardCompatibleView';
13+
export { LoadingErrorIndicator } from './LoadingErrorIndicator';
14+
export { LoadingIndicator } from './LoadingIndicator';
15+
export { MentionsItem } from './MentionsItem';
16+
export { Message } from './Message';
17+
export { MessageNotification } from './MessageNotification';
18+
export { MessageSystem } from './MessageSystem';
19+
export { ReactionList } from './ReactionList';
20+
export { Spinner } from './Spinner';
21+
export { SuggestionsProvider } from './SuggestionsProvider';
22+
export { UploadProgressIndicator } from './UploadProgressIndicator';
23+
export { Attachment } from './Attachment';
24+
export { AttachmentActions } from './AttachmentActions';
125
export { Avatar } from './Avatar';
226
export { Chat } from './Chat';
327
export { Channel } from './Channel';

src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ export {
77
withChannelContext,
88
SuggestionsContext,
99
withSuggestionsContext,
10+
KeyboardContext,
11+
withKeyboardContext,
1012
} from './context.js';
1113

1214
export { MESSAGE_ACTIONS, renderText } from './utils';

types/index.d.ts

Lines changed: 207 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ interface AttachmentProps {
188188
The handler function to call when an action is selected on an attachment.
189189
Examples include canceling a \/giphy command or shuffling the results.
190190
*/
191-
actionHandler(): void;
191+
actionHandler?(name: string, value: string): any;
192192
groupStyle: 'single' | 'top' | 'middle' | 'bottom';
193193
}
194194

@@ -365,6 +365,15 @@ interface MessageProps extends KeyboardContextValue {
365365
setEditingState?(message: Client.Message): void;
366366
/** Function executed when user clicks on link to open thread */
367367
openThread?(message: Client.Message, event: React.SyntheticEvent): void;
368+
channel: Client.Channel;
369+
editing: boolean | Client.MessageResponse;
370+
messageActions: boolean | string[];
371+
dismissKeyboard?(): void;
372+
onMessageTouch?(
373+
e: GestureResponderEvent,
374+
message: Client.MessageResponse,
375+
): void;
376+
dismissKeyboardOnMessageTouch: boolean;
368377
}
369378

370379
interface MessageUIComponentProps extends MessageProps, KeyboardContextValue {
@@ -425,6 +434,203 @@ interface FileIconUIComponentProps {
425434
mimeType?: string;
426435
}
427436

437+
interface AutoCompleteInputProps {
438+
value: string;
439+
openSuggestions?(title: string, component: React.ElementType<any, any>): void;
440+
closeSuggestions?(): void;
441+
updateSuggestions?(param: object): void;
442+
triggerSettings: object;
443+
setInputBoxRef?(ref: any): void;
444+
onChange?(text: string): void;
445+
additionalTextInputProps: object;
446+
}
447+
448+
interface CardProps {
449+
title: string;
450+
title_link: string;
451+
og_scrape_url: string;
452+
image_url: string;
453+
thumb_url: string;
454+
text: string;
455+
type: string;
456+
alignment: 'right' | 'left';
457+
onLongPress?: (event: GestureResponderEvent) => void;
458+
}
459+
460+
interface CommandsItemProps {
461+
name: string;
462+
args: string;
463+
description: string;
464+
}
465+
466+
interface DateSeparatorProps {
467+
message: Client.MessageResponse;
468+
formatDate?(date: Date): string;
469+
}
470+
interface EmptyStateIndicatorProps {
471+
listType: 'string';
472+
}
473+
interface EventIndicatorProps {
474+
event: Client.Event;
475+
}
476+
interface FileAttachmentGroupProps {
477+
messageId: string;
478+
files: [];
479+
handleAction?(): void;
480+
alignment: 'right' | 'left';
481+
AttachmentFileIcon: React.ElementType<any, any>;
482+
}
483+
interface FileUploadPreviewProps {
484+
fileUploads: [];
485+
removeFile?(id: string): void;
486+
retryUpload?(id: string): Promise<any>;
487+
AttachmentFileIcon: React.ElementType<any, any>;
488+
}
489+
interface GalleryProps {
490+
images: Client.Attachment[];
491+
onLongPress: (event: GestureResponderEvent) => void;
492+
alignment: 'right' | 'left';
493+
}
494+
interface IconSquareProps {
495+
icon: string;
496+
onPress?(event: GestureResponderEvent): void;
497+
}
498+
interface ImageUploadPreviewProps {
499+
imageUploads: Array<{
500+
[id: string]: {
501+
id: string;
502+
file: File;
503+
status: string;
504+
};
505+
}>;
506+
removeImage?(id: string): void;
507+
retryUpload?(id: string): Promise<any>;
508+
}
509+
interface KeyboardCompatibleViewProps {}
510+
interface LoadingErrorIndicatorProps {
511+
listType: string;
512+
}
513+
interface LoadingIndicatorProps {
514+
listType: 'channel' | 'message' | 'default';
515+
}
516+
interface MentionsItemProps {
517+
item: {
518+
name?: string;
519+
icon: string;
520+
id?: string;
521+
};
522+
}
523+
524+
interface MessageNotificationProps {
525+
showNotification: boolean;
526+
onPress?(event: GestureResponderEvent): void;
527+
}
528+
529+
interface MessageSystemProps {
530+
message: Client.MessageResponse;
531+
}
532+
533+
interface ReactionListProps {
534+
latestReactions: any;
535+
openReactionSelector?(event: GestureResponderEvent): void;
536+
getTotalReactionCount?(): string | number;
537+
visible: boolean;
538+
position: string;
539+
}
540+
541+
interface SpinnerProps {}
542+
543+
interface SuggestionsProviderProps {
544+
active: boolean;
545+
marginLeft: string | number;
546+
width: string | number;
547+
suggestions: object;
548+
backdropHeight: string | number;
549+
handleDismiss?(event: GestureResponderEvent): void;
550+
suggestionsTitle: string;
551+
}
552+
interface UploadProgressIndicatorProps {
553+
active: boolean;
554+
type: 'in_progress' | 'retry';
555+
action?(event: GestureResponderEvent): void;
556+
}
557+
558+
interface AttachmentActionsProps {
559+
text: string;
560+
actions: Client.Action[];
561+
actionHandler?(name: string, value: string): any;
562+
}
563+
564+
export class AutoCompleteInput extends React.PureComponent<
565+
AutoCompleteInputProps,
566+
any
567+
> {}
568+
export class Card extends React.PureComponent<CardProps, any> {}
569+
export class CommandsItem extends React.PureComponent<CommandsItemProps, any> {}
570+
export class DateSeparator extends React.PureComponent<
571+
DateSeparatorProps,
572+
any
573+
> {}
574+
export class EmptyStateIndicator extends React.PureComponent<
575+
EmptyStateIndicatorProps,
576+
any
577+
> {}
578+
export class EventIndicator extends React.PureComponent<
579+
EventIndicatorProps,
580+
any
581+
> {}
582+
export class FileAttachmentGroup extends React.PureComponent<
583+
FileAttachmentGroupProps,
584+
any
585+
> {}
586+
export class FileUploadPreview extends React.PureComponent<
587+
FileUploadPreviewProps,
588+
any
589+
> {}
590+
export class Gallery extends React.PureComponent<GalleryProps, any> {}
591+
export class IconSquare extends React.PureComponent<IconSquareProps, any> {}
592+
export class ImageUploadPreview extends React.PureComponent<
593+
ImageUploadPreviewProps,
594+
any
595+
> {}
596+
export class KeyboardCompatibleView extends React.PureComponent<
597+
KeyboardCompatibleViewProps,
598+
any
599+
> {}
600+
export class LoadingErrorIndicator extends React.PureComponent<
601+
LoadingErrorIndicatorProps,
602+
any
603+
> {}
604+
export class LoadingIndicator extends React.PureComponent<
605+
LoadingIndicatorProps,
606+
any
607+
> {}
608+
export class MentionsItem extends React.PureComponent<MentionsItemProps, any> {}
609+
export class Message extends React.PureComponent<MessageProps, any> {}
610+
export class MessageNotification extends React.PureComponent<
611+
MessageNotificationProps,
612+
any
613+
> {}
614+
export class MessageSystem extends React.PureComponent<
615+
MessageSystemProps,
616+
any
617+
> {}
618+
export class ReactionList extends React.PureComponent<ReactionListProps, any> {}
619+
export class Spinner extends React.PureComponent<SpinnerProps, any> {}
620+
export class SuggestionsProvider extends React.PureComponent<
621+
SuggestionsProviderProps,
622+
any
623+
> {}
624+
export class UploadProgressIndicator extends React.PureComponent<
625+
UploadProgressIndicatorProps,
626+
any
627+
> {}
628+
export class Attachment extends React.PureComponent<AttachmentProps, any> {}
629+
export class AttachmentActions extends React.PureComponent<
630+
AttachmentActionsProps,
631+
any
632+
> {}
633+
428634
export class Avatar extends React.PureComponent<AvatarProps, any> {}
429635
export class Chat extends React.PureComponent<ChatProps, any> {}
430636
export class Channel extends React.PureComponent<ChannelProps, any> {}

0 commit comments

Comments
 (0)