Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/carousel/Carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ export default class Carousel extends Component {
autoplayDelay: PropTypes.number,
autoplayInterval: PropTypes.number,
callbackOffsetMargin: PropTypes.number,
containerCustomStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,
contentContainerCustomStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,
containerCustomStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes ? View.propTypes.style : () => null,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

containerCustomStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes?.style ? View.propTypes.style : () => null

instead... Your's didnt work for me, but the ?. does....

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these solutions are awesome I'll try it out right away

contentContainerCustomStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes ? View.propTypes.style : () => null,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above:

        contentContainerCustomStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes?.style ? View.propTypes.style : () => null,

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry - terrible at using this github stuff!!!

You change did not fix the problem, still got red errors in chrome.... The following (just in the Carousel.js) did fix it as a slight mod to yours:

containerCustomStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes?.style ? View.propTypes.style : () => null,
contentContainerCustomStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes?.style ? View.propTypes.style : () => null,

Copy link
Author

@capelski capelski Apr 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @cyphire. Which device and browser are you testing it from? The fix was working fine on a Windows 10 Chrome browser. The only difference in your code is checking that View.propTypes contains a property named style. In fact, your code would be more readable if you'd replace the ternary operator with an or operator:

Suggested change
contentContainerCustomStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes ? View.propTypes.style : () => null,
contentContainerCustomStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes?.style || () => null,

But again, in which case do you get a View.propTypes without the style property?

enableMomentum: PropTypes.bool,
enableSnap: PropTypes.bool,
firstItem: PropTypes.number,
Expand All @@ -61,7 +61,7 @@ export default class Carousel extends Component {
scrollEnabled: PropTypes.bool,
scrollInterpolator: PropTypes.func,
slideInterpolatedStyle: PropTypes.func,
slideStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,
slideStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes ? View.propTypes.style : () => null,
shouldOptimizeUpdates: PropTypes.bool,
swipeThreshold: PropTypes.number,
useScrollView: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
Expand Down
8 changes: 4 additions & 4 deletions src/pagination/Pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ export default class Pagination extends PureComponent {
dotsLength: PropTypes.number.isRequired,
activeOpacity: PropTypes.number,
carouselRef: PropTypes.object,
containerStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,
containerStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes ? View.propTypes.style : () => null,
dotColor: PropTypes.string,
dotContainerStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,
dotContainerStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes ? View.propTypes.style : () => null,
dotElement: PropTypes.element,
dotStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,
dotStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes ? View.propTypes.style : () => null,
inactiveDotColor: PropTypes.string,
inactiveDotElement: PropTypes.element,
inactiveDotOpacity: PropTypes.number,
inactiveDotScale: PropTypes.number,
inactiveDotStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,
inactiveDotStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes ? View.propTypes.style : () => null,
renderDots: PropTypes.func,
tappableDots: PropTypes.bool,
vertical: PropTypes.bool,
Expand Down
6 changes: 3 additions & 3 deletions src/pagination/PaginationDot.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ export default class PaginationDot extends PureComponent {
activeOpacity: PropTypes.number,
carouselRef: PropTypes.object,
color: PropTypes.string,
containerStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,
containerStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes ? View.propTypes.style : () => null,
inactiveColor: PropTypes.string,
inactiveStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,
inactiveStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes ? View.propTypes.style : () => null,
index: PropTypes.number,
style: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,
style: ViewPropTypes ? ViewPropTypes.style : View.propTypes ? View.propTypes.style : () => null,
tappable: PropTypes.bool
};

Expand Down
2 changes: 1 addition & 1 deletion src/parallaximage/ParallaxImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default class ParallaxImage extends Component {
sliderHeight: PropTypes.number, // passed from <Carousel />
sliderWidth: PropTypes.number, // passed from <Carousel />
vertical: PropTypes.bool, // passed from <Carousel />
containerStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,
containerStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes ? View.propTypes.style : () => null,
dimensions: PropTypes.shape({
width: PropTypes.number,
height: PropTypes.number
Expand Down