It's December 2020 and people still get trouble to remove the highlight effect on ListView
and LineSeparator
causing by it.
I'm working with Angular
+ Nativescript
.
This is the iOS
workaround to remove tap highlight is this and it works:
onItemLoading(args: ItemEventData) {
if (isIOS) {
var cell = args.ios;
cell.selectionStyle = UITableViewCellSelectionStyle.UITableViewCellSelectionStyleNone;
}
}
Android question: How to do this with Android?
Android & iOS question: How to remove the SeparatorLine
color from ListView
?
This is my tns-info
:
Getting NativeScript components versions information...
⚠ Update available for component nativescript. Your current version is 6.8.0 and the latest available version is 7.0.12.
✔ Component tns-core-modules has 6.6.0-next-2020-05-08-112112-01 version and is up to date.
✔ Component tns-android has 6.5.3 version and is up to date.
⚠ Update available for component tns-ios. Your current version is 6.5.2 and the latest available version is 6.5.3.
Many thanks all.
For removing the highlight/ripple on android, you can hook into the loaded
event of the Listview
and set some android properties like so:
<ListView (loaded)="onLoaded($event)"></ListView>
declare const android;
onLoaded(event) {
if (event.object.android) {
event.object.android.setSelector(new android.graphics.drawable.StateListDrawable());
}
}
For the separator color, you should be able to use the separatorColor
property either directly in the html or through css:
<ListView separatorColor="transparent"></ListView>
ListView {
separator-color: transparent;
}