meliorence / react-native-snap-carousel

Swiper/carousel component for React Native featuring previews, multiple layouts, parallax images, performant handling of huge numbers of items, and more. Compatible with Android & iOS.
BSD 3-Clause "New" or "Revised" License
10.36k stars 2.29k forks source link

ERROR TypeError: Cannot read property 'style' of undefined due to ViewPropTypes and View.propTypes.style #970

Open hotaryuzaki opened 1 year ago

hotaryuzaki commented 1 year ago

the error

ERROR  TypeError: Cannot read property 'style' of undefined, js engine: hermes

i know someone already post this, but for me i have to remove View.propTypes.style too

slideStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,

to this

slideStyle: ViewPropTypes.style,

Hi! ๐Ÿ‘‹

Firstly, thanks for your work on this project! ๐Ÿ™‚

Today I used patch-package to patch react-native-snap-carousel@3.9.1 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-snap-carousel/src/carousel/Carousel.js b/node_modules/react-native-snap-carousel/src/carousel/Carousel.js
index dae71a3..5bc9f9d 100644
--- a/node_modules/react-native-snap-carousel/src/carousel/Carousel.js
+++ b/node_modules/react-native-snap-carousel/src/carousel/Carousel.js
@@ -1,5 +1,6 @@
 import React, { Component } from 'react';
-import { Animated, Easing, FlatList, I18nManager, Platform, ScrollView, View, ViewPropTypes } from 'react-native';
+import { Animated, Easing, FlatList, I18nManager, Platform, ScrollView, View } from 'react-native';
+import { ViewPropTypes } from 'deprecated-react-native-prop-types';
 import PropTypes from 'prop-types';
 import shallowCompare from 'react-addons-shallow-compare';
 import {
@@ -43,8 +44,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.style,
+        contentContainerCustomStyle: ViewPropTypes.style,
         enableMomentum: PropTypes.bool,
         enableSnap: PropTypes.bool,
         firstItem: PropTypes.number,
@@ -61,7 +62,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.style,
         shouldOptimizeUpdates: PropTypes.bool,
         swipeThreshold: PropTypes.number,
         useScrollView: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
diff --git a/node_modules/react-native-snap-carousel/src/pagination/Pagination.js b/node_modules/react-native-snap-carousel/src/pagination/Pagination.js
index 5c021cf..ef4cf5f 100644
--- a/node_modules/react-native-snap-carousel/src/pagination/Pagination.js
+++ b/node_modules/react-native-snap-carousel/src/pagination/Pagination.js
@@ -1,5 +1,6 @@
 import React, { PureComponent } from 'react';
-import { I18nManager, Platform, View, ViewPropTypes } from 'react-native';
+import { I18nManager, Platform, View } from 'react-native';
+import { ViewPropTypes } from 'deprecated-react-native-prop-types';
 import PropTypes from 'prop-types';
 import PaginationDot from './PaginationDot';
 import styles from './Pagination.style';
@@ -14,16 +15,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.style,
         dotColor: PropTypes.string,
-        dotContainerStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,
+        dotContainerStyle: ViewPropTypes.style,
         dotElement: PropTypes.element,
-        dotStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,
+        dotStyle: ViewPropTypes.style,
         inactiveDotColor: PropTypes.string,
         inactiveDotElement: PropTypes.element,
         inactiveDotOpacity: PropTypes.number,
         inactiveDotScale: PropTypes.number,
-        inactiveDotStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,
+        inactiveDotStyle: ViewPropTypes.style,
         renderDots: PropTypes.func,
         tappableDots: PropTypes.bool,
         vertical: PropTypes.bool,
diff --git a/node_modules/react-native-snap-carousel/src/pagination/PaginationDot.js b/node_modules/react-native-snap-carousel/src/pagination/PaginationDot.js
index e59d196..f8cb833 100644
--- a/node_modules/react-native-snap-carousel/src/pagination/PaginationDot.js
+++ b/node_modules/react-native-snap-carousel/src/pagination/PaginationDot.js
@@ -1,5 +1,6 @@
 import React, { PureComponent } from 'react';
-import { View, Animated, Easing, TouchableOpacity, ViewPropTypes } from 'react-native';
+import { View, Animated, Easing, TouchableOpacity } from 'react-native';
+import { ViewPropTypes } from 'deprecated-react-native-prop-types';
 import PropTypes from 'prop-types';
 import styles from './Pagination.style';

@@ -12,11 +13,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.style.style,
         inactiveColor: PropTypes.string,
-        inactiveStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,
+        inactiveStyle: ViewPropTypes,
         index: PropTypes.number,
-        style: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,
+        style: ViewPropTypes.style,
         tappable: PropTypes.bool
     };

