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

Merged
merged 279 commits into from
Jun 4, 2024
Merged

Feat react template compiler #1469

merged 279 commits into from
Jun 4, 2024

Conversation

yandadaFreedom
Copy link
Collaborator

No description provided.

yandadaFreedom and others added 30 commits May 9, 2024 14:20
}
}, [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应该每次都在计算,意义不大

}, {})
}

const isText = (ele: ReactElement) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

isText从utils中引用

@hiyuki hiyuki merged commit fbf1395 into feat-react Jun 4, 2024
4 checks passed
@hiyuki hiyuki deleted the feat-react-template-compiler branch June 4, 2024 07:41
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