Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

fix: 修复原生组件驼峰风格,React风格函数属性转换错误的问题 #358

Merged
merged 1 commit into from
Nov 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/remax/src/Container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { generate } from './instanceId';
import { generate as generateActionId } from './actionId';
import { FiberRoot } from 'react-reconciler';
import Platform from './Platform';
import propsAlias from './propsAlias';
import propsAlias, { isHostComponent } from './propsAlias';

function stringPath(path: Path) {
return path.join('.');
Expand All @@ -12,7 +12,7 @@ function stringPath(path: Path) {
function transformRawNode(item: RawNode): RawNode {
return {
...item,
props: propsAlias(item.props),
props: propsAlias(item.props, !isHostComponent(item.type)),
children: item.children
? item.children.map(transformRawNode)
: item.children,
Expand Down
6 changes: 3 additions & 3 deletions packages/remax/src/VNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Container from './Container';

export interface RawNode {
id?: number;
type: string | symbol;
type: string;
props?: any;
children?: RawNode[];
text?: string;
Expand All @@ -16,7 +16,7 @@ export default class VNode {
container: Container;
children: VNode[];
mounted = false;
type: string | symbol;
type: string;
props?: any;
parent: VNode | null = null;
text?: string;
Expand All @@ -28,7 +28,7 @@ export default class VNode {
container,
}: {
id: number;
type: string | symbol;
type: string;
props?: any;
container: any;
}) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`remax render insert new element 1`] = `
exports[`alipay remax render insert new element 1`] = `
Object {
"children": Array [
Object {
Expand Down Expand Up @@ -43,7 +43,7 @@ Object {
}
`;

exports[`remax render insert new element 2`] = `
exports[`alipay remax render insert new element 2`] = `
Object {
"children": Array [
Object {
Expand Down Expand Up @@ -98,7 +98,7 @@ Object {
}
`;

exports[`remax render render correctly 1`] = `
exports[`alipay remax render render correctly 1`] = `
Object {
"children": Array [
Object {
Expand All @@ -123,7 +123,34 @@ Object {
}
`;

exports[`remax render renders conditional fragment correctly 1`] = `
exports[`alipay remax render render native component correctly 1`] = `
Array [
Object {
"id": 0,
"payload": Array [
Object {
"deleteCount": 0,
"item": Object {
"children": Array [],
"id": 1,
"props": Object {
"class": "class",
"fooBar": "fooBar",
"onClick": "$$REMAX_METHOD_1_onClick",
},
"text": undefined,
"type": "native-component",
},
"path": "root.children",
"start": 0,
},
],
"type": "splice",
},
]
`;

exports[`alipay remax render renders conditional fragment correctly 1`] = `
Object {
"children": Array [
Object {
Expand Down Expand Up @@ -158,7 +185,7 @@ Object {
}
`;

exports[`remax render renders conditional fragment correctly 2`] = `
exports[`alipay remax render renders conditional fragment correctly 2`] = `
Object {
"children": Array [
Object {
Expand All @@ -181,7 +208,7 @@ Object {
}
`;

exports[`remax render renders empty style 1`] = `
exports[`alipay remax render renders empty style 1`] = `
Object {
"children": Array [
Object {
Expand All @@ -206,7 +233,7 @@ Object {
}
`;

exports[`remax render renders style 1`] = `
exports[`alipay remax render renders style 1`] = `
Object {
"children": Array [
Object {
Expand Down Expand Up @@ -234,7 +261,7 @@ Object {
}
`;

exports[`remax render renders vendor prefix style 1`] = `
exports[`alipay remax render renders vendor prefix style 1`] = `
Object {
"children": Array [
Object {
Expand Down Expand Up @@ -262,7 +289,7 @@ Object {
}
`;

exports[`remax render umount component 1`] = `
exports[`alipay remax render umount component 1`] = `
Object {
"children": Array [
Object {
Expand Down Expand Up @@ -293,7 +320,7 @@ Object {
}
`;

exports[`remax render umount component 2`] = `
exports[`alipay remax render umount component 2`] = `
Object {
"children": Array [
Object {
Expand Down
Loading