/* eslint-disable import/no-extraneous-dependencies */ import React from 'react'; import { ScrollView, StyleSheet } from 'react-native'; import { Provider } from 'react-redux'; import { storiesOf } from '@storybook/react-native'; import MessageComponent from '../../app/containers/message/Message'; import { E2E_MESSAGE_TYPE, messagesStatus, themes } from '../../app/lib/constants'; import MessageSeparator from '../../app/views/RoomView/Separator'; import MessageContext from '../../app/containers/message/Context'; import { store } from './index'; const _theme = 'light'; const styles = StyleSheet.create({}); const user = { id: 'y8bd77ptZswPj3EW8', username: 'diego.mello', token: '79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz' }; const author = { _id: 'userid', username: 'diego.mello' }; const longNameAuthor = { _id: 'userid', username: 'Long name user looooong name user' }; const baseUrl = 'https://open.rocket.chat'; const date = new Date(2017, 10, 10, 10); const longText = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'; const getCustomEmoji = content => { const customEmoji = { marioparty: { name: content, extension: 'gif' }, react_rocket: { name: content, extension: 'png' }, nyan_rocket: { name: content, extension: 'png' } }[content]; return customEmoji; }; export const MessageDecorator = story => ( {}, onLongPress: () => {}, reactionInit: () => {}, onErrorPress: () => {}, replyBroadcast: () => {}, onReactionPress: () => {}, onDiscussionPress: () => {}, onReactionLongPress: () => {}, threadBadgeColor: themes.light.tunreadColor }} > {story()} ); export const Message = props => ( ); export const StoryProvider = story => {story()}; const MessageScrollView = story => {story()}; const stories = storiesOf('Message', module) .addDecorator(StoryProvider) .addDecorator(MessageScrollView) .addDecorator(MessageDecorator); stories.add('Basic', () => ( <> )); stories.add('Grouped messages', () => ( <> )); stories.add('Without header', () => ); stories.add('With alias', () => ( <> )); stories.add('Edited', () => ( <> )); stories.add('Encrypted', () => ( <> {}} type='e2e' /> alert('Error pressed')} type='e2e' /> )); stories.add('Block Quote', () => ( <> Testing block quote\nTesting block quote'} /> )); stories.add('Lists', () => ( <> )); stories.add('Static avatar', () => ( )); stories.add('Full name', () => ( )); stories.add('Mentions', () => ( <> )); stories.add('Emojis', () => ( <> )); stories.add('Time format', () => ); stories.add('Reactions', () => ( <> {}} /> {}} /> )); stories.add('Date and Unread separators', () => ( <> )); stories.add('With image', () => ( <> )); stories.add('With video', () => ( <> )); stories.add('With audio', () => ( <> )); stories.add('With file', () => ( <> )); stories.add('Message with reply', () => ( <> )); stories.add('Message with read receipt', () => ( <> )); stories.add('Message with thread', () => ( <> )); stories.add('Sequential thread messages following thread button', () => ( <> )); stories.add('Sequential thread messages following thread reply', () => ( <> )); stories.add('Discussion', () => ( <> )); stories.add('URL', () => ( <> )); stories.add('Custom fields', () => ( <> )); stories.add('Two short custom fields with markdown', () => ( )); stories.add('Colored attachments', () => ( )); stories.add('Broadcast', () => alert('broadcast!')} />); stories.add('Archived', () => ); stories.add('Error', () => ( <> alert('Error pressed')} /> alert('Error pressed')} isHeader={false} /> )); stories.add('Temp', () => ); stories.add('Editing', () => ); stories.add('System messages', () => ( <> )); stories.add('Ignored', () => ); stories.add('Custom style', () => ); stories.add('Show a button as attachment', () => ( )); stories.add('Thumbnail from server', () => ( )); stories.add('Long Name user', () => ( <> ));