Skip to content
2 changes: 1 addition & 1 deletion ReactWindows/ReactNative.Net46/ReactPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public void OnResume(Action onBackPressed)
/// </summary>
public async Task DisposeAsync()
{
RootView?.RemoveHandler(Keyboard.KeyDownEvent, (KeyEventHandler) OnAcceleratorKeyActivated);
RootView?.RemoveHandler(Keyboard.KeyDownEvent, (KeyEventHandler)OnAcceleratorKeyActivated);

if (_reactInstanceManager.IsValueCreated)
{
Expand Down
12 changes: 11 additions & 1 deletion ReactWindows/ReactNative.Net46/UIManager/UIManagerModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,17 @@ public int AddMeasuredRootView(SizeMonitoringCanvas rootView)
return tag;
}

#region React Methods
/// <summary>
/// Schedule a block to be executed on the UI thread. Useful if you need to execute
/// view logic after all currently queued view updates have completed.
/// </summary>
/// <param name="block"></param>
public void AddUIBlock(IUIBlock block)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty comment.

{
_uiImplementation.AddUIBlock(block);
}

#region React Methods

/// <summary>
/// Removes the root view.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
<Compile Include="$(MSBuildThisFileDirectory)UIManager\BorderedViewParentManager.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UIManager\BorderExtensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UIManager\ColorHelpers.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UIManager\IUIBlock.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UIManager\ReactShadowNodeExtensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UIManager\ReactShadowNodeVisitor.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UIManager\DependencyObjectExtensions.cs" />
Expand Down
17 changes: 17 additions & 0 deletions ReactWindows/ReactNative.Shared/UIManager/IUIBlock.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using ReactNative.UIManager;

namespace ReactNative.UIManager
{
/// <summary>
/// Interface that represents a block to execute on the UI thread.
/// Exposes NativeViewHierarchyManager for third party libraries.
/// </summary>
public interface IUIBlock
{
/// <summary>
/// Executes the block.
/// </summary>
/// <param name="nativeViewHierarchyManager">The Native View Hierarchy Manager.</param>
void Execute(NativeViewHierarchyManager nativeViewHierarchyManager);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fill in.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rozele Not sure what you mean here. Do you want this method to have a default body or something?

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ public void ShowPopupMenu(int tag, string[] items, ICallback success)
throw new NotImplementedException();
}

private DependencyObject ResolveView(int tag)
public DependencyObject ResolveView(int tag)
{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing comments on public classes produce warnings.

var view = default(DependencyObject);
if (!_tagsToViews.TryGetValue(tag, out view))
Expand All @@ -587,7 +587,7 @@ private DependencyObject ResolveView(int tag)
return view;
}

private IViewManager ResolveViewManager(int tag)
public IViewManager ResolveViewManager(int tag)

@rozele rozele Mar 6, 2017

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public [](start = 8, length = 6)

Hmm, I wonder if we should go one step further on Android and create a simple interface that exposes only the methods that we want exposed (e.g., ResolveView and ResolveViewManager). Thoughts @matthargett? #Closed

@matthargett matthargett Mar 6, 2017

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe. I'd need to look at the consumption of the methods being exposed, but it's not jumping out at me in this diff. Also, since its only two methods and they take a POD and return a pure interface, there isn't a coupling problem -- just an ISP problem. #Closed

@ryanlntn ryanlntn Mar 7, 2017

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I think that makes sense from a design standpoint I think there is probably more value to having a more similar interfaces between iOS, Android, and Windows as it makes adding Windows support to existing extensions easier. #Closed

{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing comments on public classes produce warnings.

var viewManager = default(IViewManager);
if (!_tagsToViewManagers.TryGetValue(tag, out viewManager))
Expand Down
9 changes: 9 additions & 0 deletions ReactWindows/ReactNative.Shared/UIManager/UIImplementation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,15 @@ public void ShowPopupMenu(int reactTag, string[] items, ICallback error, ICallba
_operationsQueue.EnqueueShowPopupMenu(reactTag, items, error, success);
}

/// <summary>
/// Enqueues UIBlock to be executed.
/// </summary>
/// <param name="block"></param>
public void AddUIBlock(IUIBlock block)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing comment.

{
_operationsQueue.EnqueueUIBlock(block);
}

/// <summary>
/// Called when the host receives the suspend event.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,15 @@ public void EnqueueShowPopupMenu(int tag, string[] items, ICallback error, ICall
EnqueueOperation(() => _nativeViewHierarchyManager.ShowPopupMenu(tag, items, success));
}

/// <summary>
/// Enqueues a operation to execute a UIBlock.
/// </summary>
/// <param name="block"></param>
public void EnqueueUIBlock(IUIBlock block)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing comment.

{
EnqueueOperation(() => block.Execute(_nativeViewHierarchyManager));
}

/// <summary>
/// Enqueues an operation to create a view.
/// </summary>
Expand Down
12 changes: 11 additions & 1 deletion ReactWindows/ReactNative/UIManager/UIManagerModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,17 @@ public int AddMeasuredRootView(SizeMonitoringCanvas rootView)
return tag;
}

#region React Methods
/// <summary>
/// Schedule a block to be executed on the UI thread. Useful if you need to execute
/// view logic after all currently queued view updates have completed.
/// </summary>
/// <param name="block"></param>
public void AddUIBlock(IUIBlock block)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty comment

{
_uiImplementation.AddUIBlock(block);
}

#region React Methods

/// <summary>
/// Removes the root view.
Expand Down