diff --git a/ReactWindows/ReactNative.Net46/Modules/Storage/AsyncStorageModule.cs b/ReactWindows/ReactNative.Net46/Modules/Storage/AsyncStorageModule.cs index 88d3be68829..d091455e006 100644 --- a/ReactWindows/ReactNative.Net46/Modules/Storage/AsyncStorageModule.cs +++ b/ReactWindows/ReactNative.Net46/Modules/Storage/AsyncStorageModule.cs @@ -361,6 +361,5 @@ private async Task GetAsyncStorageFolder(bool createIfNotExists) return null; } - } } diff --git a/ReactWindows/ReactNative.Net46/Views/Image/ReactImageManager.cs b/ReactWindows/ReactNative.Net46/Views/Image/ReactImageManager.cs index 672c802fa44..2487a4f27bd 100644 --- a/ReactWindows/ReactNative.Net46/Views/Image/ReactImageManager.cs +++ b/ReactWindows/ReactNative.Net46/Views/Image/ReactImageManager.cs @@ -274,7 +274,7 @@ private void OnImageStatusUpdate(Border view, ImageStatusEventData status) /// /// The image view instance. /// The source URI. - private async void SetUriFromSingleSource(Border view, string source) + private void SetUriFromSingleSource(Border view, string source) { var imageBrush = (ImageBrush)view.Background; var tag = view.GetTag(); diff --git a/ReactWindows/ReactNative.Net46/Views/Web/ReactWebViewManager.cs b/ReactWindows/ReactNative.Net46/Views/Web/ReactWebViewManager.cs index ea7803e4c97..4294a4d733a 100644 --- a/ReactWindows/ReactNative.Net46/Views/Web/ReactWebViewManager.cs +++ b/ReactWindows/ReactNative.Net46/Views/Web/ReactWebViewManager.cs @@ -90,7 +90,7 @@ public void SetInjectedJavaScript(WebBrowser view, string injectedJavaScript) /// A webview instance. /// A source for the webview (either static html or an uri). [ReactProp("source")] - public async void SetSource(WebBrowser view, JObject source) + public void SetSource(WebBrowser view, JObject source) { if (source != null) { @@ -169,7 +169,7 @@ public override void OnDropViewInstance(ThemedReactContext reactContext, WebBrow } /// - /// Creates a new view instance of type . + /// Creates a new view instance of type . /// /// The React context. /// The view instance. diff --git a/ReactWindows/ReactNative.Shared/Chakra/Executor/ChakraJavaScriptExecutor.cs b/ReactWindows/ReactNative.Shared/Chakra/Executor/ChakraJavaScriptExecutor.cs index 56a8431cffa..47ac4811227 100644 --- a/ReactWindows/ReactNative.Shared/Chakra/Executor/ChakraJavaScriptExecutor.cs +++ b/ReactWindows/ReactNative.Shared/Chakra/Executor/ChakraJavaScriptExecutor.cs @@ -135,7 +135,7 @@ public void RunScript(string script, string sourceUrl) if (sourceUrl == null) throw new ArgumentNullException(nameof(sourceUrl)); - string source = LoadScriptAsync(script).Result; + var source = LoadScriptAsync(script).Result; try { diff --git a/ReactWindows/ReactNative.Shared/UIManager/ColorHelpers.cs b/ReactWindows/ReactNative.Shared/UIManager/ColorHelpers.cs index 8387f0e0b16..6e05fcb2493 100644 --- a/ReactWindows/ReactNative.Shared/UIManager/ColorHelpers.cs +++ b/ReactWindows/ReactNative.Shared/UIManager/ColorHelpers.cs @@ -6,10 +6,21 @@ namespace ReactNative.UIManager { + /// + /// Helper class for parsing color values. + /// public static class ColorHelpers { + /// + /// Unsigned integer representation of transparent color. + /// public const uint Transparent = 0x00FFFFFF; + /// + /// Parses a color from an unsigned integer. + /// + /// The unsigned integer color value. + /// The parsed color value. public static Color Parse(uint value) { var color = value; diff --git a/ReactWindows/ReactNative.Shared/UIManager/ReactShadowNode.cs b/ReactWindows/ReactNative.Shared/UIManager/ReactShadowNode.cs index 1aa262194a8..4c6130569db 100644 --- a/ReactWindows/ReactNative.Shared/UIManager/ReactShadowNode.cs +++ b/ReactWindows/ReactNative.Shared/UIManager/ReactShadowNode.cs @@ -519,7 +519,40 @@ public MeasureFunction MeasureFunction /// The margin. public void SetMargin(int spacingType, float margin) { - _yogaNode.SetMargin((YogaEdge)spacingType, margin); + var yogaEdge = (YogaEdge)spacingType; + switch (yogaEdge) + { + case YogaEdge.Left: + _yogaNode.MarginLeft = margin; + break; + case YogaEdge.Top: + _yogaNode.MarginTop = margin; + break; + case YogaEdge.Right: + _yogaNode.MarginRight = margin; + break; + case YogaEdge.Bottom: + _yogaNode.MarginBottom = margin; + break; + case YogaEdge.Start: + _yogaNode.MarginStart = margin; + break; + case YogaEdge.End: + _yogaNode.MarginEnd = margin; + break; + case YogaEdge.Horizontal: + _yogaNode.MarginHorizontal = margin; + break; + case YogaEdge.Vertical: + _yogaNode.MarginVertical = margin; + break; + case YogaEdge.All: + _yogaNode.Margin = margin; + break; + default: + throw new NotSupportedException( + Invariant($"Unsupported margin type '{yogaEdge}'.")); + } } /// @@ -529,7 +562,31 @@ public void SetMargin(int spacingType, float margin) /// The padding. public float GetPadding(int spacingType) { - return _yogaNode.GetPadding((YogaEdge)spacingType).Value; + var yogaEdge = (YogaEdge)spacingType; + switch (yogaEdge) + { + case YogaEdge.Left: + return _yogaNode.PaddingLeft.Value; + case YogaEdge.Top: + return _yogaNode.PaddingTop.Value; + case YogaEdge.Right: + return _yogaNode.PaddingRight.Value; + case YogaEdge.Bottom: + return _yogaNode.PaddingBottom.Value; + case YogaEdge.Start: + return _yogaNode.PaddingStart.Value; + case YogaEdge.End: + return _yogaNode.PaddingEnd.Value; + case YogaEdge.Horizontal: + return _yogaNode.PaddingHorizontal.Value; + case YogaEdge.Vertical: + return _yogaNode.PaddingVertical.Value; + case YogaEdge.All: + return _yogaNode.Padding.Value; + default: + throw new NotSupportedException( + Invariant($"Unsupported padding type '{yogaEdge}'.")); + } } /// @@ -560,7 +617,27 @@ public void SetPadding(int spacingType, float padding) /// The spacing type. public float GetBorder(int spacingType) { - return _yogaNode.GetBorder((YogaEdge)spacingType); + var yogaEdge = (YogaEdge)spacingType; + switch (yogaEdge) + { + case YogaEdge.Left: + return _yogaNode.BorderLeftWidth; + case YogaEdge.Top: + return _yogaNode.BorderTopWidth; + case YogaEdge.Right: + return _yogaNode.BorderRightWidth; + case YogaEdge.Bottom: + return _yogaNode.BorderBottomWidth; + case YogaEdge.Start: + return _yogaNode.BorderStartWidth; + case YogaEdge.End: + return _yogaNode.BorderEndWidth; + case YogaEdge.All: + return _yogaNode.BorderWidth; + default: + throw new NotSupportedException( + Invariant($"Unsupported border type '{yogaEdge}'.")); + } } /// @@ -570,7 +647,34 @@ public float GetBorder(int spacingType) /// The border width. public void SetBorder(int spacingType, float borderWidth) { - _yogaNode.SetBorder((YogaEdge)spacingType, borderWidth); + var yogaEdge = (YogaEdge)spacingType; + switch (yogaEdge) + { + case YogaEdge.Left: + _yogaNode.BorderLeftWidth = borderWidth; + break; + case YogaEdge.Top: + _yogaNode.BorderTopWidth = borderWidth; + break; + case YogaEdge.Right: + _yogaNode.BorderRightWidth = borderWidth; + break; + case YogaEdge.Bottom: + _yogaNode.BorderBottomWidth = borderWidth; + break; + case YogaEdge.Start: + _yogaNode.BorderStartWidth = borderWidth; + break; + case YogaEdge.End: + _yogaNode.BorderEndWidth = borderWidth; + break; + case YogaEdge.All: + _yogaNode.BorderWidth = borderWidth; + break; + default: + throw new NotSupportedException( + Invariant($"Unsupported border type '{yogaEdge}'.")); + } } /// @@ -580,7 +684,31 @@ public void SetBorder(int spacingType, float borderWidth) /// The position. public void SetPosition(int spacingType, float position) { - _yogaNode.SetPosition((YogaEdge)spacingType, position); + var yogaEdge = (YogaEdge)spacingType; + switch (yogaEdge) + { + case YogaEdge.Left: + _yogaNode.Left = position; + break; + case YogaEdge.Top: + _yogaNode.Top = position; + break; + case YogaEdge.Right: + _yogaNode.Right = position; + break; + case YogaEdge.Bottom: + _yogaNode.Bottom = position; + break; + case YogaEdge.Start: + _yogaNode.Start = position; + break; + case YogaEdge.End: + _yogaNode.End = position; + break; + default: + throw new NotSupportedException( + Invariant($"Unsupported position type '{yogaEdge}'.")); + } } /// @@ -1016,11 +1144,11 @@ private void UpdatePadding() YogaConstants.IsUndefined(_padding.GetRaw(EdgeSpacing.Horizontal)) && YogaConstants.IsUndefined(_padding.GetRaw(EdgeSpacing.All))) { - _yogaNode.SetPadding((YogaEdge)spacingType, _defaultPadding.GetRaw(spacingType)); + SetPadding(_yogaNode, spacingType, _defaultPadding.GetRaw(spacingType)); } else { - _yogaNode.SetPadding((YogaEdge)spacingType, _padding.GetRaw(spacingType)); + SetPadding(_yogaNode, spacingType, _padding.GetRaw(spacingType)); } } else if (spacingType == EdgeSpacing.Top || spacingType == EdgeSpacing.Bottom) @@ -1029,25 +1157,63 @@ private void UpdatePadding() YogaConstants.IsUndefined(_padding.GetRaw(EdgeSpacing.Vertical)) && YogaConstants.IsUndefined(_padding.GetRaw(EdgeSpacing.All))) { - _yogaNode.SetPadding((YogaEdge)spacingType, _defaultPadding.GetRaw(spacingType)); + SetPadding(_yogaNode, spacingType, _defaultPadding.GetRaw(spacingType)); } else { - _yogaNode.SetPadding((YogaEdge)spacingType, _padding.GetRaw(spacingType)); + SetPadding(_yogaNode, spacingType, _padding.GetRaw(spacingType)); } } else { if (YogaConstants.IsUndefined(_padding.GetRaw(spacingType))) { - _yogaNode.SetPadding((YogaEdge)spacingType, _defaultPadding.GetRaw(spacingType)); + SetPadding(_yogaNode, spacingType, _defaultPadding.GetRaw(spacingType)); } else { - _yogaNode.SetPadding((YogaEdge)spacingType, _padding.GetRaw(spacingType)); + SetPadding(_yogaNode, spacingType, _padding.GetRaw(spacingType)); } } } } + + private void SetPadding(YogaNode node, int spacingType, float padding) + { + var yogaEdge = (YogaEdge)spacingType; + switch (yogaEdge) + { + case YogaEdge.Left: + node.PaddingLeft = padding; + break; + case YogaEdge.Top: + node.PaddingTop = padding; + break; + case YogaEdge.Right: + node.PaddingRight = padding; + break; + case YogaEdge.Bottom: + node.PaddingBottom = padding; + break; + case YogaEdge.Start: + node.PaddingStart = padding; + break; + case YogaEdge.End: + node.PaddingEnd = padding; + break; + case YogaEdge.Horizontal: + node.PaddingHorizontal = padding; + break; + case YogaEdge.Vertical: + node.PaddingHorizontal = padding; + break; + case YogaEdge.All: + node.Padding = padding; + break; + default: + throw new NotSupportedException( + Invariant($"Unsupported padding type '{yogaEdge}'.")); + } + } } } diff --git a/ReactWindows/ReactNative.Shared/UIManager/ViewProps.cs b/ReactWindows/ReactNative.Shared/UIManager/ViewProps.cs index bce624c5164..2bbdff5b7b2 100644 --- a/ReactWindows/ReactNative.Shared/UIManager/ViewProps.cs +++ b/ReactWindows/ReactNative.Shared/UIManager/ViewProps.cs @@ -116,6 +116,9 @@ public static class ViewProps EdgeSpacing.Bottom, }; + /// + /// Ordered list of position spacing types. + /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes", Justification = "IReadOnlyList is immutable.")] public static readonly IReadOnlyList PositionSpacingTypes = new List