From c6953bef477d358e589ea2f600bf1a77f460c5fd Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Tue, 6 Apr 2021 21:18:31 -0400 Subject: [PATCH] Fix propTypes warnings (#5285) --- app/components/at_mention/at_mention.js | 9 ++-- app/components/channel_link/channel_link.js | 5 +-- .../channel_loader/channel_loader.js | 3 +- app/components/conditional_touchable.js | 4 +- app/components/custom_list/custom_list_row.js | 3 +- .../button_binding/button_binding_text.tsx | 11 ++--- .../embedded_bindings/embed_text.tsx | 12 ++--- app/components/emoji/emoji.js | 6 +-- app/components/error_text/error_text.js | 3 +- app/components/formatted_markdown_text.js | 5 +-- app/components/formatted_time.js | 4 +- .../layout/keyboard_layout/keyboard_layout.js | 4 +- app/components/markdown/hashtag/index.js | 5 +-- app/components/markdown/markdown.js | 6 +-- .../markdown/markdown_block_quote.js | 5 +-- .../markdown_code_block.js | 3 +- .../markdown/markdown_emoji/markdown_emoji.js | 3 +- .../markdown/markdown_image/markdown_image.js | 3 +- .../markdown/markdown_link/markdown_link.js | 3 +- app/components/markdown/markdown_list_item.js | 6 +-- .../message_attachments/attachment_fields.js | 7 ++- .../message_attachments/attachment_pretext.js | 5 +-- .../message_attachments/attachment_text.js | 7 ++- app/components/message_attachments/index.js | 4 +- .../message_attachments/message_attachment.js | 7 ++- .../post_add_channel_member.js | 13 +++--- .../system_message_helpers.test.js.snap | 45 +++---------------- .../post_body_additional_content.js | 3 +- .../progressive_image/progressive_image.js | 7 ++- app/components/search_bar/index.js | 7 ++- .../touchable_with_feedback.android.js | 4 +- .../touchable_with_feedback.ios.js | 4 +- 32 files changed, 72 insertions(+), 144 deletions(-) diff --git a/app/components/at_mention/at_mention.js b/app/components/at_mention/at_mention.js index 07979e3ee..44ac90661 100644 --- a/app/components/at_mention/at_mention.js +++ b/app/components/at_mention/at_mention.js @@ -3,14 +3,13 @@ import React from 'react'; import PropTypes from 'prop-types'; -import {Text} from 'react-native'; +import {StyleSheet, Text} from 'react-native'; import Clipboard from '@react-native-community/clipboard'; import {intlShape} from 'react-intl'; import {displayUsername} from '@mm-redux/utils/user_utils'; import {showModal} from '@actions/navigation'; import CompassIcon from '@components/compass_icon'; -import CustomPropTypes from '@constants/custom_prop_types'; import BottomSheet from '@utils/bottom_sheet'; import mattermostManaged from 'app/mattermost_managed'; @@ -19,9 +18,9 @@ export default class AtMention extends React.PureComponent { isSearchResult: PropTypes.bool, mentionKeys: PropTypes.array.isRequired, mentionName: PropTypes.string.isRequired, - mentionStyle: CustomPropTypes.Style, + mentionStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), onPostPress: PropTypes.func, - textStyle: CustomPropTypes.Style, + textStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), teammateNameDisplay: PropTypes.string, theme: PropTypes.object.isRequired, usersByUsername: PropTypes.object.isRequired, @@ -193,7 +192,7 @@ export default class AtMention extends React.PureComponent { } if (suffix) { - const suffixStyle = {...styleText, color: theme.centerChannelColor}; + const suffixStyle = {...StyleSheet.flatten(styleText), color: theme.centerChannelColor}; suffixElement = ( {suffix} diff --git a/app/components/channel_link/channel_link.js b/app/components/channel_link/channel_link.js index 40056fbac..1580f4297 100644 --- a/app/components/channel_link/channel_link.js +++ b/app/components/channel_link/channel_link.js @@ -7,7 +7,6 @@ import {Text} from 'react-native'; import {intlShape} from 'react-intl'; import {popToRoot, dismissAllModals} from '@actions/navigation'; -import CustomPropTypes from '@constants/custom_prop_types'; import {t} from '@utils/i18n'; import {alertErrorWithFallback} from '@utils/general'; @@ -19,9 +18,9 @@ export default class ChannelLink extends React.PureComponent { channelMentions: PropTypes.object, currentTeamId: PropTypes.string.isRequired, currentUserId: PropTypes.string.isRequired, - linkStyle: CustomPropTypes.Style, + linkStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), onChannelLinkPress: PropTypes.func, - textStyle: CustomPropTypes.Style, + textStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), channelsByName: PropTypes.object.isRequired, actions: PropTypes.shape({ handleSelectChannel: PropTypes.func.isRequired, diff --git a/app/components/channel_loader/channel_loader.js b/app/components/channel_loader/channel_loader.js index a9656b78a..33f74704c 100644 --- a/app/components/channel_loader/channel_loader.js +++ b/app/components/channel_loader/channel_loader.js @@ -14,7 +14,6 @@ import * as RNPlaceholder from 'rn-placeholder'; import {SafeAreaView} from 'react-native-safe-area-context'; import FormattedText from '@components/formatted_text'; -import CustomPropTypes from '@constants/custom_prop_types'; import {INDICATOR_BAR_HEIGHT} from '@constants/view'; import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme'; @@ -39,7 +38,7 @@ export default class ChannelLoader extends PureComponent { static propTypes = { backgroundColor: PropTypes.string, channelIsLoading: PropTypes.bool.isRequired, - style: CustomPropTypes.Style, + style: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), theme: PropTypes.object.isRequired, height: PropTypes.number, retryLoad: PropTypes.func, diff --git a/app/components/conditional_touchable.js b/app/components/conditional_touchable.js index ac0eb8ac1..fbf79ce6e 100644 --- a/app/components/conditional_touchable.js +++ b/app/components/conditional_touchable.js @@ -5,12 +5,10 @@ import PropTypes from 'prop-types'; import React from 'react'; import {TouchableOpacity} from 'react-native'; -import CustomPropTypes from '@constants/custom_prop_types'; - export default class ConditionalTouchable extends React.PureComponent { static propTypes = { touchable: PropTypes.bool, - children: CustomPropTypes.Children, + children: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf([PropTypes.node])]), }; render() { diff --git a/app/components/custom_list/custom_list_row.js b/app/components/custom_list/custom_list_row.js index 505cfaa7f..edddc0529 100644 --- a/app/components/custom_list/custom_list_row.js +++ b/app/components/custom_list/custom_list_row.js @@ -10,7 +10,6 @@ import { import CompassIcon from '@components/compass_icon'; import ConditionalTouchable from '@components/conditional_touchable'; -import CustomPropTypes from '@constants/custom_prop_types'; export default class CustomListRow extends React.PureComponent { static propTypes = { @@ -18,7 +17,7 @@ export default class CustomListRow extends React.PureComponent { enabled: PropTypes.bool, selectable: PropTypes.bool, selected: PropTypes.bool, - children: CustomPropTypes.Children, + children: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf([PropTypes.node])]), testID: PropTypes.string, }; diff --git a/app/components/embedded_bindings/button_binding/button_binding_text.tsx b/app/components/embedded_bindings/button_binding/button_binding_text.tsx index 0044ff74f..1e6f94f9c 100644 --- a/app/components/embedded_bindings/button_binding/button_binding_text.tsx +++ b/app/components/embedded_bindings/button_binding/button_binding_text.tsx @@ -3,12 +3,13 @@ import React from 'react'; import PropTypes from 'prop-types'; -import {Text, View, StyleSheet, StyleProp, TextStyle} from 'react-native'; -import Emoji from 'app/components/emoji'; -import {getEmoticonName} from 'app/utils/emoji_utils'; -import {reEmoji, reEmoticon, reMain} from 'app/constants/emoji'; +import {Text, View, StyleSheet, StyleProp} from 'react-native'; -export default function ButtonBindingText({message, style}: {message: string; style: StyleProp}) { +import Emoji from '@components/emoji'; +import {reEmoji, reEmoticon, reMain} from '@constants/emoji'; +import {getEmoticonName} from '@utils/emoji_utils'; + +export default function ButtonBindingText({message, style}: {message: string; style: StyleProp}) { const components = [] as JSX.Element[]; let text = message; diff --git a/app/components/embedded_bindings/embed_text.tsx b/app/components/embedded_bindings/embed_text.tsx index 20076ed24..0d21e5f7e 100644 --- a/app/components/embedded_bindings/embed_text.tsx +++ b/app/components/embedded_bindings/embed_text.tsx @@ -2,20 +2,20 @@ // See LICENSE.txt for license information. import React, {PureComponent} from 'react'; -import {LayoutChangeEvent, ScrollView, StyleProp, TextStyle, View, ViewStyle} from 'react-native'; +import {LayoutChangeEvent, ScrollView, StyleProp, View} from 'react-native'; -import Markdown from 'app/components/markdown'; -import ShowMoreButton from 'app/components/show_more_button'; +import Markdown from '@components/markdown'; +import ShowMoreButton from '@components/show_more_button'; import {Theme} from '@mm-redux/types/preferences'; const SHOW_MORE_HEIGHT = 60; type Props = { - baseTextStyle: StyleProp, - blockStyles?: StyleProp[], + baseTextStyle: StyleProp, + blockStyles?: StyleProp[], deviceHeight: number, onPermalinkPress?: () => void, - textStyles?: StyleProp[], + textStyles?: StyleProp[], theme?: Theme, value?: string, } diff --git a/app/components/emoji/emoji.js b/app/components/emoji/emoji.js index 4b0b499a9..a1d9d6f38 100644 --- a/app/components/emoji/emoji.js +++ b/app/components/emoji/emoji.js @@ -10,8 +10,6 @@ import { } from 'react-native'; import FastImage from 'react-native-fast-image'; -import CustomPropTypes from '@constants/custom_prop_types'; - export default class Emoji extends React.PureComponent { static propTypes = { @@ -36,9 +34,9 @@ export default class Emoji extends React.PureComponent { displayTextOnly: PropTypes.bool, literal: PropTypes.string, size: PropTypes.number, - textStyle: CustomPropTypes.Style, + textStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), unicode: PropTypes.string, - customEmojiStyle: CustomPropTypes.Style, + customEmojiStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), testID: PropTypes.string, }; diff --git a/app/components/error_text/error_text.js b/app/components/error_text/error_text.js index 5ecff8671..edfed2860 100644 --- a/app/components/error_text/error_text.js +++ b/app/components/error_text/error_text.js @@ -5,7 +5,6 @@ import React, {PureComponent} from 'react'; import PropTypes from 'prop-types'; import {Text} from 'react-native'; -import CustomPropTypes from '@constants/custom_prop_types'; import FormattedText from 'app/components/formatted_text'; import {GlobalStyles} from 'app/styles'; import {makeStyleSheetFromTheme} from 'app/utils/theme'; @@ -14,7 +13,7 @@ export default class ErrorText extends PureComponent { static propTypes = { testID: PropTypes.string, error: PropTypes.oneOfType([PropTypes.string, PropTypes.object]), - textStyle: CustomPropTypes.Style, + textStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), theme: PropTypes.object.isRequired, }; diff --git a/app/components/formatted_markdown_text.js b/app/components/formatted_markdown_text.js index 009ccbb22..a5f95aef4 100644 --- a/app/components/formatted_markdown_text.js +++ b/app/components/formatted_markdown_text.js @@ -10,7 +10,6 @@ import {injectIntl, intlShape} from 'react-intl'; import {concatStyles, changeOpacity, makeStyleSheetFromTheme} from 'app/utils/theme'; import {getMarkdownTextStyles} from 'app/utils/markdown'; -import CustomPropTypes from '@constants/custom_prop_types'; import AtMention from 'app/components/at_mention'; import MarkdownLink from 'app/components/markdown/markdown_link'; @@ -32,11 +31,11 @@ const TARGET_BLANK_URL_PREFIX = '!'; */ class FormattedMarkdownText extends React.PureComponent { static propTypes = { - baseTextStyle: CustomPropTypes.Style, + baseTextStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), defaultMessage: PropTypes.string.isRequired, id: PropTypes.string.isRequired, onPostPress: PropTypes.func, - style: CustomPropTypes.Style, + style: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), textStyles: PropTypes.object, theme: PropTypes.object.isRequired, values: PropTypes.object, diff --git a/app/components/formatted_time.js b/app/components/formatted_time.js index 1eb22aff8..407d3cbf9 100644 --- a/app/components/formatted_time.js +++ b/app/components/formatted_time.js @@ -6,15 +6,13 @@ import PropTypes from 'prop-types'; import {Text} from 'react-native'; import moment from 'moment-timezone'; -import CustomPropTypes from '@constants/custom_prop_types'; - export default class FormattedTime extends React.PureComponent { static propTypes = { value: PropTypes.any.isRequired, timeZone: PropTypes.string, children: PropTypes.func, hour12: PropTypes.bool, - style: CustomPropTypes.Style, + style: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), testID: PropTypes.string, }; diff --git a/app/components/layout/keyboard_layout/keyboard_layout.js b/app/components/layout/keyboard_layout/keyboard_layout.js index aa26ea1df..f38af5aac 100644 --- a/app/components/layout/keyboard_layout/keyboard_layout.js +++ b/app/components/layout/keyboard_layout/keyboard_layout.js @@ -10,12 +10,10 @@ import { View, } from 'react-native'; -import * as CustomPropTypes from '@constants/custom_prop_types'; - export default class KeyboardLayout extends PureComponent { static propTypes = { children: PropTypes.node, - style: CustomPropTypes.Style, + style: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), testID: PropTypes.string, }; diff --git a/app/components/markdown/hashtag/index.js b/app/components/markdown/hashtag/index.js index 47820f929..39f660f38 100644 --- a/app/components/markdown/hashtag/index.js +++ b/app/components/markdown/hashtag/index.js @@ -5,13 +5,12 @@ import PropTypes from 'prop-types'; import React from 'react'; import {Text} from 'react-native'; -import CustomPropTypes from '@constants/custom_prop_types'; -import {popToRoot, showSearchModal, dismissAllModals} from 'app/actions/navigation'; +import {popToRoot, showSearchModal, dismissAllModals} from '@actions/navigation'; export default class Hashtag extends React.PureComponent { static propTypes = { hashtag: PropTypes.string.isRequired, - linkStyle: CustomPropTypes.Style, + linkStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), onHashtagPress: PropTypes.func, }; diff --git a/app/components/markdown/markdown.js b/app/components/markdown/markdown.js index 3c1fd15f5..ce78bdc9f 100644 --- a/app/components/markdown/markdown.js +++ b/app/components/markdown/markdown.js @@ -16,7 +16,6 @@ import ChannelLink from 'app/components/channel_link'; import Emoji from 'app/components/emoji'; import FormattedText from 'app/components/formatted_text'; import Hashtag from 'app/components/markdown/hashtag'; -import CustomPropTypes from '@constants/custom_prop_types'; import {blendColors, concatStyles, makeStyleSheetFromTheme} from 'app/utils/theme'; import {getScheme} from 'app/utils/url'; @@ -40,7 +39,7 @@ import { export default class Markdown extends PureComponent { static propTypes = { autolinkedUrlSchemes: PropTypes.array, - baseTextStyle: CustomPropTypes.Style, + baseTextStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), blockStyles: PropTypes.object, channelMentions: PropTypes.object, imagesMetadata: PropTypes.object, @@ -155,7 +154,8 @@ export default class Markdown extends PureComponent { }; computeTextStyle = (baseStyle, context) => { - return concatStyles(baseStyle, context.map((type) => this.props.textStyles[type])); + const contextStyles = context.map((type) => this.props.textStyles[type]).filter((f) => f !== undefined); + return contextStyles.length ? concatStyles(baseStyle, contextStyles) : baseStyle; }; renderText = ({context, literal}) => { diff --git a/app/components/markdown/markdown_block_quote.js b/app/components/markdown/markdown_block_quote.js index c4ab253a9..8fdbcfe95 100644 --- a/app/components/markdown/markdown_block_quote.js +++ b/app/components/markdown/markdown_block_quote.js @@ -9,13 +9,12 @@ import { } from 'react-native'; import CompassIcon from '@components/compass_icon'; -import CustomPropTypes from '@constants/custom_prop_types'; export default class MarkdownBlockQuote extends PureComponent { static propTypes = { continue: PropTypes.bool, - iconStyle: CustomPropTypes.Style, - children: CustomPropTypes.Children, + iconStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), + children: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf([PropTypes.node])]), }; render() { diff --git a/app/components/markdown/markdown_code_block/markdown_code_block.js b/app/components/markdown/markdown_code_block/markdown_code_block.js index d33ecc45d..2abd7c8fa 100644 --- a/app/components/markdown/markdown_code_block/markdown_code_block.js +++ b/app/components/markdown/markdown_code_block/markdown_code_block.js @@ -12,7 +12,6 @@ import { } from 'react-native'; import Clipboard from '@react-native-community/clipboard'; -import CustomPropTypes from '@constants/custom_prop_types'; import FormattedText from 'app/components/formatted_text'; import TouchableWithFeedback from 'app/components/touchable_with_feedback'; import BottomSheet from 'app/utils/bottom_sheet'; @@ -29,7 +28,7 @@ export default class MarkdownCodeBlock extends React.PureComponent { theme: PropTypes.object.isRequired, language: PropTypes.string, content: PropTypes.string.isRequired, - textStyle: CustomPropTypes.Style, + textStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), }; static defaultProps = { diff --git a/app/components/markdown/markdown_emoji/markdown_emoji.js b/app/components/markdown/markdown_emoji/markdown_emoji.js index bab4c7cc7..4c4b8a7b6 100644 --- a/app/components/markdown/markdown_emoji/markdown_emoji.js +++ b/app/components/markdown/markdown_emoji/markdown_emoji.js @@ -9,12 +9,11 @@ import PropTypes from 'prop-types'; import Emoji from 'app/components/emoji'; import FormattedText from 'app/components/formatted_text'; -import CustomPropTypes from '@constants/custom_prop_types'; import {blendColors, concatStyles, makeStyleSheetFromTheme} from 'app/utils/theme'; export default class MarkdownEmoji extends PureComponent { static propTypes = { - baseTextStyle: CustomPropTypes.Style, + baseTextStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), isEdited: PropTypes.bool, shouldRenderJumboEmoji: PropTypes.bool.isRequired, theme: PropTypes.object.isRequired, diff --git a/app/components/markdown/markdown_image/markdown_image.js b/app/components/markdown/markdown_image/markdown_image.js index f3634eb6c..7b044ddde 100644 --- a/app/components/markdown/markdown_image/markdown_image.js +++ b/app/components/markdown/markdown_image/markdown_image.js @@ -19,7 +19,6 @@ import ImageViewPort from '@components/image_viewport'; import ProgressiveImage from '@components/progressive_image'; import FormattedText from '@components/formatted_text'; import TouchableWithFeedback from '@components/touchable_with_feedback'; -import {CustomPropTypes} from '@constants'; import EphemeralStore from '@store/ephemeral_store'; import BottomSheet from '@utils/bottom_sheet'; import {generateId} from '@utils/file'; @@ -35,7 +34,7 @@ export default class MarkdownImage extends ImageViewPort { static propTypes = { children: PropTypes.node, disable: PropTypes.bool, - errorTextStyle: CustomPropTypes.Style, + errorTextStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), imagesMetadata: PropTypes.object, isReplyPost: PropTypes.bool, linkDestination: PropTypes.string, diff --git a/app/components/markdown/markdown_link/markdown_link.js b/app/components/markdown/markdown_link/markdown_link.js index 234ea89b2..5054398b7 100644 --- a/app/components/markdown/markdown_link/markdown_link.js +++ b/app/components/markdown/markdown_link/markdown_link.js @@ -10,7 +10,6 @@ import urlParse from 'url-parse'; import Config from '@assets/config'; import {DeepLinkTypes} from '@constants'; -import CustomPropTypes from '@constants/custom_prop_types'; import {getCurrentServerUrl} from '@init/credentials'; import BottomSheet from '@utils/bottom_sheet'; import {errorBadChannel} from '@utils/draft'; @@ -24,7 +23,7 @@ export default class MarkdownLink extends PureComponent { actions: PropTypes.shape({ handleSelectChannelByName: PropTypes.func.isRequired, }).isRequired, - children: CustomPropTypes.Children, + children: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf([PropTypes.node])]), href: PropTypes.string.isRequired, onPermalinkPress: PropTypes.func, serverURL: PropTypes.string, diff --git a/app/components/markdown/markdown_list_item.js b/app/components/markdown/markdown_list_item.js index 7b2bb22b5..629b5cc8b 100644 --- a/app/components/markdown/markdown_list_item.js +++ b/app/components/markdown/markdown_list_item.js @@ -9,16 +9,14 @@ import { View, } from 'react-native'; -import CustomPropTypes from '@constants/custom_prop_types'; - export default class MarkdownListItem extends PureComponent { static propTypes = { - children: CustomPropTypes.Children, + children: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf([PropTypes.node])]), ordered: PropTypes.bool.isRequired, continue: PropTypes.bool, index: PropTypes.number.isRequired, bulletWidth: PropTypes.number, - bulletStyle: CustomPropTypes.Style, + bulletStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), level: PropTypes.number, }; diff --git a/app/components/message_attachments/attachment_fields.js b/app/components/message_attachments/attachment_fields.js index 9bc3d21a7..74c487ad0 100644 --- a/app/components/message_attachments/attachment_fields.js +++ b/app/components/message_attachments/attachment_fields.js @@ -5,13 +5,12 @@ import React, {PureComponent} from 'react'; import {Text, View} from 'react-native'; import PropTypes from 'prop-types'; -import Markdown from 'app/components/markdown'; -import CustomPropTypes from '@constants/custom_prop_types'; -import {makeStyleSheetFromTheme} from 'app/utils/theme'; +import Markdown from '@components/markdown'; +import {makeStyleSheetFromTheme} from '@utils/theme'; export default class AttachmentFields extends PureComponent { static propTypes = { - baseTextStyle: CustomPropTypes.Style, + baseTextStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), blockStyles: PropTypes.object.isRequired, fields: PropTypes.array, metadata: PropTypes.object, diff --git a/app/components/message_attachments/attachment_pretext.js b/app/components/message_attachments/attachment_pretext.js index af4013ef3..6bc7cfec8 100644 --- a/app/components/message_attachments/attachment_pretext.js +++ b/app/components/message_attachments/attachment_pretext.js @@ -5,12 +5,11 @@ import React, {PureComponent} from 'react'; import {StyleSheet, View} from 'react-native'; import PropTypes from 'prop-types'; -import Markdown from 'app/components/markdown'; -import CustomPropTypes from '@constants/custom_prop_types'; +import Markdown from '@components/markdown'; export default class AttachmentPreText extends PureComponent { static propTypes = { - baseTextStyle: CustomPropTypes.Style, + baseTextStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), blockStyles: PropTypes.object.isRequired, metadata: PropTypes.object, onPermalinkPress: PropTypes.func, diff --git a/app/components/message_attachments/attachment_text.js b/app/components/message_attachments/attachment_text.js index 3930ee4c9..9ce69df86 100644 --- a/app/components/message_attachments/attachment_text.js +++ b/app/components/message_attachments/attachment_text.js @@ -5,15 +5,14 @@ import React, {PureComponent} from 'react'; import {ScrollView, StyleSheet, View} from 'react-native'; import PropTypes from 'prop-types'; -import Markdown from 'app/components/markdown'; -import ShowMoreButton from 'app/components/show_more_button'; -import CustomPropTypes from '@constants/custom_prop_types'; +import Markdown from '@components/markdown'; +import ShowMoreButton from '@components/show_more_button'; const SHOW_MORE_HEIGHT = 60; export default class AttachmentText extends PureComponent { static propTypes = { - baseTextStyle: CustomPropTypes.Style, + baseTextStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), blockStyles: PropTypes.object.isRequired, deviceHeight: PropTypes.number.isRequired, hasThumbnail: PropTypes.bool, diff --git a/app/components/message_attachments/index.js b/app/components/message_attachments/index.js index e22205e7c..be0e80000 100644 --- a/app/components/message_attachments/index.js +++ b/app/components/message_attachments/index.js @@ -5,14 +5,12 @@ import React, {PureComponent} from 'react'; import {View} from 'react-native'; import PropTypes from 'prop-types'; -import CustomPropTypes from '@constants/custom_prop_types'; - import MessageAttachment from './message_attachment'; export default class MessageAttachments extends PureComponent { static propTypes = { attachments: PropTypes.array.isRequired, - baseTextStyle: CustomPropTypes.Style, + baseTextStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), blockStyles: PropTypes.object, deviceHeight: PropTypes.number.isRequired, deviceWidth: PropTypes.number.isRequired, diff --git a/app/components/message_attachments/message_attachment.js b/app/components/message_attachments/message_attachment.js index f9cf71a58..d87a5b13f 100644 --- a/app/components/message_attachments/message_attachment.js +++ b/app/components/message_attachments/message_attachment.js @@ -5,9 +5,8 @@ import React, {PureComponent} from 'react'; import PropTypes from 'prop-types'; import {View} from 'react-native'; -import CustomPropTypes from '@constants/custom_prop_types'; -import {getStatusColors} from 'app/utils/message_attachment_colors'; -import {changeOpacity, makeStyleSheetFromTheme} from 'app/utils/theme'; +import {getStatusColors} from '@utils/message_attachment_colors'; +import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme'; import AttachmentActions from './attachment_actions'; import AttachmentAuthor from './attachment_author'; @@ -22,7 +21,7 @@ import AttachmentFooter from './attachment_footer'; export default class MessageAttachment extends PureComponent { static propTypes = { attachment: PropTypes.object.isRequired, - baseTextStyle: CustomPropTypes.Style, + baseTextStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), blockStyles: PropTypes.object, deviceHeight: PropTypes.number.isRequired, deviceWidth: PropTypes.number.isRequired, diff --git a/app/components/post_add_channel_member/post_add_channel_member.js b/app/components/post_add_channel_member/post_add_channel_member.js index cf219aecd..e36f9f6c0 100644 --- a/app/components/post_add_channel_member/post_add_channel_member.js +++ b/app/components/post_add_channel_member/post_add_channel_member.js @@ -7,14 +7,11 @@ import {intlShape} from 'react-intl'; import {Text} from 'react-native'; +import AtMention from '@components/at_mention'; +import FormattedText from '@components/formatted_text'; import {General} from '@mm-redux/constants'; - -import {concatStyles} from 'app/utils/theme'; -import {t} from 'app/utils/i18n'; - -import AtMention from 'app/components/at_mention'; -import FormattedText from 'app/components/formatted_text'; -import CustomPropTypes from '@constants/custom_prop_types'; +import {t} from '@utils/i18n'; +import {concatStyles} from '@utils/theme'; export default class PostAddChannelMember extends React.PureComponent { static propTypes = { @@ -23,7 +20,7 @@ export default class PostAddChannelMember extends React.PureComponent { removePost: PropTypes.func.isRequired, sendAddToChannelEphemeralPost: PropTypes.func.isRequired, }).isRequired, - baseTextStyle: CustomPropTypes.Style, + baseTextStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), currentUser: PropTypes.object.isRequired, channelType: PropTypes.string, post: PropTypes.object.isRequired, diff --git a/app/components/post_body/__snapshots__/system_message_helpers.test.js.snap b/app/components/post_body/__snapshots__/system_message_helpers.test.js.snap index f166cc335..d1e0ea325 100644 --- a/app/components/post_body/__snapshots__/system_message_helpers.test.js.snap +++ b/app/components/post_body/__snapshots__/system_message_helpers.test.js.snap @@ -14,14 +14,7 @@ exports[`renderSystemMessage uses renderer for Channel Display Name update 1`] = > {username} updated the channel display name from: {oldDisplayName} to: {newDisplayName} @@ -44,14 +37,7 @@ exports[`renderSystemMessage uses renderer for Channel Header update 1`] = ` > {username} updated the channel header from: {oldHeader} to: {newHeader} @@ -82,14 +68,7 @@ exports[`renderSystemMessage uses renderer for OLD archived channel without a us > {username} archived the channel @@ -123,14 +102,7 @@ exports[`renderSystemMessage uses renderer for archived channel 2`] = ` > {username} archived the channel @@ -153,14 +125,7 @@ exports[`renderSystemMessage uses renderer for unarchived channel 1`] = ` > {username} unarchived the channel diff --git a/app/components/post_body_additional_content/post_body_additional_content.js b/app/components/post_body_additional_content/post_body_additional_content.js index a585764e2..ab6bd87ed 100644 --- a/app/components/post_body_additional_content/post_body_additional_content.js +++ b/app/components/post_body_additional_content/post_body_additional_content.js @@ -18,7 +18,6 @@ import ImageViewPort from '@components/image_viewport'; import PostAttachmentImage from '@components/post_attachment_image'; import ProgressiveImage from '@components/progressive_image'; import TouchableWithFeedback from '@components/touchable_with_feedback'; -import CustomPropTypes from '@constants/custom_prop_types'; import EventEmitter from '@mm-redux/utils/event_emitter'; import {generateId} from '@utils/file'; import {calculateDimensions, getViewPortWidth, openGalleryAtIndex} from '@utils/images'; @@ -36,7 +35,7 @@ export default class PostBodyAdditionalContent extends ImageViewPort { actions: PropTypes.shape({ getRedirectLocation: PropTypes.func.isRequired, }).isRequired, - baseTextStyle: CustomPropTypes.Style, + baseTextStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), blockStyles: PropTypes.object, deviceHeight: PropTypes.number.isRequired, deviceWidth: PropTypes.number.isRequired, diff --git a/app/components/progressive_image/progressive_image.js b/app/components/progressive_image/progressive_image.js index 59d5dc229..73bc5b65f 100644 --- a/app/components/progressive_image/progressive_image.js +++ b/app/components/progressive_image/progressive_image.js @@ -6,7 +6,6 @@ import PropTypes from 'prop-types'; import {Animated, ImageBackground, Image, Platform, View, StyleSheet} from 'react-native'; import thumb from '@assets/images/thumb.png'; -import CustomPropTypes from '@constants/custom_prop_types'; import RetriableFastImage from '@components/retriable_fast_image'; import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme'; @@ -17,15 +16,15 @@ export default class ProgressiveImage extends PureComponent { static propTypes = { id: PropTypes.string, isBackgroundImage: PropTypes.bool, - children: CustomPropTypes.Children, + children: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf([PropTypes.node])]), defaultSource: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.number]), // this should be provided by the component imageUri: PropTypes.string, - imageStyle: CustomPropTypes.Style, + imageStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), inViewPort: PropTypes.bool, onError: PropTypes.func, resizeMethod: PropTypes.string, resizeMode: PropTypes.string, - style: CustomPropTypes.Style, + style: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), theme: PropTypes.object.isRequired, thumbnailUri: PropTypes.string, tintDefaultSource: PropTypes.bool, diff --git a/app/components/search_bar/index.js b/app/components/search_bar/index.js index 3279f7c43..0f04112b6 100644 --- a/app/components/search_bar/index.js +++ b/app/components/search_bar/index.js @@ -19,7 +19,6 @@ import {SearchBar} from 'react-native-elements'; import {memoizeResult} from '@mm-redux/utils/helpers'; import CompassIcon from '@components/compass_icon'; -import CustomPropTypes from '@constants/custom_prop_types'; const LEFT_COMPONENT_INITIAL_POSITION = Platform.OS === 'ios' ? 7 : 0; @@ -38,9 +37,9 @@ export default class Search extends PureComponent { tintColorSearch: PropTypes.string, tintColorDelete: PropTypes.string, selectionColor: PropTypes.string, - inputStyle: CustomPropTypes.Style, - containerStyle: CustomPropTypes.Style, - cancelButtonStyle: CustomPropTypes.Style, + inputStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), + containerStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), + cancelButtonStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), autoFocus: PropTypes.bool, placeholder: PropTypes.string, cancelTitle: PropTypes.oneOfType([ diff --git a/app/components/touchable_with_feedback/touchable_with_feedback.android.js b/app/components/touchable_with_feedback/touchable_with_feedback.android.js index 54c1e9238..0532ea27c 100644 --- a/app/components/touchable_with_feedback/touchable_with_feedback.android.js +++ b/app/components/touchable_with_feedback/touchable_with_feedback.android.js @@ -7,12 +7,10 @@ import React, {PureComponent} from 'react'; import {TouchableNativeFeedback, TouchableOpacity, TouchableWithoutFeedback, View} from 'react-native'; import PropTypes from 'prop-types'; -import CustomPropTypes from '@constants/custom_prop_types'; - export default class TouchableWithFeedbackAndroid extends PureComponent { static propTypes = { testID: PropTypes.string, - children: CustomPropTypes.Children, + children: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf([PropTypes.node])]), underlayColor: PropTypes.string, type: PropTypes.oneOf(['native', 'opacity', 'none']), }; diff --git a/app/components/touchable_with_feedback/touchable_with_feedback.ios.js b/app/components/touchable_with_feedback/touchable_with_feedback.ios.js index da4dcc28b..fb1f1f1cd 100644 --- a/app/components/touchable_with_feedback/touchable_with_feedback.ios.js +++ b/app/components/touchable_with_feedback/touchable_with_feedback.ios.js @@ -5,12 +5,10 @@ import React, {PureComponent} from 'react'; import {PanResponder, TouchableHighlight, TouchableOpacity, TouchableWithoutFeedback, View} from 'react-native'; import PropTypes from 'prop-types'; -import CustomPropTypes from '@constants/custom_prop_types'; - export default class TouchableWithFeedbackIOS extends PureComponent { static propTypes = { testID: PropTypes.string, - children: CustomPropTypes.Children, + children: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf([PropTypes.node])]), cancelTouchOnPanning: PropTypes.bool, type: PropTypes.oneOf(['native', 'opacity', 'none']), };