diff --git a/node_modules/react-native-snap-carousel/src/parallaximage/ParallaxImage.js b/node_modules/react-native-snap-carousel/src/parallaximage/ParallaxImage.js
index 8bc774a..5b0afc7 100644
--- a/node_modules/react-native-snap-carousel/src/parallaximage/ParallaxImage.js
+++ b/node_modules/react-native-snap-carousel/src/parallaximage/ParallaxImage.js
@@ -1,7 +1,8 @@
 // Parallax effect inspired by https://github.com/oblador/react-native-parallax/

 import React, { Component } from 'react';
-import { View, ViewPropTypes, Image, Animated, Easing, ActivityIndicator, findNodeHandle } from 'react-native';
+import { View, Image, Animated, Easing, ActivityIndicator, findNodeHandle } from 'react-native';
+import { ViewPropTypes } from 'deprecated-react-native-prop-types';
 import PropTypes from 'prop-types';
 import styles from './ParallaxImage.style';

@@ -16,7 +17,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.style,
         dimensions: PropTypes.shape({
             width: PropTypes.number,
             height: PropTypes.number
irvanherz commented 1 year ago

Same problem :)

hotaryuzaki commented 1 year ago

Same problem :)

Just follows my post above using patch-package will solve the issue.

irfanismaya20 commented 1 year ago

how to solve ERROR TypeError: Cannot read property 'style' of undefined, js engine: hermes?

sammmkhannn commented 5 months ago

ViewPropTypes && ViewPropTypes.style Above worked for me.

SaifullahRazzaq commented 5 months ago

change ViewPropTypes.style to ViewPropTypes?.style will fixed the issue (nodemodules/react native snap carousel) add in all files make sure

Seunope commented 5 months ago

None of the above fixes worked for me, though my use case is different. react-native@0.70.1 |react-native-snap-carousel@3.9.1

After installing react-native-smooth-pincode:1.0.9 I started seeing this error message Cannot read property 'style' of undefined, js engine: hermes

I install the forked version @zfloc/react-native-smooth-pincode-input@2.1.1 this fixed this bug and the app worked fine

Akshayykadam commented 3 months ago

the error

ERROR  TypeError: Cannot read property 'style' of undefined, js engine: hermes

i know someone already post this, but for me i have to remove View.propTypes.style too

slideStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,

to this

slideStyle: ViewPropTypes.style,

Hi! ๐Ÿ‘‹

Firstly, thanks for your work on this project! ๐Ÿ™‚

Today I used patch-package to patch react-native-snap-carousel@3.9.1 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-snap-carousel/src/carousel/Carousel.js b/node_modules/react-native-snap-carousel/src/carousel/Carousel.js
index dae71a3..5bc9f9d 100644
--- a/node_modules/react-native-snap-carousel/src/carousel/Carousel.js
+++ b/node_modules/react-native-snap-carousel/src/carousel/Carousel.js
@@ -1,5 +1,6 @@
 import React, { Component } from 'react';
