Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.0.0-beta.13] ion-virtual-scroll: does not handle css class correctly #16050

Closed
cjorasch opened this issue Oct 23, 2018 · 2 comments · Fixed by #16729
Closed

[4.0.0-beta.13] ion-virtual-scroll: does not handle css class correctly #16050

cjorasch opened this issue Oct 23, 2018 · 2 comments · Fixed by #16729
Labels
needs: reply the issue needs a response from the user

Comments

@cjorasch
Copy link

Bug Report

Ionic Info

4.0.0-beta.13

Describe the Bug
If you use <ion-virtual-scroll> and assign a css class to an item then the logic to append additional classes does not include a delimiter.

The following code is used in the ionic component:

// From: virtual-scroll.tsx
const VirtualProxy: FunctionalComponent<{dom: VirtualNode[]}> = ({ dom }, children, utils) => {
  return utils.map(children, (child, i) => {
    const node = dom[i];
    const vattrs = child.vattrs || {};
    let classes = vattrs.class || '';
    // *** ADDS CLASS WITHOUT DELIMITER ***
    classes += 'virtual-item ';
    if (!node.visible) {
      classes += 'virtual-loading';
    }
    return {
      ...child,
      vattrs: {
        ...vattrs,
        class: classes,
        style: {
          ...vattrs.style,
          transform: `translate3d(0,${node.top}px,0)`
        }
      }
    };
  });
};

If an item is rendered with a class then the class names are incorrect.

For example <div class="my-class"> renders as <div class="my-classvirtual-item">. It should be <div class="my-class virtual-item">

A fix would be the following changes:

    classes += ' virtual-item'; // *** SPACE ADDED BEFORE, REMOVED AFTER ***
    if (!node.visible) {
      classes += ' virtual-loading'; // *** SPACE ADDED BEFORE ***
    }
@ionitron-bot ionitron-bot bot added the triage label Oct 23, 2018
@paulstelzer
Copy link
Contributor

Thanks for your issue! Could you please check if this is still an issue in beta.17? That would be very nice :)

@paulstelzer paulstelzer added needs: reply the issue needs a response from the user and removed triage labels Dec 7, 2018
manucorporat added a commit that referenced this issue Dec 13, 2018
fixes #16725
fixes #16432
fixes #16023
fixes #14591
fixes #16050
fixes #15587
pull bot pushed a commit to stackriot/ionic that referenced this issue Dec 13, 2018
@ionitron-bot
Copy link

ionitron-bot bot commented Jan 12, 2019

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Jan 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: reply the issue needs a response from the user
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants