nstudio / nativescript-cardview

:diamonds: :clubs: NativeScript widget for Material Design CardView
MIT License
282 stars 51 forks source link

In listview cell selection problem #59

Closed oncul closed 7 years ago

oncul commented 7 years ago

Hello, cardview in listview. when i press the item, cardview background, radius and shadow disappering. Do you have a solution for this?

bradmartin commented 7 years ago

Not at the moment, could you please provide a video or .gif showing this in effect? Also providing your markup for the listview and any css that applies to this as well so I can try a demo of it later and see if I can find a solution. here is a free tool for recording .gifs that are great to drop on github issues. That would help to see what you're seeing 😄 and a fix is definitely possible.

Also is this on iOS? If so, I might have an idea what's happening. Thanks.

oncul commented 7 years ago

Yes, it happened on ios. i will send a screenrecord about the problem.

oncul commented 7 years ago

untitled

bradmartin commented 7 years ago

Yep. You need to adjust the iOS listview. I'm not near comp now or I'd paste snippet but basically that's the iOS listview selection over taking the cell. I'm not certain but I'm sure the card can be on top of the cell always even during selection but not my area (iOS) so I'll look around later. However for now you prob can adjust the selection coloring event on iOS. I'll provide code for it later.

On Sat, Jun 24, 2017, 11:40 AM Cagatay Oncul notifications@github.com wrote:

[image: untitled] https://user-images.githubusercontent.com/370796/27510221-e75c9a20-5914-11e7-83ba-48f3ea086f47.gif

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/bradmartin/nativescript-cardview/issues/59#issuecomment-310849491, or mute the thread https://github.com/notifications/unsubscribe-auth/AFulhD1Pdmar8-_ME4GPOzw5Wjyj_000ks5sHTvmgaJpZM4ODWbE .

bradmartin commented 7 years ago

@manijak @NathanWalker - is there something on iOS to make the card view not do this on the listview selection?

bradmartin commented 7 years ago

@cagatayoncul snippet below should disable the iOS list selection that you see currently. I'm not well versed with iOS behavior/design so I can't answer if this is best long term but it should prevent the card from disappearing on selection. This is on the ListView's itemLoading event.

    /**
     * onItemLoading event for the listview items
     */
    public onItemLoading(args: ItemEventData) {
        /// just disabling the iOS item selection highlighting
        if (isIOS) {
            const cell = args.ios
            if (cell) {
                cell.selectionStyle = UITableViewCellSelectionStyleNone
            }
        }
    }
oncul commented 7 years ago

Thank you, if i found a better solution, i will post ;)

manijak commented 7 years ago

Yeah it should work, I use it the same way.

exports.listViewItemLoading = function(args) {
    if (frameModule.topmost().ios) {
        var cell = args.ios;
        cell.selectionStyle = UITableViewCellSelectionStyle.UITableViewCellSelectionStyleNone;
        cell.backgroundColor = new colorModule.Color("transparent").ios;
    }
}