Skip to content

Commit

Permalink
updating comment, added required to props
Browse files Browse the repository at this point in the history
  • Loading branch information
JediWattson committed Nov 19, 2022
1 parent 3dd0e19 commit 7abd76e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 28 deletions.
19 changes: 6 additions & 13 deletions src/components/AttachmentCarousel/CarouselActions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import PropTypes from 'prop-types';
import {Pressable} from 'react-native';

const propTypes = {
/** handles onPress events with a callback */
onPress: PropTypes.func,
/** Handles onPress events with a callback */
onPress: PropTypes.func.isRequired,

/** can handle the cycling of attachments */
onCycleThroughAttachments: PropTypes.func,
/** Callback to cycle through attachments */
onCycleThroughAttachments: PropTypes.func.isRequired,

/** can be set to provide styles */
styles: PropTypes.arrayOf(PropTypes.shape({})),
/** Styles to be assigned to Carousel */
styles: PropTypes.arrayOf(PropTypes.object).isRequired,

/** Children to render. */
children: PropTypes.oneOfType([
Expand All @@ -19,12 +19,6 @@ const propTypes = {
]).isRequired,
};

const defaultProps = {
styles: [],
onPress: () => {},
onCycleThroughAttachments: () => {},
};

class Carousel extends React.Component {
constructor(props) {
super(props);
Expand Down Expand Up @@ -64,6 +58,5 @@ class Carousel extends React.Component {
}

Carousel.propTypes = propTypes;
Carousel.defaultProps = defaultProps;

export default Carousel;
16 changes: 4 additions & 12 deletions src/components/AttachmentCarousel/CarouselActions/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,14 @@ const propTypes = {
children: PropTypes.element.isRequired,

/** Callback to fire when swiping left or right */
onCycleThroughAttachments: PropTypes.func,
onCycleThroughAttachments: PropTypes.func.isRequired,

/** Callback to handle a press event because PanResponder will intercept all gestures */
onPress: PropTypes.func,
onPress: PropTypes.func.isRequired,

/** These help to prevent a swipe animation when at either end */
canSwipeLeft: PropTypes.bool,
canSwipeRight: PropTypes.bool,
};

const defaultProps = {
onCycleThroughAttachments: () => {},
onPress: () => {},
canSwipeLeft: false,
canSwipeRight: false,
canSwipeLeft: PropTypes.bool.isRequired,
canSwipeRight: PropTypes.bool.isRequired,
};

class Carousel extends Component {
Expand Down Expand Up @@ -80,6 +73,5 @@ class Carousel extends Component {
}

Carousel.propTypes = propTypes;
Carousel.defaultProps = defaultProps;

export default Carousel;
4 changes: 1 addition & 3 deletions src/components/AttachmentModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import HeaderGap from './HeaderGap';
*/

const propTypes = {
/** Optional source URL for the image shown. If not passed in via props must be specified when modal is opened. */
/** Optional source URL for the image shown also initializes Carousel's data. If not passed in via props must be specified when modal is opened. */
sourceURL: PropTypes.string,

/** Optional callback to fire when we want to preview an image and approve it for use. */
Expand Down Expand Up @@ -78,7 +78,6 @@ class AttachmentModal extends PureComponent {
isModalOpen: false,
isConfirmModalOpen: false,
reportId: null,
showArrows: false,
file: {name: lodashGet(props, 'originalFileName', '')},
isAttachmentInvalid: false,
attachmentInvalidReasonTitle: null,
Expand Down Expand Up @@ -279,7 +278,6 @@ class AttachmentModal extends PureComponent {
<View style={styles.imageModalImageCenterContainer}>
{this.state.reportId ? (
<AttachmentCarousel
showArrows={this.state.showArrows}
reportId={this.state.reportId}
onNavigate={this.onNavigate}
sourceURL={this.props.sourceURL}
Expand Down

0 comments on commit 7abd76e

Please sign in to comment.