From 529a95bf145b1f25511874776724082ab8032caa Mon Sep 17 00:00:00 2001 From: "Jon Thysell (JAUNTY)" Date: Wed, 6 Nov 2019 11:51:50 -0800 Subject: [PATCH 1/4] ViewManager Command Updates * Added command to CustomUserControlViewManagerCPP, #3600 * Added support for simpler C# view manager commands signatures * Added support for object properties for view managers, #3613 * Added documentation for C++ view manager * Added documentation for ViewManager commands, #3599 --- .../index.windows.js | 28 +- .../CustomUserControlViewManagerCPP.cpp | 26 +- .../CustomUserControlViewManagerCPP.h | 12 +- .../windows/SampleLibraryCPP/DebugHelpers.cpp | 27 ++ .../windows/SampleLibraryCPP/DebugHelpers.h | 18 + .../SampleLibraryCPP/SampleLibraryCPP.vcxproj | 2 + .../SampleLibraryCPP.vcxproj.filters | 2 + .../SampleLibraryCPP/SampleModuleCPP.h | 39 +-- .../CustomUserControlViewManagerCS.cs | 5 +- .../AttributedViewManager.cs | 61 +++- .../Microsoft.ReactNative/ABIViewManager.cpp | 9 + vnext/Microsoft.ReactNative/IViewManager.idl | 1 + vnext/Microsoft.ReactNative/ReactSupport.cpp | 4 +- vnext/docs/NativeModules.md | 6 +- vnext/docs/ViewManagers.md | 308 +++++++++++++++++- 15 files changed, 491 insertions(+), 57 deletions(-) create mode 100644 packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/DebugHelpers.cpp create mode 100644 packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/DebugHelpers.h diff --git a/packages/microsoft-reactnative-sampleapps/index.windows.js b/packages/microsoft-reactnative-sampleapps/index.windows.js index 3a4e872e21b..a3dfb6722f7 100644 --- a/packages/microsoft-reactnative-sampleapps/index.windows.js +++ b/packages/microsoft-reactnative-sampleapps/index.windows.js @@ -36,11 +36,6 @@ var getCallback = function(prefix) { }; class SampleApp extends Component { - constructor(props) { - super(props); - this._CustomUserControlCSRef = React.createRef(); - } - componentDidMount() { this._TimedEventCSSub = SampleModuleCSEmitter.addListener('TimedEventCS', getCallback('SampleModuleCS.TimedEventCS() => ')); this._TimedEventCPPSub = SampleModuleCPPEmitter.addListener('TimedEventCPP', getCallback('SampleModuleCPP.TimedEventCPP() => ')); @@ -130,11 +125,26 @@ class SampleApp extends Component { onPressCustomUserControlCS() { log('SampleApp.onPressCustomUserControlCS()'); + var strArg = 'Hello World!'; + if (this._CustomUserControlCSRef) { const tag = findNodeHandle(this._CustomUserControlCSRef); - log(`tag: ${tag}`); - UIManager.dispatchViewManagerCommand(tag, UIManager.CustomUserControlCS.Commands.CustomCommand, ['Hello World!']); + log(`UIManager.dispatchViewManagerCommand(${tag}, CustomUserControlCS.CustomCommand, "${strArg}")`); + UIManager.dispatchViewManagerCommand(tag, UIManager.getViewManagerConfig('CustomUserControlCS').Commands.CustomCommand, strArg); + } + } + + onPressCustomUserControlCPP() { + log('SampleApp.onPressCustomUserControlCPP()'); + + var strArg = 'Hello World!'; + + if (this._CustomUserControlCPPRef) + { + const tag = findNodeHandle(this._CustomUserControlCPPRef); + log(`UIManager.dispatchViewManagerCommand(${tag}, CustomUserControlCPP.CustomCommand, "${strArg}")`); + UIManager.dispatchViewManagerCommand(tag, UIManager.getViewManagerConfig('CustomUserControlCPP').Commands.CustomCommand, strArg); } } @@ -154,7 +164,9 @@ class SampleApp extends Component { { this._CustomUserControlCSRef = ref; }} />