2018-09-11 16:32:52 +00:00
import React from 'react' ;
import { ScrollView , StyleSheet } from 'react-native' ;
2019-04-08 12:35:28 +00:00
// import moment from 'moment';
2018-09-11 16:32:52 +00:00
import MessageComponent from '../../app/containers/message/Message' ;
import StoriesSeparator from './StoriesSeparator' ;
import messagesStatus from '../../app/constants/messagesStatus' ;
import MessageSeparator from '../../app/views/RoomView/Separator' ;
const styles = StyleSheet . create ( {
separator : {
2019-03-27 20:06:57 +00:00
marginTop : 30 ,
marginBottom : 0
2018-09-11 16:32:52 +00:00
}
} ) ;
const user = {
id : 'y8bd77ptZswPj3EW8' ,
username : 'diego.mello' ,
token : '79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz'
} ;
const author = {
_id : 'userid' ,
username : 'diego.mello'
} ;
const baseUrl = 'https://open.rocket.chat' ;
const customEmojis = { react _rocket : 'png' , nyan _rocket : 'png' , marioparty : 'gif' } ;
const date = new Date ( 2017 , 10 , 10 , 10 ) ;
2019-04-17 17:01:03 +00:00
const longText = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.' ;
2018-09-11 16:32:52 +00:00
const Message = props => (
< MessageComponent
baseUrl = { baseUrl }
customEmojis = { customEmojis }
user = { user }
author = { author }
ts = { date }
timeFormat = 'LT'
header
{ ... props }
/ >
) ;
// eslint-disable-next-line react/prop-types
const Separator = ( { title } ) => < StoriesSeparator title = { title } style = { styles . separator } / > ;
export default (
2019-03-27 20:06:57 +00:00
< ScrollView style = { { flex : 1 } } contentContainerStyle = { { marginVertical : 30 } } >
2018-09-11 16:32:52 +00:00
< Separator title = 'Simple' / >
2019-03-27 20:06:57 +00:00
< Message msg = 'Message' / >
2018-09-11 16:32:52 +00:00
< Separator title = 'Long message' / >
2019-04-17 17:01:03 +00:00
< Message msg = { longText } / >
2018-09-11 16:32:52 +00:00
2019-03-27 20:06:57 +00:00
< Separator title = 'Grouped messages' / >
2018-09-11 16:32:52 +00:00
< Message msg = '...' / >
< Message
msg = 'Different user'
author = { {
... author ,
2019-04-17 17:01:03 +00:00
username : longText
2018-09-11 16:32:52 +00:00
} }
/ >
< Message msg = 'This is the third message' header = { false } / >
< Message msg = 'This is the second message' header = { false } / >
< Message msg = 'This is the first message' / >
< Separator title = 'Without header' / >
2019-03-27 20:06:57 +00:00
< Message msg = 'Message' header = { false } / >
2018-09-11 16:32:52 +00:00
< Separator title = 'With alias' / >
2019-03-27 20:06:57 +00:00
< Message msg = 'Message' alias = 'Diego Mello' / >
2019-03-29 19:36:07 +00:00
< Message
msg = 'Message'
author = { {
... author ,
2019-04-17 17:01:03 +00:00
username : longText
2019-03-29 19:36:07 +00:00
} }
alias = 'Diego Mello'
/ >
2018-09-11 16:32:52 +00:00
< Separator title = 'Edited' / >
2019-03-27 20:06:57 +00:00
< Message msg = 'Message' edited / >
2018-09-11 16:32:52 +00:00
2019-03-27 20:06:57 +00:00
< Separator title = 'Static avatar' / >
2018-09-11 16:32:52 +00:00
< Message
msg = 'Message'
avatar = 'https://pbs.twimg.com/profile_images/1016397063649660929/14EIApTi_400x400.jpg'
/ >
2019-03-27 20:06:57 +00:00
< Separator title = 'Full name' / >
2018-09-11 16:32:52 +00:00
< Message
msg = 'Message'
author = { {
... author ,
username : 'diego.mello' ,
name : 'Diego Mello'
} }
useRealName
/ >
< Separator title = 'Mentions' / >
2019-03-27 20:06:57 +00:00
< Message msg = '@rocket.cat @diego.mello @all @here #general' / >
2018-09-11 16:32:52 +00:00
< Separator title = 'Emojis' / >
2019-03-27 20:06:57 +00:00
< Message msg = '👊🤙👏' / >
2018-09-11 16:32:52 +00:00
< Separator title = 'Custom Emojis' / >
2019-03-27 20:06:57 +00:00
< Message msg = ':react_rocket: :nyan_rocket: :marioparty:' / >
2018-09-11 16:32:52 +00:00
< Separator title = 'Time format' / >
2019-03-27 20:06:57 +00:00
< Message msg = 'Testing' timeFormat = 'DD MMMM YYYY' / >
2018-09-11 16:32:52 +00:00
2019-03-27 20:06:57 +00:00
< Separator title = 'Reactions' / >
2018-09-11 16:32:52 +00:00
< Message
msg = 'Reactions'
reactions = { [ {
emoji : ':joy:' ,
usernames : [ { value : 'username' } , { value : 'rocket.cat' } , { value : 'diego.mello' } ]
} , {
emoji : ':marioparty:' ,
usernames : [ { value : 'username' } , { value : 'rocket.cat' } , { value : 'diego.mello' } , { value : 'user1' } , { value : 'user1' } , { value : 'user1' } , { value : 'user1' } , { value : 'user1' } , { value : 'user1' } , { value : 'user1' } , { value : 'user1' } , { value : 'user1' } , { value : 'user1' } ]
} , {
emoji : ':thinking:' ,
usernames : [ { value : 'username' } ]
} ] }
onReactionPress = { ( ) => { } }
/ >
2019-03-27 20:06:57 +00:00
< Separator title = 'Multiple reactions' / >
2018-09-11 16:32:52 +00:00
< Message
msg = 'Multiple Reactions'
reactions = { [ {
emoji : ':marioparty:' ,
usernames : [ { value : 'username' } ]
} , {
emoji : ':react_rocket:' ,
usernames : [ { value : 'username' } ]
} , {
emoji : ':nyan_rocket:' ,
usernames : [ { value : 'username' } ]
} , {
emoji : ':heart:' ,
usernames : [ { value : 'username' } ]
} , {
emoji : ':dog:' ,
usernames : [ { value : 'username' } ]
} , {
emoji : ':grinning:' ,
usernames : [ { value : 'username' } ]
} , {
emoji : ':grimacing:' ,
usernames : [ { value : 'username' } ]
} , {
emoji : ':grin:' ,
usernames : [ { value : 'username' } ]
} ] }
onReactionPress = { ( ) => { } }
/ >
2019-03-27 20:06:57 +00:00
< Separator title = 'Intercalated users' / >
2018-09-11 16:32:52 +00:00
< Message
msg = 'Fourth message'
author = { {
... author ,
username : 'rocket.cat'
} }
/ >
< Message msg = 'Third message' / >
< Message
msg = 'Second message'
author = { {
... author ,
username : 'rocket.cat'
} }
/ >
< Message msg = 'First message' / >
2019-03-27 20:06:57 +00:00
< Separator title = 'Date and Unread separators' / >
2018-09-11 16:32:52 +00:00
< Message
msg = 'Fourth message'
author = { {
... author ,
username : 'rocket.cat'
} }
/ >
< MessageSeparator ts = { date } unread / >
< Message msg = 'Third message' / >
< MessageSeparator unread / >
< Message
msg = 'Second message'
author = { {
... author ,
username : 'rocket.cat'
} }
header = { false }
/ >
< Message
msg = 'Second message'
author = { {
... author ,
username : 'rocket.cat'
} }
/ >
< MessageSeparator ts = { date } / >
< Message msg = 'First message' / >
2019-03-27 20:06:57 +00:00
< Separator title = 'With image' / >
2018-09-11 16:32:52 +00:00
< Message
attachments = { [ {
title : 'This is a title' ,
description : 'This is a description' ,
image _url : '/file-upload/2ZrxuwcGeTrsoh376/Clipboard%20-%20September%205,%202018%204:10%20PM'
} ] }
/ >
< Message
attachments = { [ {
title : 'This is a title' ,
description : 'This is a description' ,
image _url : '/file-upload/sxLXBzjwuqxMnebyP/Clipboard%20-%2029%20de%20Agosto%20de%202018%20%C3%A0s%2018:10'
} ] }
/ >
2019-03-27 20:06:57 +00:00
< Separator title = 'With video' / >
2018-09-11 16:32:52 +00:00
< Message
attachments = { [ {
title : 'This is a title' ,
description : 'This is a description' ,
video _url : '/file-upload/cqnKqb6kdajky5Rxj/WhatsApp%20Video%202018-08-22%20at%2019.09.55.mp4'
} ] }
/ >
2019-03-27 20:06:57 +00:00
< Separator title = 'With audio' / >
2018-09-11 16:32:52 +00:00
< Message
attachments = { [ {
title : 'This is a title' ,
description : 'This is a description' ,
audio _url : '/file-upload/c4wcNhrbXJLBvAJtN/1535569819516.aac'
} ] }
/ >
2019-03-29 19:36:07 +00:00
< Message msg = 'First message' header = { false } / >
< Message
attachments = { [ {
title : 'This is a title' ,
description : 'This is a description' ,
audio _url : '/file-upload/c4wcNhrbXJLBvAJtN/1535569819516.aac'
} ] }
header = { false }
/ >
< Message
attachments = { [ {
title : 'This is a title' ,
audio _url : '/file-upload/c4wcNhrbXJLBvAJtN/1535569819516.aac'
} ] }
header = { false }
/ >
< Message
attachments = { [ {
title : 'This is a title' ,
audio _url : '/file-upload/c4wcNhrbXJLBvAJtN/1535569819516.aac'
} ] }
header = { false }
/ >
2018-09-11 16:32:52 +00:00
2019-03-27 20:06:57 +00:00
< Separator title = 'Message with reply' / >
2019-02-08 16:34:50 +00:00
< Message
msg = "I'm fine!"
attachments = { [ {
2019-03-29 19:36:07 +00:00
author _name : 'I\'m a very long long title and I\'ll break' ,
2019-02-08 16:34:50 +00:00
ts : date ,
timeFormat : 'LT' ,
text : 'How are you?'
} ] }
/ >
< Message
msg = "I'm fine!"
attachments = { [ {
author _name : 'rocket.cat' ,
ts : date ,
timeFormat : 'LT' ,
text : 'How are you?'
} ] }
/ >
2019-04-17 17:01:03 +00:00
< Separator title = 'Message with thread' / >
< Message
msg = 'How are you?'
tcount = { 1 }
tlm = { date }
/ >
2019-04-24 18:36:29 +00:00
< Message
msg = 'How are you?'
tcount = { 9999 }
tlm = { date }
/ >
2019-04-17 17:01:03 +00:00
< Message
msg = "I'm fine!"
tmid = '1'
tmsg = 'How are you?'
2019-05-03 13:33:38 +00:00
isThreadReply
2019-04-17 17:01:03 +00:00
/ >
< Message
msg = "I'm fine!"
tmid = '1'
tmsg = 'Thread with emoji :) :joy:'
2019-05-03 13:33:38 +00:00
isThreadReply
2019-04-17 17:01:03 +00:00
/ >
2019-04-25 17:18:49 +00:00
< Message
msg = "I'm fine!"
tmid = '1'
tmsg = 'Markdown: [link](http://www.google.com/) ```block code```'
2019-05-03 13:33:38 +00:00
isThreadReply
2019-04-25 17:18:49 +00:00
/ >
2019-04-17 17:01:03 +00:00
< Message
msg = "I'm fine!"
tmid = '1'
tmsg = { longText }
2019-05-03 13:33:38 +00:00
isThreadReply
2019-04-17 17:01:03 +00:00
/ >
< Message
msg = { longText }
tmid = '1'
tmsg = 'How are you?'
2019-05-03 13:33:38 +00:00
isThreadReply
2019-04-17 17:01:03 +00:00
/ >
< Message
msg = { longText }
tmid = '1'
tmsg = { longText }
2019-05-03 13:33:38 +00:00
isThreadReply
2019-04-17 17:01:03 +00:00
/ >
< Message
2019-04-24 18:36:29 +00:00
tmid = '1'
tmsg = 'Thread with attachment'
attachments = { [ {
title : 'This is a title' ,
description : 'This is a description' ,
audio _url : '/file-upload/c4wcNhrbXJLBvAJtN/1535569819516.aac'
} ] }
2019-05-03 13:33:38 +00:00
isThreadReply
/ >
< Separator title = 'Sequential thread messages following thread button' / >
< Message
msg = 'How are you?'
tcount = { 1 }
tlm = { date }
/ >
< Message
msg = "I'm fine!"
tmid = '1'
isThreadSequential
/ >
< Message
msg = { longText }
tmid = '1'
isThreadSequential
/ >
< Message
attachments = { [ {
title : 'This is a title' ,
description : 'This is a description' ,
audio _url : '/file-upload/c4wcNhrbXJLBvAJtN/1535569819516.aac'
} ] }
tmid = '1'
isThreadSequential
/ >
< Separator title = 'Sequential thread messages following thread reply' / >
< Message
msg = "I'm fine!"
tmid = '1'
tmsg = 'How are you?'
isThreadReply
/ >
< Message
msg = 'Cool!'
tmid = '1'
isThreadSequential
/ >
< Message
msg = { longText }
tmid = '1'
isThreadSequential
/ >
< Message
attachments = { [ {
title : 'This is a title' ,
description : 'This is a description' ,
audio _url : '/file-upload/c4wcNhrbXJLBvAJtN/1535569819516.aac'
} ] }
tmid = '1'
isThreadSequential
2019-04-17 17:01:03 +00:00
/ >
2019-04-24 18:36:29 +00:00
2019-04-17 17:01:03 +00:00
{ / * < M e s s a g e
msg = 'How are you?'
tcount = { 9999 }
tlm = { moment ( ) . subtract ( 1 , 'hour' ) }
/ >
< Message
msg = 'How are you?'
tcount = { 9999 }
tlm = { moment ( ) . subtract ( 1 , 'day' ) }
/ >
< Message
msg = 'How are you?'
tcount = { 9999 }
tlm = { moment ( ) . subtract ( 5 , 'day' ) }
/ >
< Message
msg = 'How are you?'
tcount = { 9999 }
tlm = { moment ( ) . subtract ( 30 , 'day' ) }
/> */ }
< Separator title = 'Discussion' / >
< Message
type = 'discussion-created'
drid = 'aisduhasidhs'
dcount = { null }
dlm = { null }
msg = 'This is a discussion'
/ >
< Message
type = 'discussion-created'
drid = 'aisduhasidhs'
dcount = { 1 }
dlm = { date }
msg = 'This is a discussion'
/ >
< Message
type = 'discussion-created'
drid = 'aisduhasidhs'
dcount = { 10 }
dlm = { date }
msg = { longText }
/ >
< Message
type = 'discussion-created'
drid = 'aisduhasidhs'
dcount = { 1000 }
dlm = { date }
msg = 'This is a discussion'
/ >
{ / * < M e s s a g e
type = 'discussion-created'
drid = 'aisduhasidhs'
dcount = { 1000 }
dlm = { moment ( ) . subtract ( 1 , 'hour' ) }
msg = 'This is a discussion'
/ >
< Message
type = 'discussion-created'
drid = 'aisduhasidhs'
dcount = { 1000 }
dlm = { moment ( ) . subtract ( 1 , 'day' ) }
msg = 'This is a discussion'
/ >
< Message
type = 'discussion-created'
drid = 'aisduhasidhs'
dcount = { 1000 }
dlm = { moment ( ) . subtract ( 5 , 'day' ) }
msg = 'This is a discussion'
/ >
< Message
type = 'discussion-created'
drid = 'aisduhasidhs'
dcount = { 1000 }
dlm = { moment ( ) . subtract ( 30 , 'day' ) }
msg = 'This is a discussion'
/> */ }
2019-03-27 20:06:57 +00:00
< Separator title = 'URL' / >
2018-09-11 16:32:52 +00:00
< Message
urls = { [ {
url : 'https://rocket.chat' ,
image : 'https://rocket.chat/images/blog/post.jpg' ,
title : 'Rocket.Chat - Free, Open Source, Enterprise Team Chat' ,
description : 'Rocket.Chat is the leading open source team chat software solution. Free, unlimited and completely customizable with on-premises and SaaS cloud hosting.'
} , {
url : 'https://google.com' ,
title : 'Google' ,
description : 'Search the world\'s information, including webpages, images, videos and more. Google has many special features to help you find exactly what you\'re looking for.'
} ] }
/ >
2019-03-27 20:06:57 +00:00
< Separator title = 'Custom fields' / >
2018-09-11 16:32:52 +00:00
< Message
msg = 'Message'
attachments = { [ {
author _name : 'rocket.cat' ,
ts : date ,
timeFormat : 'LT' ,
text : 'Custom fields' ,
fields : [ {
title : 'Field 1' ,
value : 'Value 1'
} , {
title : 'Field 2' ,
value : 'Value 2'
} , {
title : 'Field 3' ,
value : 'Value 3'
} , {
title : 'Field 4' ,
value : 'Value 4'
} , {
title : 'Field 5' ,
value : 'Value 5'
} ]
} ] }
/ >
2019-03-27 20:06:57 +00:00
< Separator title = 'Two short custom fields' / >
2018-09-11 16:32:52 +00:00
< Message
msg = 'Message'
attachments = { [ {
author _name : 'rocket.cat' ,
ts : date ,
timeFormat : 'LT' ,
text : 'Custom fields' ,
fields : [ {
title : 'Field 1' ,
value : 'Value 1' ,
short : true
} , {
title : 'Field 2' ,
value : 'Value 2' ,
short : true
} ]
} , {
author _name : 'rocket.cat' ,
ts : date ,
timeFormat : 'LT' ,
text : 'Custom fields 2' ,
fields : [ {
title : 'Field 1' ,
value : 'Value 1' ,
short : true
} , {
title : 'Field 2' ,
value : 'Value 2' ,
short : true
} ]
} ] }
/ >
< Separator title = 'Broadcast' / >
2019-03-27 20:06:57 +00:00
< Message msg = 'Broadcasted message' broadcast replyBroadcast = { ( ) => alert ( 'broadcast!' ) } / >
2018-09-11 16:32:52 +00:00
< Separator title = 'Archived' / >
2019-03-27 20:06:57 +00:00
< Message msg = 'This message is inside an archived room' archived / >
2018-09-11 16:32:52 +00:00
2019-03-27 20:06:57 +00:00
< Separator title = 'Error' / >
2018-09-11 16:32:52 +00:00
< Message msg = 'This message has error too' status = { messagesStatus . ERROR } onErrorPress = { ( ) => alert ( 'Error pressed' ) } header = { false } / >
< Message msg = 'This message has error' status = { messagesStatus . ERROR } onErrorPress = { ( ) => alert ( 'Error pressed' ) } / >
< Separator title = 'Temp' / >
2019-03-27 20:06:57 +00:00
< Message msg = 'Temp message' status = { messagesStatus . TEMP } / >
2018-09-11 16:32:52 +00:00
< Separator title = 'Editing' / >
2019-03-27 20:06:57 +00:00
< Message msg = 'Message being edited' editing / >
2018-09-11 16:32:52 +00:00
< Separator title = 'Removed' / >
2019-03-27 20:06:57 +00:00
< Message type = 'rm' / >
2018-09-11 16:32:52 +00:00
< Separator title = 'Joined' / >
2019-03-27 20:06:57 +00:00
< Message type = 'uj' / >
2018-09-11 16:32:52 +00:00
< Separator title = 'Room name changed' / >
2019-03-27 20:06:57 +00:00
< Message msg = 'New name' type = 'r' / >
2018-09-11 16:32:52 +00:00
2019-03-27 20:06:57 +00:00
< Separator title = 'Message pinned' / >
2018-09-11 16:32:52 +00:00
< Message
msg = 'New name'
type = 'message_pinned'
attachments = { [ {
author _name : 'rocket.cat' ,
ts : date ,
timeFormat : 'LT' ,
text : 'First message'
} ] }
/ >
< Separator title = 'Has left the channel' / >
2019-03-27 20:06:57 +00:00
< Message type = 'ul' / >
2018-09-11 16:32:52 +00:00
< Separator title = 'User removed' / >
2019-03-27 20:06:57 +00:00
< Message msg = 'rocket.cat' type = 'ru' / >
2018-09-11 16:32:52 +00:00
< Separator title = 'User added' / >
2019-03-27 20:06:57 +00:00
< Message msg = 'rocket.cat' type = 'au' / >
2018-09-11 16:32:52 +00:00
< Separator title = 'User muted' / >
2019-03-27 20:06:57 +00:00
< Message msg = 'rocket.cat' type = 'user-muted' / >
2018-09-11 16:32:52 +00:00
< Separator title = 'User unmuted' / >
2019-03-27 20:06:57 +00:00
< Message msg = 'rocket.cat' type = 'user-unmuted' / >
2018-09-11 16:32:52 +00:00
2019-03-27 20:06:57 +00:00
< Separator title = 'Role added' / >
2018-09-11 16:32:52 +00:00
< Message
msg = 'rocket.cat'
role = 'admin' // eslint-disable-line
type = 'subscription-role-added'
/ >
2019-03-27 20:06:57 +00:00
< Separator title = 'Role removed' / >
2018-09-11 16:32:52 +00:00
< Message
msg = 'rocket.cat'
role = 'admin' // eslint-disable-line
type = 'subscription-role-removed'
/ >
< Separator title = 'Changed description' / >
2019-03-27 20:06:57 +00:00
< Message msg = 'new description' type = 'room_changed_description' / >
2018-09-11 16:32:52 +00:00
< Separator title = 'Changed announcement' / >
2019-03-27 20:06:57 +00:00
< Message msg = 'new announcement' type = 'room_changed_announcement' / >
2018-09-11 16:32:52 +00:00
< Separator title = 'Changed topic' / >
2019-03-27 20:06:57 +00:00
< Message msg = 'new topic' type = 'room_changed_topic' / >
2018-09-11 16:32:52 +00:00
< Separator title = 'Changed type' / >
2019-03-27 20:06:57 +00:00
< Message msg = 'public' type = 'room_changed_privacy' / >
2018-09-11 16:32:52 +00:00
< Separator title = 'Custom style' / >
2019-03-27 20:06:57 +00:00
< Message msg = 'Message' style = { [ styles . normalize , { backgroundColor : '#ddd' } ] } / >
2018-09-11 16:32:52 +00:00
< Separator title = 'Markdown emphasis' / >
2019-03-27 20:06:57 +00:00
< Message msg = 'Italic with *asterisks* or _underscores_. Bold with **asterisks** or __underscores__. ~~Strikethrough~~' / >
2018-09-11 16:32:52 +00:00
2019-03-27 20:06:57 +00:00
< Separator title = 'Markdown headers' / >
2018-09-11 16:32:52 +00:00
< Message
msg = ' # H1
# # H2
# # # H3
# # # # H4
# # # # # H5
# # # # # # H6 '
/ >
< Separator title = 'Markdown links' / >
2019-03-27 20:06:57 +00:00
< Message msg = 'Support <http://google.com|Google> [I`m an inline-style link](https://www.google.com) https://google.com' / >
2018-09-11 16:32:52 +00:00
< Separator title = 'Markdown image' / >
2019-03-27 20:06:57 +00:00
< Message msg = '![alt text](https://play.google.com/intl/en_us/badges/images/badge_new.png)' / >
2018-09-11 16:32:52 +00:00
2019-03-27 20:06:57 +00:00
< Separator title = 'Markdown code' / >
2018-09-11 16:32:52 +00:00
< Message
msg = ' Inline ` code ` has ` back-ticks around ` it .
` ` `
Code block
` ` ` '
/ >
< Separator title = 'Markdown quote' / >
2019-03-27 20:06:57 +00:00
< Message msg = '> Quote' / >
2018-09-11 16:32:52 +00:00
2019-03-27 20:06:57 +00:00
< Separator title = 'Markdown table' / >
2018-09-11 16:32:52 +00:00
< Message
msg = ' First Header | Second Header
-- -- -- -- -- -- | -- -- -- -- -- -- -
Content from cell 1 | Content from cell 2
Content in the first column | Content in the second column '
/ >
< / S c r o l l V i e w >
) ;