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: rn event target #1753

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,22 @@ const getTouchEvent = (
}
)

const pendingProps = (event as any)._targetInst?.pendingProps || {}
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个东西试一下生产模式和安卓下是否都存在


const target = extendObject(
{},
event.target,
{
id: pendingProps.parentId || pendingProps.nativeID || '',
dataset: collectDataset(pendingProps)
}
)

return extendObject({}, event, {
type,
timeStamp: timestamp,
currentTarget,
target,
detail: {
x: pageX,
y: pageY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ interface LayoutConfig {
export const useLayout = ({ props, hasSelfPercent, setWidth, setHeight, onLayout, nodeRef }: LayoutConfig) => {
const layoutRef = useRef({})
const hasLayoutRef = useRef(false)
const layoutStyle: Record<string, any> = !hasLayoutRef.current && hasSelfPercent ? HIDDEN_STYLE : {}
const layoutStyle = useMemo(() => { return !hasLayoutRef.current && hasSelfPercent ? HIDDEN_STYLE : {} }, [hasLayoutRef.current])
const layoutProps: Record<string, any> = {}
const enableOffset = props['enable-offset']
if (hasSelfPercent || onLayout || enableOffset) {
Expand Down
12 changes: 9 additions & 3 deletions packages/webpack-plugin/lib/template-compiler/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -2064,16 +2064,22 @@ function processWrapTextReact (el, options, meta) {
if (parentTag !== 'mpx-text' && parentTag !== 'Text' && parentTag !== 'wxs') {
const wrapper = createASTElement('mpx-simple-text')
wrapper.isBuiltIn = true
const dataSetAttrs = []
const inheritAttrs = []
parent.attrsList.forEach(({ name, value }) => {
if (/^data-/.test(name)) {
dataSetAttrs.push({
inheritAttrs.push({
name,
value
})
}
if (/^id$/.test(name)) {
inheritAttrs.push({
name: 'parentId',
value
})
}
})
addAttrs(wrapper, dataSetAttrs)
addAttrs(wrapper, inheritAttrs)
replaceNode(el, wrapper, true)
addChild(wrapper, el)
processBuiltInComponents(wrapper, meta)
Expand Down
Loading