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 comp instance prop method #1458

Merged
merged 28 commits into from May 16, 2024

Conversation

Blackgan3
Copy link
Collaborator

跨端输出 react native 实例方法补充

detail: null,
...rawEvent.nativeEvent
}
const eventObj = rawEvent.customEvent
Copy link
Collaborator

Choose a reason for hiding this comment

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

不要修改原始事件对象,可以加个参数标识

Object.keys(newData).forEach((key) => {
set(this, key, newData[key])
})
this.__mpxProxy.forceUpdate(callback)
Copy link
Collaborator

Choose a reason for hiding this comment

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

mpxProxy.forceUpdate应该是for小程序的,rn下不应该调用

@@ -2535,7 +2537,11 @@ function postProcessComponentIs (el) {
})
newChild.exps = el.exps
addChild(tempNode, newChild)
postProcessIf(newChild)
Copy link
Collaborator

Choose a reason for hiding this comment

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

rn当中Component is可以实现得更优雅

@@ -2426,6 +2426,7 @@ function processElement (el, root, options, meta) {
processStyleReact(el)
processEventReact(el, options, meta)
processAttrs(el, options)
processComponentIs(el, options)
Copy link
Collaborator

Choose a reason for hiding this comment

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

放在processAttrs前面

function createInstance ({ props, ref, type, rawOptions, currentInject, validProps, components }) {
const instance = Object.create({
setData () {
setData (newData, callback) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

setData和wx保持一致,基于forceUpdate实现

@@ -47,6 +68,9 @@ function createInstance ({ props, ref, type, rawOptions, currentInject, validPro
return propsData
},
__render () {
Copy link
Collaborator

Choose a reason for hiding this comment

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

移除

@hiyuki hiyuki merged commit 385c794 into feat-react May 16, 2024
4 checks passed
hiyuki added a commit that referenced this pull request May 16, 2024
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

2 participants