diff --git a/app/containers/EmojiPicker/index.tsx b/app/containers/EmojiPicker/index.tsx index ac3aa320889..bd7d4466b0a 100644 --- a/app/containers/EmojiPicker/index.tsx +++ b/app/containers/EmojiPicker/index.tsx @@ -2,16 +2,16 @@ import React, { useState } from 'react'; import { View } from 'react-native'; import ScrollableTabView from 'react-native-scrollable-tab-view'; -import TabBar from './TabBar'; -import EmojiCategory from './EmojiCategory'; -import Footer from './Footer'; -import styles from './styles'; +import { ICustomEmojis, IEmoji } from '../../definitions'; import { categories, emojisByCategory } from '../../lib/constants'; -import { useTheme } from '../../theme'; -import { IEmoji, ICustomEmojis } from '../../definitions'; import { useAppSelector, useFrequentlyUsedEmoji } from '../../lib/hooks'; import { addFrequentlyUsed } from '../../lib/methods'; -import { IEmojiPickerProps, EventTypes } from './interfaces'; +import { useTheme } from '../../theme'; +import EmojiCategory from './EmojiCategory'; +import Footer from './Footer'; +import TabBar from './TabBar'; +import { EventTypes, IEmojiPickerProps } from './interfaces'; +import styles from './styles'; const EmojiPicker = ({ onItemClicked, @@ -54,6 +54,7 @@ const EmojiPicker = ({ } return ( handleEmojiSelect(emoji)} diff --git a/app/containers/Passcode/Base/Dots.tsx b/app/containers/Passcode/Base/Dots.tsx index 378f78b0ecd..93ad0d3ff08 100644 --- a/app/containers/Passcode/Base/Dots.tsx +++ b/app/containers/Passcode/Base/Dots.tsx @@ -1,10 +1,10 @@ +import range from 'lodash/range'; import React from 'react'; import { View } from 'react-native'; -import range from 'lodash/range'; -import styles from './styles'; import { themes } from '../../../lib/constants'; import { useTheme } from '../../../theme'; +import styles from './styles'; const SIZE_EMPTY = 12; const SIZE_FULL = 16; @@ -33,7 +33,7 @@ const Dots = React.memo(({ passcode, length }: IPasscodeDots) => { const marginRight = lengthSup ? 10 - (SIZE_FULL - SIZE_EMPTY) / 2 : 10; const marginLeft = lengthSup ? 10 - (SIZE_FULL - SIZE_EMPTY) / 2 : 10; return ( - + const Fields = ({ fields, parser, theme }: IFields) => ( <> - {fields.map(field => ( - {parser.text(field)} + {fields.map((field, index) => ( + + {parser.text(field)} + ))} ); diff --git a/app/containers/markdown/new/BigEmoji.tsx b/app/containers/markdown/new/BigEmoji.tsx index 552050532b8..ac9d3f8b8d8 100644 --- a/app/containers/markdown/new/BigEmoji.tsx +++ b/app/containers/markdown/new/BigEmoji.tsx @@ -1,6 +1,6 @@ +import { BigEmoji as BigEmojiProps } from '@rocket.chat/message-parser'; import React from 'react'; import { StyleSheet, View } from 'react-native'; -import { BigEmoji as BigEmojiProps } from '@rocket.chat/message-parser'; import Emoji from './Emoji'; @@ -16,8 +16,8 @@ const styles = StyleSheet.create({ const BigEmoji = ({ value }: IBigEmojiProps) => ( - {value.map(block => ( - + {value.map((block, i) => ( + ))} ); diff --git a/app/containers/markdown/new/Bold.tsx b/app/containers/markdown/new/Bold.tsx index 705ef81a27f..9b65e37aae1 100644 --- a/app/containers/markdown/new/Bold.tsx +++ b/app/containers/markdown/new/Bold.tsx @@ -1,12 +1,12 @@ +import { Bold as BoldProps } from '@rocket.chat/message-parser'; import React from 'react'; import { StyleSheet, Text } from 'react-native'; -import { Bold as BoldProps } from '@rocket.chat/message-parser'; import sharedStyles from '../../../views/Styles'; -import Strike from './Strike'; import Italic from './Italic'; -import Plain from './Plain'; import Link from './Link'; +import Plain from './Plain'; +import Strike from './Strike'; interface IBoldProps { value: BoldProps['value']; @@ -20,18 +20,19 @@ const styles = StyleSheet.create({ const Bold = ({ value }: IBoldProps) => ( - {value.map(block => { + {value.map((block, index) => { + const key = `${block.type}-${index}`; switch (block.type) { case 'LINK': - return ; + return ; case 'PLAIN_TEXT': - return ; + return ; case 'STRIKE': - return ; + return ; case 'ITALIC': - return ; + return ; case 'MENTION_CHANNEL': - return ; + return ; default: return null; } diff --git a/app/containers/markdown/new/Code.tsx b/app/containers/markdown/new/Code.tsx index c47f81dd640..05ca18e0766 100644 --- a/app/containers/markdown/new/Code.tsx +++ b/app/containers/markdown/new/Code.tsx @@ -1,9 +1,9 @@ +import { Code as CodeProps } from '@rocket.chat/message-parser'; import React from 'react'; import { View } from 'react-native'; -import { Code as CodeProps } from '@rocket.chat/message-parser'; -import styles from '../styles'; import { useTheme } from '../../../theme'; +import styles from '../styles'; import CodeLine from './CodeLine'; interface ICodeProps { @@ -23,10 +23,11 @@ const Code = ({ value }: ICodeProps): React.ReactElement => { } ]} > - {value.map(block => { + {value.map((block, index) => { + const key = `${block.type}-${index}`; switch (block.type) { case 'CODE_LINE': - return ; + return ; default: return null; } diff --git a/app/containers/markdown/new/Inline.tsx b/app/containers/markdown/new/Inline.tsx index 08c31a983f5..e68dd4bd93b 100644 --- a/app/containers/markdown/new/Inline.tsx +++ b/app/containers/markdown/new/Inline.tsx @@ -1,19 +1,19 @@ +import { Paragraph as ParagraphProps } from '@rocket.chat/message-parser'; import React, { useContext } from 'react'; import { Text } from 'react-native'; -import { Paragraph as ParagraphProps } from '@rocket.chat/message-parser'; -import Hashtag from '../Hashtag'; import AtMention from '../AtMention'; +import Hashtag from '../Hashtag'; import styles from '../styles'; -import Link from './Link'; -import Plain from './Plain'; import Bold from './Bold'; -import Strike from './Strike'; -import Italic from './Italic'; import Emoji from './Emoji'; -import InlineCode from './InlineCode'; import Image from './Image'; +import InlineCode from './InlineCode'; +import Italic from './Italic'; +import Link from './Link'; import MarkdownContext from './MarkdownContext'; +import Plain from './Plain'; +import Strike from './Strike'; // import { InlineKaTeX, KaTeX } from './Katex'; interface IParagraphProps { @@ -42,22 +42,25 @@ const Inline = ({ value, forceTrim }: IParagraphProps): React.ReactElement | nul } } + const key = `${block.type}-${index}`; + switch (block.type) { case 'IMAGE': - return ; + return ; case 'PLAIN_TEXT': - return ; + return ; case 'BOLD': - return ; + return ; case 'STRIKE': - return ; + return ; case 'ITALIC': - return ; + return ; case 'LINK': - return ; + return ; case 'MENTION_USER': return ( ); case 'EMOJI': - return ; + return ; case 'MENTION_CHANNEL': - return ; + return ; case 'INLINE_CODE': - return ; + return ; case 'INLINE_KATEX': // return ; - return {block.value}; + return {block.value}; default: return null; } diff --git a/app/containers/markdown/new/Italic.tsx b/app/containers/markdown/new/Italic.tsx index 5277442fe04..98bfcf32902 100644 --- a/app/containers/markdown/new/Italic.tsx +++ b/app/containers/markdown/new/Italic.tsx @@ -1,11 +1,11 @@ +import { Italic as ItalicProps } from '@rocket.chat/message-parser'; import React from 'react'; import { StyleSheet, Text } from 'react-native'; -import { Italic as ItalicProps } from '@rocket.chat/message-parser'; -import Strike from './Strike'; import Bold from './Bold'; -import Plain from './Plain'; import Link from './Link'; +import Plain from './Plain'; +import Strike from './Strike'; interface IItalicProps { value: ItalicProps['value']; @@ -19,18 +19,19 @@ const styles = StyleSheet.create({ const Italic = ({ value }: IItalicProps) => ( - {value.map(block => { + {value.map((block, index) => { + const key = `${block.type}-${index}`; switch (block.type) { case 'LINK': - return ; + return ; case 'PLAIN_TEXT': - return ; + return ; case 'STRIKE': - return ; + return ; case 'BOLD': - return ; + return ; case 'MENTION_CHANNEL': - return ; + return ; default: return null; } diff --git a/app/containers/markdown/new/Quote.tsx b/app/containers/markdown/new/Quote.tsx index 8578097b30c..bb20728f7e7 100644 --- a/app/containers/markdown/new/Quote.tsx +++ b/app/containers/markdown/new/Quote.tsx @@ -1,6 +1,6 @@ +import { Quote as QuoteProps } from '@rocket.chat/message-parser'; import React from 'react'; import { View } from 'react-native'; -import { Quote as QuoteProps } from '@rocket.chat/message-parser'; import { themes } from '../../../lib/constants'; import { useTheme } from '../../../theme'; @@ -17,8 +17,8 @@ const Quote = ({ value }: IQuoteProps) => { - {value.map(item => ( - + {value.map((item, index) => ( + ))} diff --git a/app/containers/markdown/new/Strike.tsx b/app/containers/markdown/new/Strike.tsx index 6f6a6adfee8..ec27a415307 100644 --- a/app/containers/markdown/new/Strike.tsx +++ b/app/containers/markdown/new/Strike.tsx @@ -1,11 +1,11 @@ +import { Strike as StrikeProps } from '@rocket.chat/message-parser'; import React from 'react'; import { StyleSheet, Text } from 'react-native'; -import { Strike as StrikeProps } from '@rocket.chat/message-parser'; import Bold from './Bold'; import Italic from './Italic'; -import Plain from './Plain'; import Link from './Link'; +import Plain from './Plain'; interface IStrikeProps { value: StrikeProps['value']; @@ -19,18 +19,19 @@ const styles = StyleSheet.create({ const Strike = ({ value }: IStrikeProps) => ( - {value.map(block => { + {value.map((block, index) => { + const key = `${block.type}-${index}`; switch (block.type) { case 'LINK': - return ; + return ; case 'PLAIN_TEXT': - return ; + return ; case 'BOLD': - return ; + return ; case 'ITALIC': - return ; + return ; case 'MENTION_CHANNEL': - return ; + return ; default: return null; } diff --git a/app/containers/markdown/new/TaskList.tsx b/app/containers/markdown/new/TaskList.tsx index 0349b7e2072..17ad27d5915 100644 --- a/app/containers/markdown/new/TaskList.tsx +++ b/app/containers/markdown/new/TaskList.tsx @@ -1,10 +1,10 @@ +import { Tasks as TasksProps } from '@rocket.chat/message-parser'; import React from 'react'; import { Text, View } from 'react-native'; -import { Tasks as TasksProps } from '@rocket.chat/message-parser'; -import Inline from './Inline'; -import styles from '../styles'; import { useTheme } from '../../../theme'; +import styles from '../styles'; +import Inline from './Inline'; interface ITasksProps { value: TasksProps['value']; @@ -14,8 +14,8 @@ const TaskList = ({ value = [] }: ITasksProps) => { const { colors } = useTheme(); return ( - {value.map(item => ( - + {value.map((item, index) => ( + {item.status ? '- [x] ' : '- [ ] '} diff --git a/app/containers/markdown/new/UnorderedList.tsx b/app/containers/markdown/new/UnorderedList.tsx index 6bfea2e76f7..62bd9c4fd68 100644 --- a/app/containers/markdown/new/UnorderedList.tsx +++ b/app/containers/markdown/new/UnorderedList.tsx @@ -1,11 +1,11 @@ -import React from 'react'; import { UnorderedList as UnorderedListProps } from '@rocket.chat/message-parser'; -import { View, Text } from 'react-native'; +import React from 'react'; +import { Text, View } from 'react-native'; -import Inline from './Inline'; -import styles from '../styles'; import { themes } from '../../../lib/constants'; import { useTheme } from '../../../theme'; +import styles from '../styles'; +import Inline from './Inline'; interface IUnorderedListProps { value: UnorderedListProps['value']; @@ -15,8 +15,8 @@ const UnorderedList = ({ value }: IUnorderedListProps) => { const { theme } = useTheme(); return ( - {value.map(item => ( - + {value.map((item, index) => ( + - diff --git a/app/containers/markdown/new/index.tsx b/app/containers/markdown/new/index.tsx index e1f77e3f3bc..6984972b7e0 100644 --- a/app/containers/markdown/new/index.tsx +++ b/app/containers/markdown/new/index.tsx @@ -1,19 +1,19 @@ -import React from 'react'; import { MarkdownAST } from '@rocket.chat/message-parser'; import isEmpty from 'lodash/isEmpty'; +import React from 'react'; -import Quote from './Quote'; -import Paragraph from './Paragraph'; -import Heading from './Heading'; -import Code from './Code'; +import { IUserChannel, IUserMention, TOnLinkPress } from '../interfaces'; import BigEmoji from './BigEmoji'; +import Code from './Code'; +import Heading from './Heading'; +import { KaTeX } from './Katex'; +import LineBreak from './LineBreak'; +import MarkdownContext from './MarkdownContext'; import OrderedList from './OrderedList'; -import UnorderedList from './UnorderedList'; -import { IUserMention, IUserChannel, TOnLinkPress } from '../interfaces'; +import Paragraph from './Paragraph'; +import Quote from './Quote'; import TaskList from './TaskList'; -import MarkdownContext from './MarkdownContext'; -import LineBreak from './LineBreak'; -import { KaTeX } from './Katex'; +import UnorderedList from './UnorderedList'; interface IBodyProps { tokens?: MarkdownAST; @@ -52,32 +52,33 @@ const Body = ({ onLinkPress }} > - {tokens?.map(block => { + {tokens?.map((block, index) => { + const key = `${block.type}-${index}`; switch (block.type) { case 'BIG_EMOJI': - return ; + return ; case 'UNORDERED_LIST': - return ; + return ; case 'ORDERED_LIST': - return ; + return ; case 'TASKS': - return ; + return ; case 'QUOTE': - return ; + return ; case 'PARAGRAPH': - return ; + return ; case 'CODE': - return ; + return ; case 'HEADING': - return ; + return ; case 'LINE_BREAK': - return ; + return ; // This prop exists, but not even on the web it is treated, so... // https://github.com/RocketChat/Rocket.Chat/blob/develop/packages/gazzodown/src/Markup.tsx // case 'LIST_ITEM': // return ; case 'KATEX': - return ; + return ; default: return null; } diff --git a/app/views/ChangeAvatarView/AvatarSuggestion.tsx b/app/views/ChangeAvatarView/AvatarSuggestion.tsx index e68c3d2e0bc..861d48faeec 100644 --- a/app/views/ChangeAvatarView/AvatarSuggestion.tsx +++ b/app/views/ChangeAvatarView/AvatarSuggestion.tsx @@ -1,12 +1,12 @@ -import React, { useState, useEffect } from 'react'; +import React, { useEffect, useState } from 'react'; import { Text, View } from 'react-native'; import { IAvatar } from '../../definitions'; -import { Services } from '../../lib/services'; import I18n from '../../i18n'; -import styles from './styles'; +import { Services } from '../../lib/services'; import { useTheme } from '../../theme'; import AvatarSuggestionItem from './AvatarSuggestionItem'; +import styles from './styles'; const AvatarSuggestion = ({ onPress, @@ -45,8 +45,8 @@ const AvatarSuggestion = ({ {username && resetAvatar ? ( ) : null} - {avatarSuggestions.slice(0, 7).map(item => ( - + {avatarSuggestions.slice(0, 7).map((item, index) => ( + ))} diff --git a/app/views/LivechatEditView.tsx b/app/views/LivechatEditView.tsx index 98d195956d3..fa38ab4a790 100644 --- a/app/views/LivechatEditView.tsx +++ b/app/views/LivechatEditView.tsx @@ -1,28 +1,28 @@ -import React, { useEffect, useState } from 'react'; -import { StackNavigationProp } from '@react-navigation/stack'; import { RouteProp } from '@react-navigation/native'; +import { StackNavigationProp } from '@react-navigation/stack'; +import { BlockContext } from '@rocket.chat/ui-kit'; +import React, { useEffect, useState } from 'react'; import { ScrollView, StyleSheet, Text } from 'react-native'; import { connect } from 'react-redux'; -import { BlockContext } from '@rocket.chat/ui-kit'; -import { TSupportedThemes, withTheme } from '../theme'; -import { themes } from '../lib/constants'; -import { FormTextInput } from '../containers/TextInput'; +import Button from '../containers/Button'; import KeyboardView from '../containers/KeyboardView'; -import I18n from '../i18n'; +import SafeAreaView from '../containers/SafeAreaView'; +import { FormTextInput } from '../containers/TextInput'; import { LISTENER } from '../containers/Toast'; +import { MultiSelect } from '../containers/UIKit/MultiSelect'; +import { IApplicationState, IUser } from '../definitions'; +import { ICustomFields, IInputsRefs, ILivechat, ITitle, TParams } from '../definitions/ILivechatEditView'; +import I18n from '../i18n'; +import { themes } from '../lib/constants'; +import { usePermissions } from '../lib/hooks'; import EventEmitter from '../lib/methods/helpers/events'; import scrollPersistTaps from '../lib/methods/helpers/scrollPersistTaps'; +import { Services } from '../lib/services'; import { getUserSelector } from '../selectors/login'; -import Button from '../containers/Button'; -import SafeAreaView from '../containers/SafeAreaView'; -import { MultiSelect } from '../containers/UIKit/MultiSelect'; -import { ICustomFields, IInputsRefs, TParams, ITitle, ILivechat } from '../definitions/ILivechatEditView'; -import { IApplicationState, IUser } from '../definitions'; import { ChatsStackParamList } from '../stacks/types'; +import { TSupportedThemes, withTheme } from '../theme'; import sharedStyles from './Styles'; -import { Services } from '../lib/services'; -import { usePermissions } from '../lib/hooks'; const styles = StyleSheet.create({ container: { @@ -231,6 +231,7 @@ const LivechatEditView = ({ user, navigation, route, theme }: ILivechatEditViewP /> {Object.entries(customFields?.visitor || {}).map(([key, value], index, array) => ( { @@ -273,6 +274,7 @@ const LivechatEditView = ({ user, navigation, route, theme }: ILivechatEditViewP {Object.entries(customFields?.livechat || {}).map(([key, value], index, array: any) => ( { diff --git a/app/views/RoomInfoView/CustomFields.tsx b/app/views/RoomInfoView/CustomFields.tsx index 4716cf1faf9..cf620f0a410 100644 --- a/app/views/RoomInfoView/CustomFields.tsx +++ b/app/views/RoomInfoView/CustomFields.tsx @@ -8,7 +8,7 @@ const CustomFields = ({ customFields }: { customFields?: { [key: string]: string <> {Object.keys(customFields).map((title: string) => { if (!customFields[title]) return null; - return ; + return ; })} ); diff --git a/app/views/ScreenLockConfigView.tsx b/app/views/ScreenLockConfigView.tsx index 08ce03a4515..1c50d5f811f 100644 --- a/app/views/ScreenLockConfigView.tsx +++ b/app/views/ScreenLockConfigView.tsx @@ -1,20 +1,20 @@ +import { StackNavigationOptions } from '@react-navigation/stack'; import React from 'react'; import { Switch } from 'react-native'; import { connect } from 'react-redux'; -import { StackNavigationOptions } from '@react-navigation/stack'; import { Subscription } from 'rxjs'; -import I18n from '../i18n'; -import { TSupportedThemes, withTheme } from '../theme'; -import StatusBar from '../containers/StatusBar'; import * as List from '../containers/List'; +import SafeAreaView from '../containers/SafeAreaView'; +import StatusBar from '../containers/StatusBar'; +import { IApplicationState, TServerModel } from '../definitions'; +import I18n from '../i18n'; +import { BIOMETRY_ENABLED_KEY, DEFAULT_AUTO_LOCK, SWITCH_TRACK_COLOR, themes } from '../lib/constants'; import database from '../lib/database'; import { changePasscode, checkHasPasscode, supportedBiometryLabel } from '../lib/methods/helpers/localAuthentication'; -import { BIOMETRY_ENABLED_KEY, DEFAULT_AUTO_LOCK, themes, SWITCH_TRACK_COLOR } from '../lib/constants'; -import SafeAreaView from '../containers/SafeAreaView'; import { events, logEvent } from '../lib/methods/helpers/log'; import userPreferences from '../lib/methods/userPreferences'; -import { IApplicationState, TServerModel } from '../definitions'; +import { TSupportedThemes, withTheme } from '../theme'; const DEFAULT_BIOMETRY = false; @@ -178,7 +178,7 @@ class ScreenLockConfigView extends React.Component { const { title, value, disabled } = item; return ( - <> + this.changeAutoLockTime(value)} @@ -187,7 +187,7 @@ class ScreenLockConfigView extends React.Component - + ); };