Skip to content

Commit

Permalink
修复line-height: normal;报错
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaoGongBra committed Jun 25, 2022
1 parent 8459b18 commit 9d004b2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions components/HtmlView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const Image = ({ style, className, src, containerLayout, onClick }) => {
src
})
}, [onClick])

return <TaroImage
style={{ width: containerLayout.width + (process.env.TARO_ENV === 'rn' ? 0 : 'px'), ...style }}
className={className}
Expand Down Expand Up @@ -169,7 +169,7 @@ let layoutKey = 1
* @param {*} param0
* @returns
*/
const Layout = ({ children, onLayout, className, ...props }) => {
const Layout = ({ children, onLayout, className, style, ...props }) => {

const currentClass = useMemo(() => process.env.TARO_ENV === 'rn' ? '' : `layout-measure-${layoutKey++}`, [])

Expand All @@ -187,7 +187,7 @@ const Layout = ({ children, onLayout, className, ...props }) => {
})
}, [onLayout])

return <TaroView onLayout={layout} className={`${className} ${currentClass}`} {...props}>
return <TaroView onLayout={layout} className={`${className} ${currentClass}`} style={style} {...props}>
{children}
</TaroView>
}
Expand All @@ -198,6 +198,7 @@ export default function HtmlView({
className,
previewImage
}) {

const [nodes, setNodes] = useState([])

const images = useRef([])
Expand Down Expand Up @@ -256,7 +257,7 @@ const getNodes = (() => {
['textDecorationLine'],
]
// 不支持的Style属性
const noStyleValue = ['auto']
const noStyleValue = ['auto', 'normal']

// tag替换正则
const tagReg = /&([a-zA-Z0-9]{1,});/g
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "taro-html-view",
"version": "1.0.5",
"version": "1.0.6",
"description": "支持渲染由富文本编辑器编辑的html文本内容,支持小程序、h5、ReactNative,复杂的内容可能并不能正确渲染",
"main": "index.js",
"author": "[email protected]",
Expand Down

0 comments on commit 9d004b2

Please sign in to comment.