diff --git a/change/react-native-windows-2019-11-06-16-45-50-vmcommands.json b/change/react-native-windows-2019-11-06-16-45-50-vmcommands.json new file mode 100644 index 00000000000..163e88d4f8c --- /dev/null +++ b/change/react-native-windows-2019-11-06-16-45-50-vmcommands.json @@ -0,0 +1,8 @@ +{ + "type": "prerelease", + "comment": "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", + "packageName": "react-native-windows", + "email": "jthysell@microsoft.com", + "commit": "529a95bf145b1f25511874776724082ab8032caa", + "date": "2019-11-07T00:45:50.666Z" +} \ No newline at end of file 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; }} />