Make UIBlock Interface public, as on Android (#1050)
* This will allow gre/react-native-view-shot#45 (and in turn, Galooshi/happo ) to allow us to do screenshot-based tests in the CI
This commit is contained in:
Родитель
37ff7c2ba6
Коммит
5fd6e27002
|
@ -156,7 +156,7 @@ namespace ReactNative
|
|||
/// </summary>
|
||||
public async Task DisposeAsync()
|
||||
{
|
||||
RootView?.RemoveHandler(Keyboard.KeyDownEvent, (KeyEventHandler) OnAcceleratorKeyActivated);
|
||||
RootView?.RemoveHandler(Keyboard.KeyDownEvent, (KeyEventHandler)OnAcceleratorKeyActivated);
|
||||
|
||||
if (_reactInstanceManager.IsValueCreated)
|
||||
{
|
||||
|
|
|
@ -137,7 +137,17 @@ namespace ReactNative.UIManager
|
|||
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">The UI block.</param>
|
||||
public void AddUIBlock(IUIBlock block)
|
||||
{
|
||||
_uiImplementation.AddUIBlock(block);
|
||||
}
|
||||
|
||||
#region React Methods
|
||||
|
||||
/// <summary>
|
||||
/// Removes the root view.
|
||||
|
|
|
@ -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" />
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -575,7 +575,11 @@ namespace ReactNative.UIManager
|
|||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private DependencyObject ResolveView(int tag)
|
||||
/// <summary>
|
||||
/// Resolves a view.
|
||||
/// </summary>
|
||||
/// <param name="tag">The tag of the view.</param>
|
||||
public DependencyObject ResolveView(int tag)
|
||||
{
|
||||
var view = default(DependencyObject);
|
||||
if (!_tagsToViews.TryGetValue(tag, out view))
|
||||
|
@ -587,7 +591,11 @@ namespace ReactNative.UIManager
|
|||
return view;
|
||||
}
|
||||
|
||||
private IViewManager ResolveViewManager(int tag)
|
||||
/// <summary>
|
||||
/// Resolves a view's view manager.
|
||||
/// </summary>
|
||||
/// <param name="tag">The tag of the view.</param>
|
||||
public IViewManager ResolveViewManager(int tag)
|
||||
{
|
||||
var viewManager = default(IViewManager);
|
||||
if (!_tagsToViewManagers.TryGetValue(tag, out viewManager))
|
||||
|
|
|
@ -623,6 +623,15 @@ namespace ReactNative.UIManager
|
|||
_operationsQueue.EnqueueShowPopupMenu(reactTag, items, error, success);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enqueues UIBlock to be executed.
|
||||
/// </summary>
|
||||
/// <param name="block">The UI block.</param>
|
||||
public void AddUIBlock(IUIBlock block)
|
||||
{
|
||||
_operationsQueue.EnqueueUIBlock(block);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when the host receives the suspend event.
|
||||
/// </summary>
|
||||
|
|
|
@ -164,6 +164,15 @@ namespace ReactNative.UIManager
|
|||
EnqueueOperation(() => _nativeViewHierarchyManager.ShowPopupMenu(tag, items, success));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enqueues a operation to execute a UIBlock.
|
||||
/// </summary>
|
||||
/// <param name="block">The UI block.</param>
|
||||
public void EnqueueUIBlock(IUIBlock block)
|
||||
{
|
||||
EnqueueOperation(() => block.Execute(_nativeViewHierarchyManager));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enqueues an operation to create a view.
|
||||
/// </summary>
|
||||
|
|
|
@ -132,7 +132,17 @@ namespace ReactNative.UIManager
|
|||
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">The UI block.</param>
|
||||
public void AddUIBlock(IUIBlock block)
|
||||
{
|
||||
_uiImplementation.AddUIBlock(block);
|
||||
}
|
||||
|
||||
#region React Methods
|
||||
|
||||
/// <summary>
|
||||
/// Removes the root view.
|
||||
|
|
Загрузка…
Ссылка в новой задаче