openkraken / kraken

A web standards-compliant, high-performance rendering engine based on Flutter.
https://openkraken.com
Apache License 2.0
4.93k stars 304 forks source link

DevTools 无法定位元素调试样式问题 #300

Open JuneScut opened 3 years ago

JuneScut commented 3 years ago

使用的 Kraken 版本 | What version of kraken are you using

^0.7.2

重现步骤 | Steps To Reproduce

kraken: image h5: image

如图,我创建了一个长列表,每一行都是一个独立的元素,样式和 h5 不一致,但是 devtool 只能选中最外层的元素,无法选中子元素查看

重现代码 | Code example:

预期结果 | Expected results:

实际结果 | Actual results:

wssgcg1213 commented 3 years ago

@JuneScut 可以提供一下代码片段, 我尝试本地复现下

JuneScut commented 3 years ago
function ScrollerSliver() {
  const arr = Array.from({ length: 500 }, (item, index) => index + 1);

  function genChildItem(rowIndex: number, comlumnIndex: number) {
    return (
      <div key={rowIndex + '-' + comlumnIndex} style={{ background: '#00da00', padding: 5 }}>
        {rowIndex}
      </div>
    );
  }

  function genRowItem(index: number) {
    const innerArr = Array.from({ length: 5 }, (item, index) => index + 1);
    return (
      <div
        key={index}
        style={{ background: '#61dafb', margin: 5, padding: 5, display: 'flex', justifyContent: 'space-around' }}
      >
        {innerArr.map((columnIndex) => genChildItem(index, columnIndex))}
      </div>
    );
  }

  const sliverCss = {
    display: 'sliver',
    sliverDirection: 'column',
    width: '100%',
    height: 800,
  };
  return <div style={sliverCss as CSSProperties}>{arr.map((i) => genRowItem(i))}</div>;
}

react 工程项目