Skip to content

Commit

Permalink
Merge pull request #77 from CatalystCode/issue70
Browse files Browse the repository at this point in the history
Towards #70.
  • Loading branch information
rozele committed Dec 31, 2015
2 parents 7355474 + 02def6e commit 38c0476
Show file tree
Hide file tree
Showing 16 changed files with 1,213 additions and 167 deletions.
5 changes: 5 additions & 0 deletions ReactWindows/Playground/Playground.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@
<Name>ReactNative</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Reference Include="Facebook.CSSLayout">
<HintPath>..\References\Facebook.CSSLayout.dll</HintPath>
</Reference>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
Expand Down
6 changes: 5 additions & 1 deletion ReactWindows/ReactNative.Tests/ReactNative.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,11 @@
<Name>ReactNative</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Reference Include="Facebook.CSSLayout">
<HintPath>..\References\Facebook.CSSLayout.dll</HintPath>
</Reference>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,17 @@ public void ViewManagersPropertyCache_ViewManager_Set()
{ "Bar2", "v3" },
});

AssertEx.Throws<NotSupportedException>(() => setters["Foo"].SetShadowNodeProperty(new ShadowNodeValueTest(), properties));
AssertEx.Throws<NotSupportedException>(() => setters["Foo"].UpdateShadowNodeProperty(new ShadowNodeValueTest(), properties));
AssertEx.Throws<ArgumentNullException>(
() => setters["Foo"].SetViewManagerProperty(null, null, properties),
() => setters["Foo"].UpdateViewManagerProperty(null, null, properties),
ex => Assert.AreEqual("viewManager", ex.ParamName));
AssertEx.Throws<ArgumentNullException>(
() => setters["Foo"].SetViewManagerProperty(instance, null, null),
() => setters["Foo"].UpdateViewManagerProperty(instance, null, null),
ex => Assert.AreEqual("properties", ex.ParamName));

setters["Foo"].SetViewManagerProperty(instance, null, properties);
setters["Bar1"].SetViewManagerProperty(instance, null, properties);
setters["Bar2"].SetViewManagerProperty(instance, null, properties);
setters["Foo"].UpdateViewManagerProperty(instance, null, properties);
setters["Bar1"].UpdateViewManagerProperty(instance, null, properties);
setters["Bar2"].UpdateViewManagerProperty(instance, null, properties);

Assert.AreEqual("v1", instance.FooValue);
Assert.AreEqual("v2", instance.BarValues[0]);
Expand All @@ -92,17 +92,17 @@ public void ViewManagersPropertyCache_ShadowNode_Set()
{ "Qux2", "v3" },
});

AssertEx.Throws<NotSupportedException>(() => setters["Foo"].SetViewManagerProperty(new ViewManagerValueTest(), null, properties));
AssertEx.Throws<NotSupportedException>(() => setters["Foo"].UpdateViewManagerProperty(new ViewManagerValueTest(), null, properties));
AssertEx.Throws<ArgumentNullException>(
() => setters["Foo"].SetShadowNodeProperty(null, properties),
() => setters["Foo"].UpdateShadowNodeProperty(null, properties),
ex => Assert.AreEqual("shadowNode", ex.ParamName));
AssertEx.Throws<ArgumentNullException>(
() => setters["Foo"].SetShadowNodeProperty(instance, null),
() => setters["Foo"].UpdateShadowNodeProperty(instance, null),
ex => Assert.AreEqual("properties", ex.ParamName));

setters["Foo"].SetShadowNodeProperty(instance, properties);
setters["Qux1"].SetShadowNodeProperty(instance, properties);
setters["Qux2"].SetShadowNodeProperty(instance, properties);
setters["Foo"].UpdateShadowNodeProperty(instance, properties);
setters["Qux1"].UpdateShadowNodeProperty(instance, properties);
setters["Qux2"].UpdateShadowNodeProperty(instance, properties);

Assert.AreEqual(42, instance.FooValue);
Assert.AreEqual("v2", instance.QuxValues[0]);
Expand Down Expand Up @@ -147,25 +147,25 @@ public void ViewManagersPropertyCache_Defaults()
instance.NullableValue = true;
instance.GroupValue = new[] { "a", "b", "c" };

setters["TestByte"].SetViewManagerProperty(instance, null, properties);
setters["TestSByte"].SetViewManagerProperty(instance, null, properties);
setters["TestInt16"].SetViewManagerProperty(instance, null, properties);
setters["TestUInt16"].SetViewManagerProperty(instance, null, properties);
setters["TestInt32"].SetViewManagerProperty(instance, null, properties);
setters["TestUInt32"].SetViewManagerProperty(instance, null, properties);
setters["TestInt64"].SetViewManagerProperty(instance, null, properties);
setters["TestUInt64"].SetViewManagerProperty(instance, null, properties);
setters["TestSingle"].SetViewManagerProperty(instance, null, properties);
setters["TestDouble"].SetViewManagerProperty(instance, null, properties);
setters["TestDecimal"].SetViewManagerProperty(instance, null, properties);
setters["TestBoolean"].SetViewManagerProperty(instance, null, properties);
setters["TestString"].SetViewManagerProperty(instance, null, properties);
setters["TestArray"].SetViewManagerProperty(instance, null, properties);
setters["TestMap"].SetViewManagerProperty(instance, null, properties);
setters["TestNullable"].SetViewManagerProperty(instance, null, properties);
setters["foo"].SetViewManagerProperty(instance, null, properties);
setters["bar"].SetViewManagerProperty(instance, null, properties);
setters["baz"].SetViewManagerProperty(instance, null, properties);
setters["TestByte"].UpdateViewManagerProperty(instance, null, properties);
setters["TestSByte"].UpdateViewManagerProperty(instance, null, properties);
setters["TestInt16"].UpdateViewManagerProperty(instance, null, properties);
setters["TestUInt16"].UpdateViewManagerProperty(instance, null, properties);
setters["TestInt32"].UpdateViewManagerProperty(instance, null, properties);
setters["TestUInt32"].UpdateViewManagerProperty(instance, null, properties);
setters["TestInt64"].UpdateViewManagerProperty(instance, null, properties);
setters["TestUInt64"].UpdateViewManagerProperty(instance, null, properties);
setters["TestSingle"].UpdateViewManagerProperty(instance, null, properties);
setters["TestDouble"].UpdateViewManagerProperty(instance, null, properties);
setters["TestDecimal"].UpdateViewManagerProperty(instance, null, properties);
setters["TestBoolean"].UpdateViewManagerProperty(instance, null, properties);
setters["TestString"].UpdateViewManagerProperty(instance, null, properties);
setters["TestArray"].UpdateViewManagerProperty(instance, null, properties);
setters["TestMap"].UpdateViewManagerProperty(instance, null, properties);
setters["TestNullable"].UpdateViewManagerProperty(instance, null, properties);
setters["foo"].UpdateViewManagerProperty(instance, null, properties);
setters["bar"].UpdateViewManagerProperty(instance, null, properties);
setters["baz"].UpdateViewManagerProperty(instance, null, properties);

Assert.AreEqual(0, instance.ByteValue);
Assert.AreEqual(0, instance.SByteValue);
Expand Down
9 changes: 7 additions & 2 deletions ReactWindows/ReactNative/ReactNative.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@
<Compile Include="LifecycleState.cs" />
<Compile Include="IReactInstanceManager.cs" />
<Compile Include="ReactInstanceManagerImpl.cs" />
<Compile Include="CSSLayout\CSSNode.cs" />
<Compile Include="Hosting\JavaScriptBackgroundWorkItemCallback.cs" />
<Compile Include="Hosting\JavaScriptBeforeCollectCallback.cs" />
<Compile Include="Hosting\JavaScriptContext.cs" />
Expand Down Expand Up @@ -193,7 +192,7 @@
<Compile Include="Touch\OnInterceptTouchEventListener.cs" />
<Compile Include="UIManager\Animation\AnimationRegistry.cs" />
<Compile Include="UIManager\CatalystStylesDiffMap.cs" />
<Compile Include="CSSLayout\CSSLayoutContext.cs" />
<Compile Include="UIManager\CatalystStylesDiffMapExtensions.cs" />
<Compile Include="UIManager\Events\Event.cs" />
<Compile Include="UIManager\Events\EventDispatcher.cs" />
<Compile Include="UIManager\Events\RCTEventEmitter.cs" />
Expand Down Expand Up @@ -241,6 +240,7 @@
<Compile Include="UIManager\ViewManager.cs" />
<Compile Include="UIManager\ViewManagerRegistry.cs" />
<Compile Include="UIManager\ViewManagersPropertyCache.cs" />
<Compile Include="UIManager\ViewProperties.cs" />
<Compile Include="Views\ReactRootView.xaml.cs">
<DependentUpon>ReactRootView.xaml</DependentUpon>
</Compile>
Expand All @@ -265,6 +265,11 @@
<Folder Include="JavaScript\lib\" />
<Folder Include="JavaScript\uwp-native\" />
</ItemGroup>
<ItemGroup>
<Reference Include="Facebook.CSSLayout">
<HintPath>..\References\Facebook.CSSLayout.dll</HintPath>
</Reference>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace ReactNative.UIManager
{
static class CatalystStylesDiffMapExtensions
{
public static T GetProperty<T>(this CatalystStylesDiffMap properties, string name)
{
return (T)properties.GetProperty(name, typeof(T));
}
}
}
4 changes: 2 additions & 2 deletions ReactWindows/ReactNative/UIManager/IPropertySetter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ interface IPropertySetter

string PropertyType { get; }

void SetShadowNodeProperty(ReactShadowNode shadowNode, CatalystStylesDiffMap value);
void UpdateShadowNodeProperty(ReactShadowNode shadowNode, CatalystStylesDiffMap value);

void SetViewManagerProperty(IViewManager viewManager, FrameworkElement view, CatalystStylesDiffMap value);
void UpdateViewManagerProperty(IViewManager viewManager, FrameworkElement view, CatalystStylesDiffMap value);
}
}
Loading

2 comments on commit 38c0476

@cicorias
Copy link
Member

Choose a reason for hiding this comment

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

Was Facebook.csslayout.dll intended to be committed? Is there a source?

@rozele
Copy link
Collaborator Author

@rozele rozele commented on 38c0476 Jan 5, 2016 via email

Choose a reason for hiding this comment

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

Please sign in to comment.