-
Notifications
You must be signed in to change notification settings - Fork 389
pref(rn): 优化全尺寸 linear-gradient 背景渲染时机 #2521
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
Open
dos1in
wants to merge
5
commits into
didi:master
Choose a base branch
from
dos1in:pref/rn-gradient-image
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+4
−2
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0c51a4d
pref(rn): 优化全尺寸 linear-gradient 背景渲染
dos1in f8115ae
Merge branch 'master' into pref/rn-gradient-image
hiyuki 211859c
Merge branch 'master' into pref/rn-gradient-image
dos1in 6f934a2
Merge branch 'master' into pref/rn-gradient-image
dos1in d50459f
Merge branch 'master' into pref/rn-gradient-image
dos1in File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
&& (!layoutWidth || !layoutHeight) 最后这个条件不需要了吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
需要的,没拿到容器宽高时可以直接让 100% 100% 的渐变铺满父容器;但拿到宽高后要用它重新计算位置或角度,不能一律走铺满逻辑。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
那不是还会闪么?如果重新计算后渲染效果不一致的话
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果依赖layout计算角度或者位置的话本身isNeedLayout会返回为true,背景图只有在layout后才会展示,你当前这个改动生效的核心条件就是扩宽了isNeedLayout的判定条件,让没有角度且高宽为100%的情况isNeedLayout返回false,让首次渲染不等待layout,如果命中其他条件让isNeedLayout返回false的话你当前这个改动逻辑是不会被命中的
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
而且对于size来说用absolute铺满还是设置高宽100%结果是一样的吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我理解是会闪,但保留它主要是为了把这个“铺满父容器”的特殊处理只用在首次还没拿到 layout 的时候;如果已经拿到 layout,就继续按原来的 width: 100% / height: 100% 走,避免额外带上 top/right/bottom/left: 0 改变其它位置相关逻辑。