From d5aee38ab5d7d28f544819815b435446f45b048d Mon Sep 17 00:00:00 2001 From: aimane-chnaif Date: Mon, 15 May 2023 01:10:52 +1000 Subject: [PATCH 1/2] fix propType warning, make prettier happy --- src/components/AttachmentModal.js | 2 +- src/components/OpacityView.js | 3 ++- src/components/Pressable/PressableWithFeedback.js | 8 ++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/components/AttachmentModal.js b/src/components/AttachmentModal.js index 7179aa502ddb..83be46c352ad 100755 --- a/src/components/AttachmentModal.js +++ b/src/components/AttachmentModal.js @@ -261,7 +261,7 @@ class AttachmentModal extends PureComponent { backgroundColor={themeColors.componentBG} onModalShow={() => { this.props.onModalShow(); - this.setState({shouldLoadAttachment: true}) + this.setState({shouldLoadAttachment: true}); }} onModalHide={(e) => { this.props.onModalHide(e); diff --git a/src/components/OpacityView.js b/src/components/OpacityView.js index 1592befdf127..5665336f135a 100644 --- a/src/components/OpacityView.js +++ b/src/components/OpacityView.js @@ -9,7 +9,7 @@ const propTypes = { /** * Should we dim the view */ - shouldDim: PropTypes.bool.isRequired, + shouldDim: PropTypes.bool, /** * Content to render @@ -31,6 +31,7 @@ const propTypes = { }; const defaultProps = { + shouldDim: false, style: [], dimmingValue: variables.hoverDimValue, }; diff --git a/src/components/Pressable/PressableWithFeedback.js b/src/components/Pressable/PressableWithFeedback.js index d113798e9c6e..0bb25395714b 100644 --- a/src/components/Pressable/PressableWithFeedback.js +++ b/src/components/Pressable/PressableWithFeedback.js @@ -57,10 +57,10 @@ const PressableWithFeedback = forwardRef((props, ref) => { shouldDim={!disabled && (state.pressed || state.hovered)} dimmingValue={state.pressed ? props.pressDimmingValue : props.hoverDimmingValue} style={[ - StyleUtils.parseStyleFromFunction(props.style, state), - !disabled && state.pressed && StyleUtils.parseStyleFromFunction(props.pressStyle, state), - !disabled && state.hovered && StyleUtils.parseStyleAsArray(props.hoverStyle, state), - state.focused && StyleUtils.parseStyleAsArray(props.focusStyle, state), + ...StyleUtils.parseStyleFromFunction(props.style, state), + ...(!disabled && state.pressed ? StyleUtils.parseStyleFromFunction(props.pressStyle, state) : []), + ...(!disabled && state.hovered ? StyleUtils.parseStyleAsArray(props.hoverStyle, state) : []), + ...(state.focused ? StyleUtils.parseStyleAsArray(props.focusStyle, state) : []), ]} > {props.children} From b71502571ed958d5a6384c5580074cc7f9d8608a Mon Sep 17 00:00:00 2001 From: aimane-chnaif Date: Mon, 15 May 2023 02:27:22 +1000 Subject: [PATCH 2/2] pass boolean always instead of optional prop --- src/components/OpacityView.js | 3 +-- src/components/Pressable/PressableWithFeedback.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/OpacityView.js b/src/components/OpacityView.js index 5665336f135a..1592befdf127 100644 --- a/src/components/OpacityView.js +++ b/src/components/OpacityView.js @@ -9,7 +9,7 @@ const propTypes = { /** * Should we dim the view */ - shouldDim: PropTypes.bool, + shouldDim: PropTypes.bool.isRequired, /** * Content to render @@ -31,7 +31,6 @@ const propTypes = { }; const defaultProps = { - shouldDim: false, style: [], dimmingValue: variables.hoverDimValue, }; diff --git a/src/components/Pressable/PressableWithFeedback.js b/src/components/Pressable/PressableWithFeedback.js index 0bb25395714b..d2311654d87d 100644 --- a/src/components/Pressable/PressableWithFeedback.js +++ b/src/components/Pressable/PressableWithFeedback.js @@ -54,7 +54,7 @@ const PressableWithFeedback = forwardRef((props, ref) => { > {(state) => (