From 203e1c8f9ee204e57e40d6e5892f42068622622d Mon Sep 17 00:00:00 2001 From: Vladimir Morozov Date: Wed, 18 Dec 2019 13:45:40 -0800 Subject: [PATCH] Make sure that C# and C++ SampleApp projects identifiers have proper CS and Cpp suffixes to avoid name collisions. --- .../index.windows.js | 78 +++++++++---------- .../windows/SampleAppCPP/App.cpp | 8 +- .../windows/SampleAppCPP/App.h | 4 +- .../windows/SampleAppCPP/App.idl | 3 +- .../windows/SampleAppCPP/App.xaml | 4 +- .../windows/SampleAppCPP/DebugConsole.h | 5 +- .../windows/SampleAppCPP/Package.appxmanifest | 6 +- .../SampleAppCPP/ReactPackageProvider.cpp | 4 +- .../SampleAppCPP/ReactPackageProvider.h | 4 +- .../windows/SampleAppCPP/pch.h | 2 +- .../windows/SampleAppCS/App.xaml | 4 +- .../windows/SampleAppCS/App.xaml.cs | 4 +- .../windows/SampleAppCS/DebugConsole.cs | 2 +- .../windows/SampleAppCS/Package.appxmanifest | 2 +- .../SampleAppCS/Properties/AssemblyInfo.cs | 4 +- .../windows/SampleAppCS/SampleAppCS.csproj | 8 +- .../SampleAppCpp.vcxproj} | 6 +- .../SampleAppCpp.vcxproj.filters} | 0 .../windows/SampleApps.sln | 4 +- .../SampleLibraryCPP/CircleViewManagerCPP.cpp | 22 +++--- .../SampleLibraryCPP/CircleViewManagerCPP.h | 10 +-- .../SampleLibraryCPP/CustomUserControlCPP.cpp | 22 +++--- .../SampleLibraryCPP/CustomUserControlCPP.h | 16 ++-- .../SampleLibraryCPP/CustomUserControlCPP.idl | 8 +- .../CustomUserControlViewManagerCPP.cpp | 46 +++++------ .../CustomUserControlViewManagerCPP.h | 10 +-- .../windows/SampleLibraryCPP/DebugHelpers.cpp | 4 +- .../windows/SampleLibraryCPP/DebugHelpers.h | 4 +- .../SampleLibraryCPP/ReactPackageProvider.cpp | 18 ++--- .../SampleLibraryCPP/ReactPackageProvider.h | 8 +- .../SampleLibraryCPP/ReactPackageProvider.idl | 2 +- .../SampleLibraryCPP/SampleLibraryCPP.vcxproj | 28 +++---- .../SampleLibraryCPP.vcxproj.filters | 18 ++--- .../SampleLibraryCPP/SampleModuleCPP.h | 16 ++-- .../SampleLibraryCPP/Themes/Generic.xaml | 6 +- .../windows/SampleLibraryCPP/readme.txt | 2 +- 36 files changed, 195 insertions(+), 197 deletions(-) rename packages/microsoft-reactnative-sampleapps/windows/{SampleAppCPP/SampleApp.vcxproj => SampleAppCpp/SampleAppCpp.vcxproj} (98%) rename packages/microsoft-reactnative-sampleapps/windows/{SampleAppCPP/SampleApp.vcxproj.filters => SampleAppCpp/SampleAppCpp.vcxproj.filters} (100%) diff --git a/packages/microsoft-reactnative-sampleapps/index.windows.js b/packages/microsoft-reactnative-sampleapps/index.windows.js index cafab488a58..92b844145b7 100644 --- a/packages/microsoft-reactnative-sampleapps/index.windows.js +++ b/packages/microsoft-reactnative-sampleapps/index.windows.js @@ -19,13 +19,13 @@ import { NativeModules, NativeEventEmitter } from 'react-native'; // Creating event emitters const SampleModuleCSEmitter = new NativeEventEmitter(NativeModules.SampleModuleCS); -const SampleModuleCPPEmitter = new NativeEventEmitter(NativeModules.SampleModuleCPP); +const SampleModuleCppEmitter = new NativeEventEmitter(NativeModules.SampleModuleCpp); const CustomUserControlCS = requireNativeComponent('CustomUserControlCS'); -const CustomUserControlCPP = requireNativeComponent('CustomUserControlCPP'); +const CustomUserControlCpp = requireNativeComponent('CustomUserControlCpp'); const CircleCS = requireNativeComponent('CircleCS'); -const CircleCPP = requireNativeComponent('CircleCPP'); +const CircleCpp = requireNativeComponent('CircleCpp'); var log = function(result) { console.log(result); @@ -47,12 +47,12 @@ var getErrorCallback = function(prefix) { class SampleApp extends Component { componentDidMount() { this._TimedEventCSSub = SampleModuleCSEmitter.addListener('TimedEventCS', getCallback('SampleModuleCS.TimedEventCS() => ')); - this._TimedEventCPPSub = SampleModuleCPPEmitter.addListener('TimedEventCPP', getCallback('SampleModuleCPP.TimedEventCPP() => ')); + this._TimedEventCppSub = SampleModuleCppEmitter.addListener('TimedEventCpp', getCallback('SampleModuleCpp.TimedEventCpp() => ')); } componentWillUnmount() { this._TimedEventCSSub.remove(); - this._TimedEventCPPSub.remove(); + this._TimedEventCppSub.remove(); } onPressSampleModuleCS() { @@ -93,42 +93,42 @@ class SampleApp extends Component { log('SampleModuleCS.SyncReturnMethodWithArgs => ' + NativeModules.SampleModuleCS.SyncReturnMethodWithArgs(numberArg)); } - onPressSampleModuleCPP() { - log('SampleApp.onPressSampleModuleCPP()'); + onPressSampleModuleCpp() { + log('SampleApp.onPressSampleModuleCpp()'); var numberArg = 42; - // SampleModuleCPP constants + // SampleModuleCpp constants - log(`SampleModuleCPP.NumberConstant: ${NativeModules.SampleModuleCPP.NumberConstant}`); - log(`SampleModuleCPP.StringConstant: ${NativeModules.SampleModuleCPP.StringConstant}`); + log(`SampleModuleCpp.NumberConstant: ${NativeModules.SampleModuleCpp.NumberConstant}`); + log(`SampleModuleCpp.StringConstant: ${NativeModules.SampleModuleCpp.StringConstant}`); - log(`SampleModuleCPP.NumberConstantViaProvider: ${NativeModules.SampleModuleCPP.NumberConstantViaProvider}`); - log(`SampleModuleCPP.StringConstantViaProvider: ${NativeModules.SampleModuleCPP.StringConstantViaProvider}`); + log(`SampleModuleCpp.NumberConstantViaProvider: ${NativeModules.SampleModuleCpp.NumberConstantViaProvider}`); + log(`SampleModuleCpp.StringConstantViaProvider: ${NativeModules.SampleModuleCpp.StringConstantViaProvider}`); - // SampleModuleCPP method calls + // SampleModuleCpp method calls - NativeModules.SampleModuleCPP.VoidMethod(); + NativeModules.SampleModuleCpp.VoidMethod(); - NativeModules.SampleModuleCPP.VoidMethodWithArgs(numberArg); + NativeModules.SampleModuleCpp.VoidMethodWithArgs(numberArg); - NativeModules.SampleModuleCPP.ReturnMethod(getCallback('SampleModuleCPP.ReturnMethod => ')); + NativeModules.SampleModuleCpp.ReturnMethod(getCallback('SampleModuleCpp.ReturnMethod => ')); - NativeModules.SampleModuleCPP.ReturnMethodWithArgs(numberArg, getCallback('SampleModuleCPP.ReturnMethodWithArgs => ')); + NativeModules.SampleModuleCpp.ReturnMethodWithArgs(numberArg, getCallback('SampleModuleCpp.ReturnMethodWithArgs => ')); - NativeModules.SampleModuleCPP.ExplicitCallbackMethod(getCallback('SampleModuleCPP.ExplicitCallbackMethod => ')); + NativeModules.SampleModuleCpp.ExplicitCallbackMethod(getCallback('SampleModuleCpp.ExplicitCallbackMethod => ')); - NativeModules.SampleModuleCPP.ExplicitCallbackMethodWithArgs(numberArg, getCallback('SampleModuleCPP.ExplicitCallbackMethodWithArgs => ')); + NativeModules.SampleModuleCpp.ExplicitCallbackMethodWithArgs(numberArg, getCallback('SampleModuleCpp.ExplicitCallbackMethodWithArgs => ')); - var promise1 = NativeModules.SampleModuleCPP.ExplicitPromiseMethod(); - promise1.then(getCallback('SampleModuleCPP.ExplicitPromiseMethod then => ')).catch(getErrorCallback('SampleModuleCPP.ExplicitPromiseMethod catch => ')); + var promise1 = NativeModules.SampleModuleCpp.ExplicitPromiseMethod(); + promise1.then(getCallback('SampleModuleCpp.ExplicitPromiseMethod then => ')).catch(getErrorCallback('SampleModuleCpp.ExplicitPromiseMethod catch => ')); - var promise2 = NativeModules.SampleModuleCPP.ExplicitPromiseMethodWithArgs(numberArg); - promise2.then(getCallback('SampleModuleCPP.ExplicitPromiseMethodWithArgs then => ')).catch(getErrorCallback('SampleModuleCPP.ExplicitPromiseMethodWithArgs catch => ')); + var promise2 = NativeModules.SampleModuleCpp.ExplicitPromiseMethodWithArgs(numberArg); + promise2.then(getCallback('SampleModuleCpp.ExplicitPromiseMethodWithArgs then => ')).catch(getErrorCallback('SampleModuleCpp.ExplicitPromiseMethodWithArgs catch => ')); - log('SampleModuleCPP.SyncReturnMethod => ' + NativeModules.SampleModuleCPP.SyncReturnMethod()); + log('SampleModuleCpp.SyncReturnMethod => ' + NativeModules.SampleModuleCpp.SyncReturnMethod()); - log('SampleModuleCPP.SyncReturnMethodWithArgs => ' + NativeModules.SampleModuleCPP.SyncReturnMethodWithArgs(numberArg)); + log('SampleModuleCpp.SyncReturnMethodWithArgs => ' + NativeModules.SampleModuleCpp.SyncReturnMethodWithArgs(numberArg)); } onPressCustomUserControlCS() { @@ -144,16 +144,16 @@ class SampleApp extends Component { } } - onPressCustomUserControlCPP() { - log('SampleApp.onPressCustomUserControlCPP()'); + onPressCustomUserControlCpp() { + log('SampleApp.onPressCustomUserControlCpp()'); var strArg = 'Hello World!'; - if (this._CustomUserControlCPPRef) + if (this._CustomUserControlCppRef) { - const tag = findNodeHandle(this._CustomUserControlCPPRef); - log(`UIManager.dispatchViewManagerCommand(${tag}, CustomUserControlCPP.CustomCommand, "${strArg}")`); - UIManager.dispatchViewManagerCommand(tag, UIManager.getViewManagerConfig('CustomUserControlCPP').Commands.CustomCommand, strArg); + const tag = findNodeHandle(this._CustomUserControlCppRef); + log(`UIManager.dispatchViewManagerCommand(${tag}, CustomUserControlCpp.CustomCommand, "${strArg}")`); + UIManager.dispatchViewManagerCommand(tag, UIManager.getViewManagerConfig('CustomUserControlCpp').Commands.CustomCommand, strArg); } } @@ -162,9 +162,9 @@ class SampleApp extends Component { log(`SampleApp.onLabelChangedCustomUserControlCS("${label}")`); } - onLabelChangedCustomUserControlCPP(evt) { + onLabelChangedCustomUserControlCpp(evt) { var label = evt.nativeEvent; - log(`SampleApp.onLabelChangedCustomUserControlCPP("${label}")`); + log(`SampleApp.onLabelChangedCustomUserControlCpp("${label}")`); } render() { @@ -178,13 +178,13 @@ class SampleApp extends Component {