/// <summary>
        /// Schedule rendering of the React component rendered by the
        /// JavaScript application from the given JavaScript module
        /// <paramref name="moduleName"/> using the provided
        /// <paramref name="reactInstanceManager"/> to attach to the JavaScript context of that manager.
        /// Extra parameter
        /// <paramref name="initialProps"/> can be used to pass initial properties for the react component.
        /// </summary>
        /// <param name="reactInstanceManager">
        /// The React instance manager.
        /// </param>
        /// <param name="moduleName">The module name.</param>
        /// <param name="initialProps">The initialProps</param>
        public void StartReactApplication(ReactInstanceManager reactInstanceManager, string moduleName, JObject initialProps)
        {
            DispatcherHelpers.AssertOnDispatcher();

            if (_reactInstanceManager != null)
            {
                throw new InvalidOperationException("This root view has already been attached to an instance manager.");
            }

            _reactInstanceManager = reactInstanceManager;
            _jsModuleName         = moduleName;
            _initialProps         = initialProps;

            if (!_reactInstanceManager.HasStartedCreatingInitialContext)
            {
                _reactInstanceManager.CreateReactContextInBackground();
            }

            // We need to wait for the initial `Measure` call, if this view has
            // not yet been measured, we set the `_attachScheduled` flag, which
            // will enable deferred attachment of the root node.
            if (_wasMeasured)
            {
                _reactInstanceManager.AttachMeasuredRootView(this);
            }
            else
            {
                _attachScheduled = true;
            }
        }
        /// <summary>
        /// Schedule rendering of the React component rendered by the
        /// JavaScript application from the given JavaScript module
        /// <paramref name="moduleName"/> using the provided
        /// <paramref name="reactInstanceManager"/> to attach to the JavaScript context of that manager.
        /// Extra parameter
        /// <paramref name="initialProps"/> can be used to pass initial properties for the react component.
        /// </summary>
        /// <param name="reactInstanceManager">
        /// The React instance manager.
        /// </param>
        /// <param name="moduleName">The module name.</param>
        /// <param name="initialProps">The initialProps</param>
        public async void StartReactApplication(ReactInstanceManager reactInstanceManager, string moduleName, JObject initialProps)
        {
            DispatcherHelpers.AssertOnDispatcher();

            if (_reactInstanceManager != null)
            {
                throw new InvalidOperationException("This root view has already been attached to an instance manager.");
            }

            _reactInstanceManager = reactInstanceManager;
            _jsModuleName         = moduleName;
            _initialProps         = initialProps;

            var getReactContextTask = default(Task);

            if (!_reactInstanceManager.HasStartedCreatingInitialContext)
            {
                getReactContextTask = _reactInstanceManager.GetOrCreateReactContextAsync(CancellationToken.None);
            }

            // We need to wait for the initial `Measure` call, if this view has
            // not yet been measured, we set the `_attachScheduled` flag, which
            // will enable deferred attachment of the root node.
            if (_wasMeasured)
            {
                _reactInstanceManager.AttachMeasuredRootView(this);
            }
            else
            {
                _attachScheduled = true;
            }

            if (getReactContextTask != null)
            {
                await getReactContextTask.ConfigureAwait(false);
            }
        }