-
Notifications
You must be signed in to change notification settings - Fork 370
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
base: feat-react
Are you sure you want to change the base?
Conversation
…to feat-react-template-compiler
feat: 修改react事件响应
…to feat-react-template-compiler
…to feat-react-template-compiler
Feat component enable offset
…to feat-react-template-compiler
…at-process-event-mini
} | ||
}, [isWidthFixMode, isHeightFixMode, isCropMode, src]) | ||
|
||
useEffect(() => loadImage(), [loadImage]) |
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.
为啥以loadImage为依赖,唯一的依赖应该是src
const loadImage = useCallback((): void => { | ||
if (!isWidthFixMode && !isHeightFixMode && !isCropMode) return | ||
if (typeof src === 'string') { | ||
RNImage.getSize(src, (width: number, height: number) => { |
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.
对于依赖图形原始高宽的mode来说,在获取图像原始高宽之前先不展示图片
applyHoverEffect && hoverStyle, | ||
]}> | ||
{loading && <Loading alone={!React.Children.count(children)} />} | ||
<Text |
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.
button内部可能存在非字符串的情况,比如<button><image src="..."/>xxx</button>
,不能一律使用Text包裹,需要判断情况,当children.every(child=>isText(child))时才能安全使用Text包裹,逻辑可以参考群峰的view分支
...inheritTextStyle | ||
} | ||
} | ||
}, [type, plain, applyHoverEffect, loading, disabled, style]) |
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.
这个useMemo应该每次都在计算,意义不大
No description provided.