Skip to content

Commit 11a875a

Browse files
author
wangcuijuan
committed
fix 安卓背景图会放大问题
1 parent c3e1ac6 commit 11a875a

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

  • packages/webpack-plugin/lib/runtime/components/react

packages/webpack-plugin/lib/runtime/components/react/mpx-view.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,8 @@ function backgroundPosition (imageProps: ImageProps, preImageInfo: PreImageInfo,
276276
function backgroundSize (imageProps: ImageProps, preImageInfo: PreImageInfo, imageSize: Size, layoutInfo: Size) {
277277
const { sizeList, type } = preImageInfo
278278
if (!sizeList) return
279+
// background-size 已负责计算最终宽高,普通图片内部只需铺满该矩形,避免 Android FastImage 再按 cover 二次裁剪 安卓会把图片放大
280+
if (type === 'image') imageProps.resizeMode = 'stretch'
279281
const { width: layoutWidth, height: layoutHeight } = layoutInfo || {}
280282
const { width: imageSizeWidth, height: imageSizeHeight } = imageSize || {}
281283
const [width, height] = sizeList

0 commit comments

Comments
 (0)