From f494b93e8d68f41f4252bbf3cf2bfa91fb1aa6ad Mon Sep 17 00:00:00 2001 From: zhongwuzw Date: Sun, 14 Apr 2019 19:49:47 +0800 Subject: [PATCH] Add indent for event emitter header generation of codegen --- .../src/generators/GenerateEventEmitterH.js | 4 ++-- .../__snapshots__/GenerateEventEmitterH-test.js.snap | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/react-native-codegen/src/generators/GenerateEventEmitterH.js b/packages/react-native-codegen/src/generators/GenerateEventEmitterH.js index 75d89d5a1bd926..2b4909837a9825 100644 --- a/packages/react-native-codegen/src/generators/GenerateEventEmitterH.js +++ b/packages/react-native-codegen/src/generators/GenerateEventEmitterH.js @@ -108,7 +108,7 @@ function generateStruct( structNameParts, )} ${property.name};`; }) - .join('\n'); + .join('\n' + ' '); properties.forEach((property: ObjectPropertyType) => { const name = property.name; @@ -165,7 +165,7 @@ function generateEvent(componentName: string, event: EventTypeShape): string { function generateEvents(componentName: string, component): string { return component.events .map(event => generateEvent(componentName, event)) - .join('\n\n'); + .join('\n\n' + ' '); } module.exports = { diff --git a/packages/react-native-codegen/src/generators/__tests__/__snapshots__/GenerateEventEmitterH-test.js.snap b/packages/react-native-codegen/src/generators/__tests__/__snapshots__/GenerateEventEmitterH-test.js.snap index f7d7ca0508c7d6..bf3c4da2b95e17 100644 --- a/packages/react-native-codegen/src/generators/__tests__/__snapshots__/GenerateEventEmitterH-test.js.snap +++ b/packages/react-native-codegen/src/generators/__tests__/__snapshots__/GenerateEventEmitterH-test.js.snap @@ -118,8 +118,8 @@ struct EventsNestedObjectNativeComponentOnChangeLocationSourceStruct { struct EventsNestedObjectNativeComponentOnChangeLocationStruct { EventsNestedObjectNativeComponentOnChangeLocationSourceStruct source; -int x; -int y; + int x; + int y; }; struct EventsNestedObjectNativeComponentOnChangeStruct { @@ -157,9 +157,9 @@ namespace react { struct EventsNativeComponentOnChangeStruct { bool value; -std::string source; -int progress; -Float scale; + std::string source; + int progress; + Float scale; }; struct EventsNativeComponentOnEventDirectStruct { @@ -172,7 +172,7 @@ class EventsNativeComponentEventEmitter : public ViewEventEmitter { void onChange(EventsNativeComponentOnChangeStruct value) const; -void onEventDirect(EventsNativeComponentOnEventDirectStruct value) const; + void onEventDirect(EventsNativeComponentOnEventDirectStruct value) const; }; } // namespace react