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

Add indent for props generation of codegen #24438

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function generatePropsString(component: ComponentShape) {
prop.name
}", sourceProps.${prop.name}, ${prop.name}))`;
})
.join(',\n');
.join(',\n' + ' ');
}

function getClassExtendString(component): string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ function generateEnumString(componentName: string, component): string {
value,
)}; return; }`,
)
.join('\n');
.join('\n' + ' ');

const toCases = values
.map(
Expand All @@ -209,7 +209,7 @@ function generateEnumString(componentName: string, component): string {
value,
)}: return "${value}";`,
)
.join('\n');
.join('\n' + ' ');

return enumTemplate
.replace(/::_ENUM_NAME_::/g, enumName)
Expand All @@ -232,7 +232,7 @@ function generatePropsString(

return `const ${nativeType} ${prop.name}{${defaultValue}};`;
})
.join('\n');
.join('\n' + ' ');
}

function getImports(component): Set<string> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ ArrayPropsNativeComponentProps::ArrayPropsNativeComponentProps(
const RawProps &rawProps): ViewProps(sourceProps, rawProps),

names(convertRawProp(rawProps, \\"names\\", sourceProps.names, names)),
disableds(convertRawProp(rawProps, \\"disableds\\", sourceProps.disableds, disableds)),
progress(convertRawProp(rawProps, \\"progress\\", sourceProps.progress, progress)),
radii(convertRawProp(rawProps, \\"radii\\", sourceProps.radii, radii)),
colors(convertRawProp(rawProps, \\"colors\\", sourceProps.colors, colors)),
srcs(convertRawProp(rawProps, \\"srcs\\", sourceProps.srcs, srcs)),
points(convertRawProp(rawProps, \\"points\\", sourceProps.points, points))
disableds(convertRawProp(rawProps, \\"disableds\\", sourceProps.disableds, disableds)),
progress(convertRawProp(rawProps, \\"progress\\", sourceProps.progress, progress)),
radii(convertRawProp(rawProps, \\"radii\\", sourceProps.radii, radii)),
colors(convertRawProp(rawProps, \\"colors\\", sourceProps.colors, colors)),
srcs(convertRawProp(rawProps, \\"srcs\\", sourceProps.srcs, srcs)),
points(convertRawProp(rawProps, \\"points\\", sourceProps.points, points))
{}

} // namespace react
Expand Down Expand Up @@ -202,11 +202,11 @@ FloatPropNativeComponentProps::FloatPropNativeComponentProps(
const RawProps &rawProps): ViewProps(sourceProps, rawProps),

blurRadius(convertRawProp(rawProps, \\"blurRadius\\", sourceProps.blurRadius, blurRadius)),
blurRadius2(convertRawProp(rawProps, \\"blurRadius2\\", sourceProps.blurRadius2, blurRadius2)),
blurRadius3(convertRawProp(rawProps, \\"blurRadius3\\", sourceProps.blurRadius3, blurRadius3)),
blurRadius4(convertRawProp(rawProps, \\"blurRadius4\\", sourceProps.blurRadius4, blurRadius4)),
blurRadius5(convertRawProp(rawProps, \\"blurRadius5\\", sourceProps.blurRadius5, blurRadius5)),
blurRadius6(convertRawProp(rawProps, \\"blurRadius6\\", sourceProps.blurRadius6, blurRadius6))
blurRadius2(convertRawProp(rawProps, \\"blurRadius2\\", sourceProps.blurRadius2, blurRadius2)),
blurRadius3(convertRawProp(rawProps, \\"blurRadius3\\", sourceProps.blurRadius3, blurRadius3)),
blurRadius4(convertRawProp(rawProps, \\"blurRadius4\\", sourceProps.blurRadius4, blurRadius4)),
blurRadius5(convertRawProp(rawProps, \\"blurRadius5\\", sourceProps.blurRadius5, blurRadius5)),
blurRadius6(convertRawProp(rawProps, \\"blurRadius6\\", sourceProps.blurRadius6, blurRadius6))
{}

} // namespace react
Expand Down Expand Up @@ -266,8 +266,8 @@ IntegerPropNativeComponentProps::IntegerPropNativeComponentProps(
const RawProps &rawProps): ViewProps(sourceProps, rawProps),

