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

Android 3.3.0 版本自定义高度计算为 0,2.x 版本都没有问题,切换为 3.3.0 版本后按照文档升级,自定义控件高度始终为 0 #3942

Closed
ShaXiaQAQ opened this issue Jul 4, 2024 · 2 comments
Assignees
Labels
stale: closed Closed due to stale stale: 30d No interaction in the last 30 days

Comments

@ShaXiaQAQ
Copy link

ShaXiaQAQ commented Jul 4, 2024

Describe the bug
升级 3.0 后,自定义控件高度一直为 0,在 createRenderNode 的时候打印前端传过来的 Props 里面高度是有的,Debug 发现在NativeRenderProvider中的以下方法中,解析出来的 list 高度直接为 0,导致后面步骤获取出来的值也是 0:

@CalledByNative
public void callUIFunction(int rootId, int nodeId, long callbackId, String functionName, byte[] buffer) {
NativeRenderDelegate renderDelegate = (NativeRenderDelegate)this.mRenderDelegateRef.get();
if (renderDelegate != null) {
try {
List list = this.bytesToArgument(ByteBuffer.wrap(buffer));
renderDelegate.callUIFunction(rootId, nodeId, callbackId, functionName, list);
} catch (NativeRenderException var9) {
renderDelegate.handleRenderException(var9);
}
}

}

To Reproduce
Steps to reproduce the behavior:

  1. 自定义一个控件,继承 CardView 或者别的 VIew;

  2. 在自定义控件中使用和官方 Pager 同样实现计算和布局:
    private val measureAndLayout = Runnable {
    if (readyToLayout()) {
    measure(
    MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY),
    MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY)
    )
    LogUtil.d("hippy:::measureAndLayout:::$width:::$height:::$left:::$top:::$right:::$bottom")
    layout(left, top, right, bottom)
    }
    }
    override fun requestLayout() {
    super.requestLayout()
    triggerRequestLayout()
    }
    fun bindData(data: List? = null) {
    setdata(data)
    triggerRequestLayout()
    }

  3. 最终控件宽度正常,为vue 前端设置的值,高度为 0;

  4. Go to '...'

  5. Click on '....'

  6. Scroll down to '....'

  7. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS and version: [e.g. iOS 13.3.1]
  • Hippy native SDK version: [e.g. 2.0.0]
  • Front-end SDK and version [e.g. @hippy/vue 2.0.1]

Additional context
Add any other context about the problem here.

Copy link

hippy-service bot commented Sep 2, 2024

Pay attention 🛎️ !!
There has been no activity on this issue for 2 months, so I will label it stalled.
It will be automatically closed in 60 days if no more activity. Feel free to leave a comment if you have any questions.

@hippy-service hippy-service bot added the stale: 30d No interaction in the last 30 days label Sep 2, 2024
Copy link

hippy-service bot commented Oct 3, 2024

Sorry, closing this issue because it has stalled for over 3 months.
Feel free to reopen if this issue is still relevant, or to ping the collaborator if you have any questions.

@hippy-service hippy-service bot added the stale: closed Closed due to stale label Oct 3, 2024
@hippy-service hippy-service bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale: closed Closed due to stale stale: 30d No interaction in the last 30 days
Projects
None yet
Development

No branches or pull requests

2 participants