-import { Animated, Easing, FlatList, I18nManager, Platform, ScrollView, View, ViewPropTypes } from 'react-native';
+import { Animated, Easing, FlatList, I18nManager, Platform, ScrollView, View } from 'react-native';
+import { ViewPropTypes } from 'deprecated-react-native-prop-types';
 import PropTypes from 'prop-types';
 import shallowCompare from 'react-addons-shallow-compare';
 import {
@@ -43,8 +44,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.style,
+        contentContainerCustomStyle: ViewPropTypes.style,
         enableMomentum: PropTypes.bool,
         enableSnap: PropTypes.bool,
         firstItem: PropTypes.number,
@@ -61,7 +62,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.style,
         shouldOptimizeUpdates: PropTypes.bool,
         swipeThreshold: PropTypes.number,
         useScrollView: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
diff --git a/node_modules/react-native-snap-carousel/src/pagination/Pagination.js b/node_modules/react-native-snap-carousel/src/pagination/Pagination.js
index 5c021cf..ef4cf5f 100644
--- a/node_modules/react-native-snap-carousel/src/pagination/Pagination.js
+++ b/node_modules/react-native-snap-carousel/src/pagination/Pagination.js
@@ -1,5 +1,6 @@
 import React, { PureComponent } from 'react';
-import { I18nManager, Platform, View, ViewPropTypes } from 'react-native';
+import { I18nManager, Platform, View } from 'react-native';
+import { ViewPropTypes } from 'deprecated-react-native-prop-types';
 import PropTypes from 'prop-types';
 import PaginationDot from './PaginationDot';
 import styles from './Pagination.style';
@@ -14,16 +15,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.style,
         dotColor: PropTypes.string,
-        dotContainerStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,
+        dotContainerStyle: ViewPropTypes.style,
         dotElement: PropTypes.element,
-        dotStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,
+        dotStyle: ViewPropTypes.style,
         inactiveDotColor: PropTypes.string,
         inactiveDotElement: PropTypes.element,
         inactiveDotOpacity: PropTypes.number,
         inactiveDotScale: PropTypes.number,
-        inactiveDotStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,
+        inactiveDotStyle: ViewPropTypes.style,
         renderDots: PropTypes.func,
         tappableDots: PropTypes.bool,
         vertical: PropTypes.bool,
diff --git a/node_modules/react-native-snap-carousel/src/pagination/PaginationDot.js b/node_modules/react-native-snap-carousel/src/pagination/PaginationDot.js
index e59d196..f8cb833 100644
--- a/node_modules/react-native-snap-carousel/src/pagination/PaginationDot.js
+++ b/node_modules/react-native-snap-carousel/src/pagination/PaginationDot.js
@@ -1,5 +1,6 @@
 import React, { PureComponent } from 'react';
-import { View, Animated, Easing, TouchableOpacity, ViewPropTypes } from 'react-native';
+import { View, Animated, Easing, TouchableOpacity } from 'react-native';
+import { ViewPropTypes } from 'deprecated-react-native-prop-types';
 import PropTypes from 'prop-types';
 import styles from './Pagination.style';

@@ -12,11 +13,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.style.style,
         inactiveColor: PropTypes.string,
-        inactiveStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,
+        inactiveStyle: ViewPropTypes,
         index: PropTypes.number,
-        style: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,
+        style: ViewPropTypes.style,
         tappable: PropTypes.bool
     };

diff --git a/node_modules/react-native-snap-carousel/src/parallaximage/ParallaxImage.js b/node_modules/react-native-snap-carousel/src/parallaximage/ParallaxImage.js
index 8bc774a..5b0afc7 100644
--- a/node_modules/react-native-snap-carousel/src/parallaximage/ParallaxImage.js
+++ b/node_modules/react-native-snap-carousel/src/parallaximage/ParallaxImage.js
@@ -1,7 +1,8 @@
 // Parallax effect inspired by https://github.com/oblador/react-native-parallax/

 import React, { Component } from 'react';
-import { View, ViewPropTypes, Image, Animated, Easing, ActivityIndicator, findNodeHandle } from 'react-native';
+import { View, Image, Animated, Easing, ActivityIndicator, findNodeHandle } from 'react-native';
+import { ViewPropTypes } from 'deprecated-react-native-prop-types';
 import PropTypes from 'prop-types';
 import styles from './ParallaxImage.style';