progress1(convertRawProp(rawProps, \\"progress1\\", sourceProps.progress1, progress1)),
progress2(convertRawProp(rawProps, \\"progress2\\", sourceProps.progress2, progress2)),
progress3(convertRawProp(rawProps, \\"progress3\\", sourceProps.progress3, progress3))
progress2(convertRawProp(rawProps, \\"progress2\\", sourceProps.progress2, progress2)),
progress3(convertRawProp(rawProps, \\"progress3\\", sourceProps.progress3, progress3))
{}

} // namespace react
Expand Down Expand Up @@ -327,9 +327,9 @@ ImageColorPropNativeComponentProps::ImageColorPropNativeComponentProps(
const RawProps &rawProps): ViewProps(sourceProps, rawProps),

thumbImage(convertRawProp(rawProps, \\"thumbImage\\", sourceProps.thumbImage, thumbImage)),
color(convertRawProp(rawProps, \\"color\\", sourceProps.color, color)),
thumbTintColor(convertRawProp(rawProps, \\"thumbTintColor\\", sourceProps.thumbTintColor, thumbTintColor)),
point(convertRawProp(rawProps, \\"point\\", sourceProps.point, point))
color(convertRawProp(rawProps, \\"color\\", sourceProps.color, color)),
thumbTintColor(convertRawProp(rawProps, \\"thumbTintColor\\", sourceProps.thumbTintColor, thumbTintColor)),
point(convertRawProp(rawProps, \\"point\\", sourceProps.point, point))
{}

} // namespace react
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ class ArrayPropsNativeComponentProps final : public ViewProps {
#pragma mark - Props

const std::vector<std::string> names{};
const std::vector<bool> disableds{};
const std::vector<int> progress{};
const std::vector<Float> radii{};
const std::vector<SharedColor> colors{};
const std::vector<ImageSource> srcs{};
const std::vector<Point> points{};
const std::vector<bool> disableds{};
const std::vector<int> progress{};
const std::vector<Float> radii{};
const std::vector<SharedColor> colors{};
const std::vector<ImageSource> srcs{};
const std::vector<Point> points{};
};

} // namespace react
Expand Down Expand Up @@ -128,16 +128,16 @@ enum class EnumPropsNativeComponentAlignment { Top, Center, Bottom };
static inline void fromRawValue(const RawValue &value, EnumPropsNativeComponentAlignment &result) {
auto string = (std::string)value;
if (string == \\"top\\") { result = EnumPropsNativeComponentAlignment::Top; return; }
if (string == \\"center\\") { result = EnumPropsNativeComponentAlignment::Center; return; }
if (string == \\"bottom\\") { result = EnumPropsNativeComponentAlignment::Bottom; return; }
if (string == \\"center\\") { result = EnumPropsNativeComponentAlignment::Center; return; }
if (string == \\"bottom\\") { result = EnumPropsNativeComponentAlignment::Bottom; return; }
abort();
}

static inline std::string toString(const EnumPropsNativeComponentAlignment &value) {
switch (value) {
case EnumPropsNativeComponentAlignment::Top: return \\"top\\";
case EnumPropsNativeComponentAlignment::Center: return \\"center\\";
case EnumPropsNativeComponentAlignment::Bottom: return \\"bottom\\";
case EnumPropsNativeComponentAlignment::Center: return \\"center\\";
case EnumPropsNativeComponentAlignment::Bottom: return \\"bottom\\";
}
}

Expand Down Expand Up @@ -245,11 +245,11 @@ class FloatPropNativeComponentProps final : public ViewProps {
#pragma mark - Props

const Float blurRadius{0.0};
const Float blurRadius2{0.001};
const Float blurRadius3{2.1};
const Float blurRadius4{0.0};
const Float blurRadius5{1.0};
const Float blurRadius6{0.0};
const Float blurRadius2{0.001};
const Float blurRadius3{2.1};
const Float blurRadius4{0.0};
const Float blurRadius5{1.0};
const Float blurRadius6{0.0};
};

} // namespace react
Expand Down Expand Up @@ -315,8 +315,8 @@ class IntegerPropNativeComponentProps final : public ViewProps {
#pragma mark - Props

const int progress1{0};
const int progress2{-1};
const int progress3{10};
const int progress2{-1};
const int progress3{10};
};

} // namespace react
Expand Down Expand Up @@ -384,9 +384,9 @@ class ImageColorPropNativeComponentProps final : public ViewProps {
#pragma mark - Props

const ImageSource thumbImage{};
const SharedColor color{};
const SharedColor thumbTintColor{};
const Point point{};
const SharedColor color{};
const SharedColor thumbTintColor{};
const Point point{};
};

} // namespace react
Expand Down