File tree 4 files changed +30
-3
lines changed
4 files changed +30
-3
lines changed Original file line number Diff line number Diff line change 1
1
/* eslint-disable no-console */
2
2
import {
3
3
EventData ,
4
+ ItemEventData ,
5
+ ListView ,
4
6
Observable ,
5
7
ObservableArray ,
6
8
Page ,
@@ -28,4 +30,23 @@ export function onStar(e: EventData) {
28
30
29
31
export function onDelete ( e : EventData ) {
30
32
console . log ( "DELETE" , ( e . object as ViewBase ) . bindingContext ) ;
33
+ }
34
+
35
+ export function onItemTap ( e : ItemEventData ) {
36
+ console . log ( e . index ) ;
37
+ }
38
+
39
+
40
+ export function nullifyTableViewSeparatorInsets ( args : ItemEventData ) {
41
+ if ( global . isIOS ) {
42
+ args . ios . separatorInset = UIEdgeInsetsZero ;
43
+ args . ios . layoutMargins = UIEdgeInsetsZero ;
44
+ args . ios . preservesSuperviewLayoutMargins = false ;
45
+ }
46
+ }
47
+
48
+ export function nullifyEmptyCells ( e : EventData ) {
49
+ if ( global . isIOS ) {
50
+ ( ( e . object as ListView ) . ios as UITableView ) . tableFooterView = UIView . alloc ( ) . initWithFrame ( CGRectZero ) ;
51
+ }
31
52
}
Original file line number Diff line number Diff line change 1
1
<Page xmlns =" http://schemas.nativescript.org/tns.xsd" xmlns : sv =" nativescript-swipe-view" navigatingTo =" navigatingTo" >
2
2
<ActionBar title =" Swipe View" icon =" " />
3
3
4
- <ListView items =" {{ items }}" >
4
+ <ListView
5
+ items =" {{ items }}"
6
+ loaded =" nullifyEmptyCells"
7
+ itemLoading =" nullifyTableViewSeparatorInsets"
8
+ itemTap =" onItemTap" >
5
9
<ListView .itemTemplate>
6
10
<sv : SwipeView >
7
11
<sv : SwipeView .leftActionsTemplate>
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " nativescript-swipe-view" ,
3
- "version" : " 1.1 .0" ,
3
+ "version" : " 1.2 .0" ,
4
4
"description" : " NativeScript plugin to connect with Azure Notification Hubs" ,
5
5
"main" : " dist/swipe-view" ,
6
6
"typings" : " swipe-view.d.ts" ,
Original file line number Diff line number Diff line change @@ -99,8 +99,10 @@ export class SwipeView extends GridLayout implements definition.SwipeView {
99
99
this . _resetTransition ( ) ;
100
100
}
101
101
} ) ;
102
+ this . parent ?. on ( "itemTap" , this . _resetTransition . bind ( this ) ) ;
103
+
102
104
this . on ( "pan" , this . _onPan . bind ( this ) ) ;
103
- this . on ( "tap" , this . _resetTransition . bind ( this ) ) ;
105
+ this . _swipeView . on ( "tap" , this . _resetTransition . bind ( this ) ) ;
104
106
}
105
107
106
108
public onUnloaded ( ) : void {
You can’t perform that action at this time.
0 commit comments