react-native-snap-carousel icon indicating copy to clipboard operation
react-native-snap-carousel copied to clipboard

fix: remove undefined ViewPropTypes references

Open capelski opened this issue 3 years ago • 10 comments

Platforms affected

Google Chrome on Windows

What does this PR do?

Fix propTypes issues on browsers

What testing has been done on this change?

Launched the app in the Expo Client

capelski avatar May 02 '21 15:05 capelski

If somebody is willing to provide a better solution, flow types should be used instead

capelski avatar May 02 '21 15:05 capelski

Hello, why not?

containerStyle: ViewPropTypes ? ViewPropTypes.style : null,

Gakusco avatar May 02 '21 19:05 Gakusco

Hello, why not?

containerStyle: ViewPropTypes ? ViewPropTypes.style : null,

React expects propTypes to be functions:

index.js:1 Warning: Failed prop type: Carousel: prop type `slideStyle` is invalid; it must be a function, usually from the `prop-types` package, but received `object`.

image

Using null instead of a null-returning function would raise warnings in development mode

capelski avatar May 03 '21 16:05 capelski

Hoping this PR can be merged soon. The workarounds posted elsewhere on Github using custom postinstall scripts to insert ViewPropTypes back into the package hurts my eyes. I know web isn't officially supported but it would be great nonetheless.

NiclasHorstad-acn avatar May 11 '21 08:05 NiclasHorstad-acn

Merging this would be very much appreciated. I'd like to avoid any of the post install hacks. being able to run the same codebase on every mobile platform and also the web is incredibly useful, especially in the development stage.

the-simian avatar May 22 '21 03:05 the-simian

I was having the same issue as described when running a React Native app on the web. With the changes the slider loads OK; but sliding (in de web variant) only works with the keyboard; not with the mouse. Am I doing something wrong?

acidjunk avatar May 25 '21 11:05 acidjunk

I was having the same issue as described when running a React Native app on the web. With the changes the slider loads OK; but sliding (in de web variant) only works with the keyboard; not with the mouse. Am I doing something wrong?

@acidjunk Unfortunately this library doesn't explicitly support web browsers; the behavior you describe is actually the expected behavior. You will only be able to slide the carrousel in web browsers when using tactile screens or when using the browser device emulator.

P.D. This PR is not adding web browser compatibility to the library but just fixing a null pointer error that causes a critical crash in web browsers

capelski avatar May 28 '21 13:05 capelski

Hello, I started getting this error in Expo SDK version 51. When will this PR be merged?

aliburhankeskin avatar May 09 '24 11:05 aliburhankeskin

Hello, I started getting this error in Expo SDK version 51. When will this PR be merged?

The PR has been open for 3 years now. I'd say this repository is not maintained unfortunately.

capelski avatar May 09 '24 14:05 capelski

Hello, I started getting this error in Expo SDK version 51. When will this PR be merged?

The PR has been open for 3 years now. I'd say this repository is not maintained unfortunately.

thanks for answer . By the way, this PR has also been improved. PR has been waiting for 2 weeks. https://github.com/meliorence/react-native-snap-carousel/pull/1015

aliburhankeskin avatar May 09 '24 14:05 aliburhankeskin