A simple carousel component for NativeScript.
Platform | Supported | Version | NativeView |
---|---|---|---|
iOS | Yes | iOS 8.1+ | DKCarouselView |
Android | Yes | API 15+ | ViewPager with PageIndicatorView |
NativeScript 7+:
ns plugin add nativescript-carousel
NativeScript less than NS7:
tns plugin add nativescript-carousel@6.1.1
Check out the demos included in this repo for instructions on how to use the Carousel with your choice of framework:
itemTemplate
)Assign a data-array to generate the slides and apply the bindingContext. If items
is populated then you must use the template-option.
items
)Defines the view template for each slide-view to be generated.
Sets/Gets the active page by index
Shows or hides the page-indicator
Sets the active indicator color. Default is semi-transparent white. Use hex or color-name.
Sets the color of unselected indicators
By default the indicator is centered at the bottom. You can use points (x,y) to move the indicator. E.g. indicatorOffset="100,100"
If true last slide will wrap back to first and visa versa
If set to 'true' scrolling will bounce at the first/last page (non-infinite). Default is 'false'.
Defines the interval in seconds to wait before the next slide is shown. Default is 0 (off).
Enables/Disables user scroll on the Carousel.
Returns the DKCarouselView
object.
Returns the ViewPager
object.
Sets the pager-indicator animation type. Choose between: color
, slide
, scale
, worm
, thin_worm
, fill
, drop
or none
. Default is none
.
Sets the pager-indicator animation duration in milliseconds. Default is 500.
Sets the pager-indicator alignment. Choose between top
or bottom
. Default is bottom
.
Sets the pager-indicator dot radius.
Sets the pager-indicator dot padding.
Set the indicator count which will change the underlying Android data adapter. See issue #5 discussion
iOS | Android |
---|---|
NONE | COLOR | SCALE | SLIDE |
---|---|---|---|
WORM | THIN_WORM | FILL | DROP | SWAP |
---|---|---|---|---|
7.0.1
@NativeClass()
decorator.7.0.0
6.1.0
6.0.0
4.2.5
PagerAdapter changed the adapter's contents without calling PagerAdapter#notifyDataSetChanged!
error on Android.refresh()
function. Safer to call on demand.4.2.1
4.2.0
4.1.0
pageIndicatorCount
for Android to enable dynamically changing the length of the carousel items array without Android throwing a crash about the adapster set changing incorrectly.4.0.2
4.0.0
3.1.1
notifyDataSetChanged
issue. Thanks @OPADA-Eng3.1.0
3.0.2
3.0.1
refresh
when navigating back to a view with a Carousel.3.0.0
indicatorOffset
, thanks @sitefinitysteve.nativescript-orientation
plugin in order to trigger UI-refresh.2.4.2
bounce
property to the plugin and the Pod. Thanks to @sitefinitysteve.2.4.1
Items
binding, would not refresh Carousel-view.2.4.0
ViewPager.populate
exception on Android.2.3.1
Trying to link invalid 'this' to a Java object
). Thanks @peterstaev.swap
!2.3.0
indicatorColorUnselected
. Allows you to set color to the unselected dots.2.2.0
refresh
function that could cause a crash or removal of slides (Android).drop
, scale
and thin_worm
.2.1.2
2.1.1
2.1.0
1.1.0
1.0.0
I will accept pull requests that improve this and assign credit.
cd src && npm run setup
npm run demo.android
for android developmentnpm run demo.ios
for iOS developmentnpm run demo-ng.ios
for iOS Angular appnpm run demo-ng.android
for Android Angularnpm run demo-vue.ios
for iOS Vue appnpm run demo-vue.android
for Android Vue原理:主要运用z-index这个属性来设置图片的展示和隐藏,代码如下: 1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>zIndex制作轮播图</title> 6 <style> 7 html,body,ul,li,input{mar
本指南汇集React-Native各类学习资源,给大家提供便利。指南正在不断的更新,大家有好的资源欢迎Pull Requests! 同时还有Awesome React-Native系列 https://github.com/jondot/awesome-react-native 教程 React Native React-Native入门指南 https://github.com/vczer
本指南汇集React-Native各类学习资源,给大家提供便利。指南正在不断的更新,大家有好的资源欢迎Pull Requests! 同时还有Awesome React-Native系列 https://github.com/jondot/awesome-react-native 目录 教程 React Native React.js ES6 系列教程 开源APP 组件 工具 资源网站 业界讨论 教
本指南汇集React-Native各类学习资源,给大家提供便利。指南正在不断的更新,大家有好的资源欢迎Pull Requests! 原文地址:https://github.com/ele828/react-native-guide 同时还有Awesome React-Native系列 https://github.com/jondot/awesome-react-native 教程 React-N
NativeScript 可以使用 Javascript,CSS, XML 创建真正的 Native 跨平台应用,支持 iOS Android,NativeScript 将您的跨平台代码翻译成目标平台的代码。 UI 使用 XML 描述,CSS 样式,在编译时将 UI 转化成本地原生代码,最终得到正在的 Native 原生应用。 Telerik 公开了用于创建安卓、iOS和Windows Unive
NativeScript Command-Line Interface The NativeScript CLI lets you create, build, and deploy NativeScript-based apps on iOS and Android devices. Get it using: npm install -g nativescript What is Native
NativeScript-Snackbar �� �� �� NativeScript plugin for Material Design SnackBar component. Installation: NativeScript 7+:tns plugin add @nstudio/nativescript-snackbar NativeScript version prior to 7:t
Nativescript-Ripple This plugin aims to bring a native (or close to native) ripple implementation on Android and iOS. The android version uses a RippleDrawable and conserves the previous background, a
NativeScript-FloatingActionButton NativeScript plugin for Material Design Floating Action Button UI component. Installation Nativescript 7+: ns plugin add @nstudio/nativescript-floatingactionbutton Na
NativeScript CardView A NativeScript plugin to provide an XML widget to implement the Material Design CardView component. Installation NativeScript 7+: ns plugin add @nstudio/nativescript-cardview Nat