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

Feat react template compiler #1469

Open
wants to merge 216 commits into
base: feat-react
Choose a base branch
from

Conversation

yandadaFreedom
Copy link
Collaborator

No description provided.

}
}, [isWidthFixMode, isHeightFixMode, isCropMode, src])

useEffect(() => loadImage(), [loadImage])
Copy link
Collaborator

Choose a reason for hiding this comment

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

为啥以loadImage为依赖,唯一的依赖应该是src

const loadImage = useCallback((): void => {
if (!isWidthFixMode && !isHeightFixMode && !isCropMode) return
if (typeof src === 'string') {
RNImage.getSize(src, (width: number, height: number) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

对于依赖图形原始高宽的mode来说,在获取图像原始高宽之前先不展示图片

applyHoverEffect && hoverStyle,
]}>
{loading && <Loading alone={!React.Children.count(children)} />}
<Text
Copy link
Collaborator

@hiyuki hiyuki May 31, 2024

Choose a reason for hiding this comment

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

button内部可能存在非字符串的情况,比如<button><image src="..."/>xxx</button>,不能一律使用Text包裹,需要判断情况,当children.every(child=>isText(child))时才能安全使用Text包裹,逻辑可以参考群峰的view分支

...inheritTextStyle
}
}
}, [type, plain, applyHoverEffect, loading, disabled, style])
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个useMemo应该每次都在计算,意义不大

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

5 participants