UNPKG

react-native-reanimated-carousel

Version:

Simple carousel component.fully implemented using Reanimated 2.Infinitely scrolling, very smooth.

2 lines 2.57 kB
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.Custom=void 0;var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _PaginationItem=require("./PaginationItem");var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/components/Pagination/Custom/index.tsx";var Custom=function Custom(props){var _dotStyle$width,_activeDotStyle$width,_dotStyle$height,_activeDotStyle$heigh;var activeDotStyle=props.activeDotStyle,dotStyle=props.dotStyle,progress=props.progress,_props$horizontal=props.horizontal,horizontal=_props$horizontal===void 0?true:_props$horizontal,data=props.data,size=props.size,containerStyle=props.containerStyle,renderItem=props.renderItem,_onPress=props.onPress,customReanimatedStyle=props.customReanimatedStyle,carouselName=props.carouselName;if(typeof size==="string"||typeof(dotStyle==null?void 0:dotStyle.width)==="string"||typeof(dotStyle==null?void 0:dotStyle.height)==="string"||typeof(activeDotStyle==null?void 0:activeDotStyle.width)==="string"||typeof(activeDotStyle==null?void 0:activeDotStyle.height)==="string")throw new Error("size/width/height must be a number");var maxItemWidth=Math.max(size!=null?size:0,(_dotStyle$width=dotStyle==null?void 0:dotStyle.width)!=null?_dotStyle$width:0,(_activeDotStyle$width=activeDotStyle==null?void 0:activeDotStyle.width)!=null?_activeDotStyle$width:0);var maxItemHeight=Math.max(size!=null?size:0,(_dotStyle$height=dotStyle==null?void 0:dotStyle.height)!=null?_dotStyle$height:0,(_activeDotStyle$heigh=activeDotStyle==null?void 0:activeDotStyle.height)!=null?_activeDotStyle$heigh:0);return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[{justifyContent:"space-between",alignSelf:"center",minWidth:maxItemWidth,minHeight:maxItemHeight},horizontal?{flexDirection:"row"}:{flexDirection:"column"},containerStyle],children:data.map(function(item,index){return(0,_jsxRuntime.jsx)(_PaginationItem.PaginationItem,{index:index,size:size,count:data.length,dotStyle:dotStyle,animValue:progress,horizontal:!horizontal,activeDotStyle:activeDotStyle,customReanimatedStyle:customReanimatedStyle,onPress:function onPress(){return _onPress==null?void 0:_onPress(index);},accessibilityLabel:`Slide ${index+1} of ${data.length} - ${carouselName}`,children:renderItem==null?void 0:renderItem(item,index)},index);})});};exports.Custom=Custom; //# sourceMappingURL=index.js.map