@momo-kits/carousel 0.0.18 → 0.0.23-beta-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Carousel.js +5 -15
- package/CarouselV2.js +1343 -0
- package/index.js +2 -1
- package/package.json +1 -1
- package/utils/animationsV2.js +381 -0
package/Carousel.js
CHANGED
|
@@ -18,16 +18,6 @@ import {
|
|
|
18
18
|
} from './utils/animation';
|
|
19
19
|
|
|
20
20
|
const IS_IOS = Platform.OS === 'ios';
|
|
21
|
-
|
|
22
|
-
// Native driver for scroll events
|
|
23
|
-
// See: https://facebook.github.io/react-native/blog/2017/02/14/using-native-driver-for-animated.html
|
|
24
|
-
const AnimatedFlatList = FlatList ? Animated.createAnimatedComponent(FlatList) : null;
|
|
25
|
-
const AnimatedScrollView = Animated.createAnimatedComponent(ScrollView);
|
|
26
|
-
|
|
27
|
-
// React Native automatically handles RTL layouts; unfortunately, it's buggy with horizontal ScrollView
|
|
28
|
-
// See https://github.com/facebook/react-native/issues/11960
|
|
29
|
-
// NOTE: the following variable is not declared in the constructor
|
|
30
|
-
// otherwise it is undefined at init, which messes with custom indexes
|
|
31
21
|
const IS_RTL = I18nManager.isRTL;
|
|
32
22
|
|
|
33
23
|
export default class Carousel extends PureComponent {
|
|
@@ -252,7 +242,7 @@ export default class Carousel extends PureComponent {
|
|
|
252
242
|
|
|
253
243
|
_needsScrollView () {
|
|
254
244
|
const { useScrollView } = this.props;
|
|
255
|
-
return useScrollView || !
|
|
245
|
+
return useScrollView || !Animated.FlatList || this._shouldUseStackLayout() || this._shouldUseTinderLayout();
|
|
256
246
|
}
|
|
257
247
|
|
|
258
248
|
_needsRTLAdaptations () {
|
|
@@ -1206,7 +1196,7 @@ export default class Carousel extends PureComponent {
|
|
|
1206
1196
|
scrollsToTop: false,
|
|
1207
1197
|
removeClippedSubviews: !this._needsScrollView(),
|
|
1208
1198
|
inverted: this._needsRTLAdaptations(),
|
|
1209
|
-
|
|
1199
|
+
renderToHardwareTextureAndroid: true,
|
|
1210
1200
|
...specificProps
|
|
1211
1201
|
};
|
|
1212
1202
|
}
|
|
@@ -1283,7 +1273,7 @@ export default class Carousel extends PureComponent {
|
|
|
1283
1273
|
...this._getComponentStaticProps()
|
|
1284
1274
|
};
|
|
1285
1275
|
|
|
1286
|
-
const ScrollViewComponent = typeof useScrollView === 'function' ? useScrollView :
|
|
1276
|
+
const ScrollViewComponent = typeof useScrollView === 'function' ? useScrollView : Animated.ScrollView
|
|
1287
1277
|
|
|
1288
1278
|
return this._needsScrollView() ? (
|
|
1289
1279
|
<ScrollViewComponent {...props}>
|
|
@@ -1294,7 +1284,7 @@ export default class Carousel extends PureComponent {
|
|
|
1294
1284
|
}
|
|
1295
1285
|
</ScrollViewComponent>
|
|
1296
1286
|
) : (
|
|
1297
|
-
<
|
|
1287
|
+
<Animated.FlatList {...props} />
|
|
1298
1288
|
);
|
|
1299
1289
|
}
|
|
1300
1290
|
}
|
|
@@ -1372,7 +1362,7 @@ Carousel.defaultProps = {
|
|
|
1372
1362
|
slideStyle: {},
|
|
1373
1363
|
shouldOptimizeUpdates: true,
|
|
1374
1364
|
swipeThreshold: 20,
|
|
1375
|
-
useScrollView: !
|
|
1365
|
+
useScrollView: !Animated.FlatList,
|
|
1376
1366
|
vertical: false,
|
|
1377
1367
|
showsPagination: true,
|
|
1378
1368
|
isCustomScrollWidth: false,
|