@@ -16,7 +17,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.style,
         dimensions: PropTypes.shape({
             width: PropTypes.number,
             height: PropTypes.number

Thanks this works for me

SaifullahRazzaq commented 3 months ago

Thank you

On Wed, Jul 31, 2024, 11:33โ€ฏAM Akshay Kadam @.***> wrote:

the error

ERROR TypeError: Cannot read property 'style' of undefined, js engine: hermes

i know someone already post this, but for me i have to remove View.propTypes.style too

slideStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,

to this

slideStyle: ViewPropTypes.style,

Hi! ๐Ÿ‘‹

Firstly, thanks for your work on this project! ๐Ÿ™‚

Today I used patch-package https://github.com/ds300/patch-package to patch @.*** for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-snap-carousel/src/carousel/Carousel.js b/node_modules/react-native-snap-carousel/src/carousel/Carousel.js index dae71a3..5bc9f9d 100644--- a/node_modules/react-native-snap-carousel/src/carousel/Carousel.js+++ b/node_modules/react-native-snap-carousel/src/carousel/Carousel.js@@ -1,5 +1,6 @@ import React, { Component } from 'react';-import { Animated, Easing, FlatList, I18nManager, Platform, ScrollView, View, ViewPropTypes } from 'react-native';+import { Animated, Easing, FlatList, I18nManager, Platform, ScrollView, View } from 'react-native';+import { ViewPropTypes } from 'deprecated-react-native-prop-types'; import PropTypes from 'prop-types'; import shallowCompare from 'react-addons-shallow-compare'; import {@@ -43,8 +44,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.style,+ contentContainerCustomStyle: ViewPropTypes.style, enableMomentum: PropTypes.bool, enableSnap: PropTypes.bool, firstItem: PropTypes.number,@@ -61,7 +62,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.style, shouldOptimizeUpdates: PropTypes.bool, swipeThreshold: PropTypes.number, useScrollView: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),diff --git a/node_modules/react-native-snap-carousel/src/pagination/Pagination.js b/node_modules/react-native-snap-carousel/src/pagination/Pagination.js index 5c021cf..ef4cf5f 100644--- a/node_modules/react-native-snap-carousel/src/pagination/Pagination.js+++ b/node_modules/react-native-snap-carousel/src/pagination/Pagination.js@@ -1,5 +1,6 @@ import React, { PureComponent } from 'react';-import { I18nManager, Platform, View, ViewPropTypes } from 'react-native';+import { I18nManager, Platform, View } from 'react-native';+import { ViewPropTypes } from 'deprecated-react-native-prop-types'; import PropTypes from 'prop-types'; import PaginationDot from './PaginationDot'; import styles from './Pagination.style';@@ -14,16 +15,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.style, dotColor: PropTypes.string,- dotContainerStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,+ dotContainerStyle: ViewPropTypes.style, dotElement: PropTypes.element,- dotStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,+ dotStyle: ViewPropTypes.style, inactiveDotColor: PropTypes.string, inactiveDotElement: PropTypes.element, inactiveDotOpacity: PropTypes.number, inactiveDotScale: PropTypes.number,- inactiveDotStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,+ inactiveDotStyle: ViewPropTypes.style, renderDots: PropTypes.func, tappableDots: PropTypes.bool, vertical: PropTypes.bool,diff --git a/node_modules/react-native-snap-carousel/src/pagination/PaginationDot.js b/node_modules/react-native-snap-carousel/src/pagination/PaginationDot.js index e59d196..f8cb833 100644--- a/node_modules/react-native-snap-carousel/src/pagination/PaginationDot.js+++ b/node_modules/react-native-snap-carousel/src/pagination/PaginationDot.js@@ -1,5 +1,6 @@ import React, { PureComponent } from 'react';-import { View, Animated, Easing, TouchableOpacity, ViewPropTypes } from 'react-native';+import { View, Animated, Easing, TouchableOpacity } from 'react-native';+import { ViewPropTypes } from 'deprecated-react-native-prop-types'; import PropTypes from 'prop-types'; import styles from './Pagination.style'; @@ -12,11 +13,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.style.style, inactiveColor: PropTypes.string,- inactiveStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,+ inactiveStyle: ViewPropTypes, index: PropTypes.number,- style: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,+ style: ViewPropTypes.style, tappable: PropTypes.bool }; diff --git a/node_modules/react-native-snap-carousel/src/parallaximage/ParallaxImage.js b/node_modules/react-native-snap-carousel/src/parallaximage/ParallaxImage.js index 8bc774a..5b0afc7 100644--- a/node_modules/react-native-snap-carousel/src/parallaximage/ParallaxImage.js+++ b/node_modules/react-native-snap-carousel/src/parallaximage/ParallaxImage.js@@ -1,7 +1,8 @@ // Parallax effect inspired by https://github.com/oblador/react-native-parallax/

import React, { Component } from 'react';-import { View, ViewPropTypes, Image, Animated, Easing, ActivityIndicator, findNodeHandle } from 'react-native';+import { View, Image, Animated, Easing, ActivityIndicator, findNodeHandle } from 'react-native';+import { ViewPropTypes } from 'deprecated-react-native-prop-types'; import PropTypes from 'prop-types'; import styles from './ParallaxImage.style'; @@ -16,7 +17,7 @@ export default class ParallaxImage extends Component { sliderHeight: PropTypes.number, // passed from sliderWidth: PropTypes.number, // passed from vertical: PropTypes.bool, // passed from - containerStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,+ containerStyle: ViewPropTypes.style, dimensions: PropTypes.shape({ width: PropTypes.number, height: PropTypes.number

Thanks this works for me

โ€” Reply to this email directly, view it on GitHub https://github.com/meliorence/react-native-snap-carousel/issues/970#issuecomment-2259861860, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALNR4Z55YRZ52V35YJPTVMLZPCHLXAVCNFSM6AAAAAATMYC4DOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJZHA3DCOBWGA . You are receiving this because you commented.Message ID: @.***>

dh336699 commented 3 months ago

the error

ERROR  TypeError: Cannot read property 'style' of undefined, js engine: hermes

i know someone already post this, but for me i have to remove View.propTypes.style too

slideStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,

to this

slideStyle: ViewPropTypes.style,

Hi! ๐Ÿ‘‹

Firstly, thanks for your work on this project! ๐Ÿ™‚

Today I used patch-package to patch react-native-snap-carousel@3.9.1 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-snap-carousel/src/carousel/Carousel.js b/node_modules/react-native-snap-carousel/src/carousel/Carousel.js
index dae71a3..5bc9f9d 100644
--- a/node_modules/react-native-snap-carousel/src/carousel/Carousel.js
+++ b/node_modules/react-native-snap-carousel/src/carousel/Carousel.js
@@ -1,5 +1,6 @@
 import React, { Component } from 'react';
-import { Animated, Easing, FlatList, I18nManager, Platform, ScrollView, View, ViewPropTypes } from 'react-native';
+import { Animated, Easing, FlatList, I18nManager, Platform, ScrollView, View } from 'react-native';
+import { ViewPropTypes } from 'deprecated-react-native-prop-types';
 import PropTypes from 'prop-types';
 import shallowCompare from 'react-addons-shallow-compare';
 import {
@@ -43,8 +44,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.style,
+        contentContainerCustomStyle: ViewPropTypes.style,
         enableMomentum: PropTypes.bool,
         enableSnap: PropTypes.bool,
         firstItem: PropTypes.number,
@@ -61,7 +62,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.style,
         shouldOptimizeUpdates: PropTypes.bool,
         swipeThreshold: PropTypes.number,
         useScrollView: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
diff --git a/node_modules/react-native-snap-carousel/src/pagination/Pagination.js b/node_modules/react-native-snap-carousel/src/pagination/Pagination.js
index 5c021cf..ef4cf5f 100644
--- a/node_modules/react-native-snap-carousel/src/pagination/Pagination.js
+++ b/node_modules/react-native-snap-carousel/src/pagination/Pagination.js
@@ -1,5 +1,6 @@
 import React, { PureComponent } from 'react';
-import { I18nManager, Platform, View, ViewPropTypes } from 'react-native';
+import { I18nManager, Platform, View } from 'react-native';
+import { ViewPropTypes } from 'deprecated-react-native-prop-types';
 import PropTypes from 'prop-types';
 import PaginationDot from './PaginationDot';
 import styles from './Pagination.style';
@@ -14,16 +15,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.style,
         dotColor: PropTypes.string,
-        dotContainerStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,
+        dotContainerStyle: ViewPropTypes.style,
         dotElement: PropTypes.element,
-        dotStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,
+        dotStyle: ViewPropTypes.style,
         inactiveDotColor: PropTypes.string,
         inactiveDotElement: PropTypes.element,
         inactiveDotOpacity: PropTypes.number,
         inactiveDotScale: PropTypes.number,
-        inactiveDotStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,
+        inactiveDotStyle: ViewPropTypes.style,
         renderDots: PropTypes.func,
         tappableDots: PropTypes.bool,
         vertical: PropTypes.bool,
diff --git a/node_modules/react-native-snap-carousel/src/pagination/PaginationDot.js b/node_modules/react-native-snap-carousel/src/pagination/PaginationDot.js
index e59d196..f8cb833 100644
--- a/node_modules/react-native-snap-carousel/src/pagination/PaginationDot.js
+++ b/node_modules/react-native-snap-carousel/src/pagination/PaginationDot.js
@@ -1,5 +1,6 @@
 import React, { PureComponent } from 'react';
-import { View, Animated, Easing, TouchableOpacity, ViewPropTypes } from 'react-native';
+import { View, Animated, Easing, TouchableOpacity } from 'react-native';
+import { ViewPropTypes } from 'deprecated-react-native-prop-types';
 import PropTypes from 'prop-types';
 import styles from './Pagination.style';

@@ -12,11 +13,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.style.style,
         inactiveColor: PropTypes.string,
-        inactiveStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,
+        inactiveStyle: ViewPropTypes,
         index: PropTypes.number,
-        style: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,
+        style: ViewPropTypes.style,
         tappable: PropTypes.bool
     };

diff --git a/node_modules/react-native-snap-carousel/src/parallaximage/ParallaxImage.js b/node_modules/react-native-snap-carousel/src/parallaximage/ParallaxImage.js
index 8bc774a..5b0afc7 100644
--- a/node_modules/react-native-snap-carousel/src/parallaximage/ParallaxImage.js
+++ b/node_modules/react-native-snap-carousel/src/parallaximage/ParallaxImage.js
@@ -1,7 +1,8 @@
 // Parallax effect inspired by https://github.com/oblador/react-native-parallax/

 import React, { Component } from 'react';
-import { View, ViewPropTypes, Image, Animated, Easing, ActivityIndicator, findNodeHandle } from 'react-native';
+import { View, Image, Animated, Easing, ActivityIndicator, findNodeHandle } from 'react-native';
+import { ViewPropTypes } from 'deprecated-react-native-prop-types';
 import PropTypes from 'prop-types';
 import styles from './ParallaxImage.style';

@@ -16,7 +17,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.style,
         dimensions: PropTypes.shape({
             width: PropTypes.number,
             height: PropTypes.number

Thanks๏ผŒ It's work for me

Surajtalole commented 2 months ago

still same error occurs

SaifullahRazzaq commented 2 months ago

Use option ? Sign like this viewprops?.styles in all fille

On Sat, Aug 24, 2024, 7:05โ€ฏPM Suraj Talole @.***> wrote:

still same error occurs

โ€” Reply to this email directly, view it on GitHub https://github.com/meliorence/react-native-snap-carousel/issues/970#issuecomment-2308424275, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALNR4Z62CPC7CAA7DWWFOHTZTCOLXAVCNFSM6AAAAAATMYC4DOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBYGQZDIMRXGU . You are receiving this because you commented.Message ID: @.***>

Surajtalole commented 2 months ago

can you provide the complete code

SaifullahRazzaq commented 2 months ago

Nope because there is no access only allowed in office

On Sat, Aug 24, 2024, 8:20โ€ฏPM Suraj Talole @.***> wrote:

can you provide the complete code

โ€” Reply to this email directly, view it on GitHub https://github.com/meliorence/react-native-snap-carousel/issues/970#issuecomment-2308445711, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALNR4Z4QT2PRQSHTLUQMTTLZTCXD7AVCNFSM6AAAAAATMYC4DOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBYGQ2DKNZRGE . You are receiving this because you commented.Message ID: @.***>

Erenner commented 2 weeks ago

Same Error,

SaifullahRazzaq commented 2 weeks ago

View.propTypes?.style please use this in every carousel see simulator for file path

On Fri, Oct 18, 2024, 7:05โ€ฏPM Erenner @.***> wrote:

Same Error,

โ€” Reply to this email directly, view it on GitHub https://github.com/meliorence/react-native-snap-carousel/issues/970#issuecomment-2422688234, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALNR4Z4SS5EJX3HLFHMGEGTZ4EPVJAVCNFSM6AAAAAATMYC4DOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMRSGY4DQMRTGQ . You are receiving this because you commented.Message ID: @.***>

Profsain commented 1 week ago

Thank you guys for your comments. I have written a blog post related to the above issues. If you are not clear on what to do after reading the above comments. Kindly check this out: https://profsain.hashnode.dev/keeping-your-react-native-code-up-to-date-managing-deprecated-proptypes-and-fixing-common-errors โ˜บHappy coding!