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

fix: support dimensional prop value without px #1467

Merged
merged 11 commits into from Nov 14, 2019
Merged

Conversation

fyangstudio
Copy link
Collaborator

@fyangstudio fyangstudio commented Nov 5, 2019

Update driver-universal.
This PR make driver-universal consistent with driver-dom processing style in web app.

  1. support dimensional prop value without px.
    <div style={{width: 100}} /> to <div style="width: 100rpx" />
    see: fix: support dimensional prop value without px #1456

  2. 'rpx' translate to 'vw' in web app.(driver-dom)
    <div style={{width: '75rpx'}} /> to <div style="width: 10vw" /> when viewportWidth is 750

Compare

driver append unit to relevant styles 'rpx' translate Compatible with flex Compatible with event
driver-dom Append 'px' Translate to 'vw' Do nothing Do nothing
driver-weex Append 'px' that relative to the width of the screen. Translate to 'px' that relative to the width of the screen. Do nothing Do nothing
driver-universal Append 'rpx' Do nothing Support parsing array like display: ["-webkit-box", "-webkit-flex", "flex"] Support input doubleclick

@fyangstudio
Copy link
Collaborator Author

fyangstudio commented Nov 6, 2019

Driver-dom 此处判断有误:
driver-dom/src/index.js#L100

function isRpx(str) {
  return typeof str === 'string' && str.slice(0, -3) === 'rpx';
} 

此方法应为 slice(-3),同时不能识别 margin '10rpx 10rpx',未收敛至 style-unit 目前需进一步修改


fixed

@fyangstudio fyangstudio changed the title fix: support dimensional prop value without px [WIP]fix: support dimensional prop value without px Nov 7, 2019
@fyangstudio fyangstudio changed the title [WIP]fix: support dimensional prop value without px fix: support dimensional prop value without px Nov 11, 2019
Copy link
Collaborator

@wssgcg1213 wssgcg1213 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

@fyangstudio fyangstudio merged commit cda35fb into master Nov 14, 2019
@fyangstudio fyangstudio deleted the fix-driver-universal branch November 14, 2019 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants