diff --git a/ReactWindows/Playground/index.ios.js b/ReactWindows/Playground/index.ios.js
index 8d15f9ed7b5..e18d7b1bbf8 100644
--- a/ReactWindows/Playground/index.ios.js
+++ b/ReactWindows/Playground/index.ios.js
@@ -24,7 +24,7 @@ const styles={
}
};
-var {AppRegistry, View, Text, TextInput, Image } = React;
+var {AppRegistry, View, Text, TextInput, Image, Switch } = React;
var ReactRoot = React.createClass({
@@ -32,8 +32,23 @@ var {AppRegistry, View, Text, TextInput, Image } = React;
var text = "You can see me!";
var longText = "This is such a long text that it needs to go into a new lineThis is such a long text that it needs to go into a new lineThis is such a long text that it needs to go into a new lineThis is such a long text that it needs to go into a new lineThis is such a long text that it needs to go into a new line";
- return {value: text,
- longText: longText};
+ return {
+ value: text,
+ longText: longText,
+ isToggled: false,
+ w: 100,
+ h: 150
+ };
+ },
+
+ onToggle: function(value) {
+ this.setState({isToggled: value});
+ if (value) {
+ this.setState({w: 150, h: 100});
+ }
+ else {
+ this.setState({w: 100, h: 150});
+ }
},
render: function() {
@@ -54,6 +69,8 @@ var {AppRegistry, View, Text, TextInput, Image } = React;
+
+
);
}
diff --git a/ReactWindows/ReactNative/UIManager/NativeViewHierarchyManager.cs b/ReactWindows/ReactNative/UIManager/NativeViewHierarchyManager.cs
index 57243cc172d..e8920b977a1 100644
--- a/ReactWindows/ReactNative/UIManager/NativeViewHierarchyManager.cs
+++ b/ReactWindows/ReactNative/UIManager/NativeViewHierarchyManager.cs
@@ -514,13 +514,12 @@ private void DropView(FrameworkElement view)
var viewManager = default(ViewManager);
if (_tagsToViewManagers.TryGetValue(tag, out viewManager))
{
- var viewGroup = view as Panel;
var viewGroupManager = viewManager as ViewGroupManager;
- if (viewGroup != null && viewGroupManager != null)
+ if (viewGroupManager != null)
{
- for (var i = viewGroupManager.GetChildCount(viewGroup) - 1; i >= 0; --i)
+ for (var i = viewGroupManager.GetChildCount(view) - 1; i >= 0; --i)
{
- var child = viewGroupManager.GetChildAt(viewGroup, i);
+ var child = viewGroupManager.GetChildAt(view, i);
var managedChild = default(FrameworkElement);
if (_tagsToViews.TryGetValue(child.GetTag(), out managedChild))
{
@@ -529,7 +528,7 @@ private void DropView(FrameworkElement view)
}
}
- viewGroupManager.RemoveAllChildren(viewGroup);
+ viewGroupManager.RemoveAllChildren(view);
}
_tagsToViews.Remove(tag);
diff --git a/ReactWindows/ReactNative/UIManager/ViewGroupManager.cs b/ReactWindows/ReactNative/UIManager/ViewGroupManager.cs
index 97b8d97c155..fccbc1df2bc 100644
--- a/ReactWindows/ReactNative/UIManager/ViewGroupManager.cs
+++ b/ReactWindows/ReactNative/UIManager/ViewGroupManager.cs
@@ -1,6 +1,5 @@
using System;
using Windows.UI.Xaml;
-using Windows.UI.Xaml.Controls;
namespace ReactNative.UIManager
{
@@ -9,6 +8,15 @@ namespace ReactNative.UIManager
///
public abstract class ViewGroupManager : ViewManager
{
+ ///
+ /// The instance that represents the type of shadow
+ /// node that this manager will return from
+ /// .
+ ///
+ /// This method will be used in the bridge initialization phase to
+ /// collect properties exposed using the
+ /// annotation from the subclass.
+ ///
public sealed override Type ShadowNodeType
{
get
diff --git a/ReactWindows/ReactNative/UIManager/ViewManager.cs b/ReactWindows/ReactNative/UIManager/ViewManager.cs
index e89c3f65dab..c5f911b1108 100644
--- a/ReactWindows/ReactNative/UIManager/ViewManager.cs
+++ b/ReactWindows/ReactNative/UIManager/ViewManager.cs
@@ -142,6 +142,19 @@ public virtual void OnDropViewInstance(ThemedReactContext reactContext, Framewor
/// The extra data.
public abstract void UpdateExtraData(FrameworkElement root, object extraData);
+ ///
+ /// Implement this method to receive events/commands directly from
+ /// JavaScript through the .
+ ///
+ ///
+ /// The view instance that should receive the command.
+ ///
+ /// Identifer for the command.
+ /// Optional arguments for the command.
+ public virtual void ReceiveCommand(FrameworkElement view, int commandId, JArray args)
+ {
+ }
+
///
/// Creates a new view instance of type .
///
@@ -172,18 +185,5 @@ protected virtual void AddEventEmitters(ThemedReactContext reactContext, Framewo
protected virtual void OnAfterUpdateTransaction(FrameworkElement view)
{
}
-
- ///
- /// Implement this method to receive events/commands directly from
- /// JavaScript through the .
- ///
- ///
- /// The view instance that should receive the command.
- ///
- /// Identifer for the command.
- /// Optional arguments for the command.
- public virtual void ReceiveCommand(FrameworkElement view, int commandId, JArray args)
- {
- }
}
}
diff --git a/ReactWindows/ReactNative/Views/View/ReactViewManager.cs b/ReactWindows/ReactNative/Views/View/ReactViewManager.cs
index 4e7c949448e..d1a9553123d 100644
--- a/ReactWindows/ReactNative/Views/View/ReactViewManager.cs
+++ b/ReactWindows/ReactNative/Views/View/ReactViewManager.cs
@@ -5,6 +5,7 @@
using Windows.UI.Xaml;
using Windows.UI.Xaml.Automation.Peers;
using Windows.UI.Xaml.Automation.Provider;
+using Windows.UI.Xaml.Media;
namespace ReactNative.Views.View
{
@@ -101,7 +102,7 @@ public override void ReceiveCommand(FrameworkElement view, int commandId, JArray
}
///
- /// The border radius of the .
+ /// Sets the border radius of the .
///
/// The view panel.
/// The border radius value.
@@ -111,6 +112,21 @@ public void SetBorderRadius(BorderedContentControl view, double radius)
view.SetBorderRadius(radius);
}
+ ///
+ /// Sets the background color of the .
+ ///
+ /// The view panel.
+ /// The masked color value.
+ [ReactProperty(ViewProperties.BackgroundColor)]
+ public void SetBackgroundColor(BorderedContentControl view, uint? color)
+ {
+ if (color.HasValue)
+ {
+ var panel = GetPanel(view);
+ panel.Background = new SolidColorBrush(ColorHelpers.Parse(color.Value));
+ }
+ }
+
///
/// Sets the elevation transformation effect of the .
///