Skip to content
This repository was archived by the owner on Dec 21, 2022. It is now read-only.

Commit 901175e

Browse files
Merge pull request #1660 from mendix/NC-773-issue-with-carousel-widget
[NC-773]: fix snapping issue in carousel native widget
2 parents a3a34fb + bc0d61f commit 901175e

File tree

5 files changed

+20
-39
lines changed

5 files changed

+20
-39
lines changed

package-lock.json

Lines changed: 10 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/pluggableWidgets/carousel-native/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## [Unreleased]
88

9+
### Fixed
10+
11+
- Improved the snapping behavior on Android.
12+
913
## [2.2.2] - 2022-9-20
1014

1115
### Fixed

packages/pluggableWidgets/carousel-native/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "carousel-native",
33
"widgetName": "Carousel",
4-
"version": "2.2.2",
4+
"version": "2.2.3",
55
"license": "Apache-2.0",
66
"repository": {
77
"type": "git",
@@ -27,7 +27,7 @@
2727
"dependencies": {
2828
"@mendix/piw-native-utils-internal": "^1.0.0",
2929
"@mendix/piw-utils-internal": "^1.0.0",
30-
"react-native-snap-carousel": "^3.8.4"
30+
"react-native-snap-carousel": "^3.9.1"
3131
},
3232
"devDependencies": {
3333
"@mendix/pluggable-widgets-tools": ">=8.9.2",

packages/pluggableWidgets/carousel-native/src/Carousel.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { createElement, Fragment, ReactElement, useCallback, useEffect, useState } from "react";
2-
import { ActivityIndicator, LayoutChangeEvent, Text, View } from "react-native";
2+
import { ActivityIndicator, LayoutChangeEvent, Platform, Text, View } from "react-native";
33
import { CarouselProps } from "../typings/CarouselProps";
44
import { CarouselStyle, defaultCarouselStyle, LayoutStyle } from "./ui/styles";
55
import { default as NativeCarousel, Pagination } from "react-native-snap-carousel";
@@ -162,6 +162,8 @@ export const Carousel = (props: CarouselProps<CarouselStyle>): ReactElement => {
162162
inactiveSlideOpacity={layoutSpecificStyle.inactiveSlideItem?.opacity}
163163
onSnapToItem={onSnap}
164164
ref={(r: any) => setCarouselRef(r)}
165+
enableMomentum={Platform.OS === "android"}
166+
decelerationRate={0.9}
165167
/>
166168
{renderPagination()}
167169
</Fragment>

packages/pluggableWidgets/carousel-native/src/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<package xmlns="http://www.mendix.com/package/1.0/">
3-
<clientModule name="Carousel" version="2.2.2" xmlns="http://www.mendix.com/clientModule/1.0/">
3+
<clientModule name="Carousel" version="2.2.3" xmlns="http://www.mendix.com/clientModule/1.0/">
44
<widgetFiles>
55
<widgetFile path="Carousel.xml" />
66
</widgetFiles>

0 commit comments

Comments
 (0)