Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue121 2 #140

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,3 @@ node_modules

# OS X
.DS_Store

#JS
*.jsbundle
*.swp
8 changes: 5 additions & 3 deletions ReactWindows/Playground/Resources/main.dev.jsbundle
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,7 @@ typeof global!=='undefined'?global:typeof self!=='undefined'?self:this);
__d('react-xaml-wpf/index.ios.js',function(global, require, module, exports) { 'use strict';

var React=require('react-native/Libraries/react-native/react-native.js');var
AppRegistry=React.AppRegistry;var View=React.View;var Text=React.Text;var Switch=React.Switch;
AppRegistry=React.AppRegistry;var View=React.View;var Text=React.Text;var Switch=React.Switch;var TextInput=React.TextInput;

var ReactRoot=React.createClass({displayName:'ReactRoot',
render:function(){
Expand All @@ -1197,9 +1197,11 @@ React.createElement(View,{elevation:'1.0'},
React.createElement(View,{style:{marginLeft:20}},
React.createElement(View,{style:{borderLeftWidth:5,borderRightWidth:10,borderTopWidth:2, borderBottomWidth: 8}},
React.createElement(View,{style:{margin:10,borderWidth:10,borderRadius:5,borderLeftColor:'red',borderRightColor:'blue',borderTopColor:'yellow',borderBottomColor:'green'}},
React.createElement(View,{style:{padding:10,flexDirection:'column'}},
React.createElement(View,{style:{padding:10,flexDirection:'row'}},
React.createElement(Switch,null),
React.createElement(Text,{style:{color:'orange',flex:1}},"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur sodales ligula in libero. Sed dignissim lacinia nunc. Curabitur tortor. Pellentesque nibh. Aenean quam. In scelerisque sem at dolor. Maecenas mattis. Sed convallis tristique sem. Proin ut ligula vel nunc egestas porttitor. Morbi lectus risus, iaculis vel, suscipit quis, luctus non, massa. Fusce ac turpis quis ligula lacinia aliquet. Mauris ipsum. Nulla metus metus, ullamcorper vel, tincidunt sed, euismod in, nibh. Quisque volutpat condimentum velit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam nec ante. Sed lacinia, urna non tincidunt mattis, tortor neque adipiscing diam, a cursus ipsum ante quis turpis. Nulla facilisi. Ut fringilla. Suspendisse potenti. Nunc feugiat mi a tellus consequat imperdiet. Vestibulum sapien. Proin quam. Etiam ultrices. Suspendisse in justo eu magna luctus suscipit. Sed lectus. Integer euismod lacus luctus magna. Quisque cursus, metus vitae pharetra auctor, sem massa mattis sem, at interdum magna augue eget diam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Morbi lacinia molestie dui. Praesent blandit dolor. Sed non quam. In vel mi sit amet augue congue elementum. Morbi in ipsum sit amet pede facilisis laoreet. Donec lacus nunc, viverra nec.")))))));}});
React.createElement(Text,{style:{color:'orange',flex:1}},"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur sodales ligula in libero. Sed dignissim lacinia nunc. Curabitur tortor. Pellentesque nibh. Aenean quam. In scelerisque sem at dolor. Maecenas mattis. Sed convallis tristique sem. Proin ut ligula vel nunc egestas porttitor. Morbi lectus risus, iaculis vel, suscipit quis, luctus non, massa. Fusce ac turpis quis ligula lacinia aliquet. Mauris ipsum. Nulla metus metus, ullamcorper vel, tincidunt sed, euismod in, nibh. Quisque volutpat condimentum velit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam nec ante. Sed lacinia, urna non tincidunt mattis, tortor neque adipiscing diam, a cursus ipsum ante quis turpis. Nulla facilisi. Ut fringilla. Suspendisse potenti. Nunc feugiat mi a tellus consequat imperdiet. Vestibulum sapien. Proin quam. Etiam ultrices. Suspendisse in justo eu magna luctus suscipit. Sed lectus. Integer euismod lacus luctus magna. Quisque cursus, metus vitae pharetra auctor, sem massa mattis sem, at interdum magna augue eget diam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Morbi lacinia molestie dui. Praesent blandit dolor. Sed non quam. In vel mi sit amet augue congue elementum. Morbi in ipsum sit amet pede facilisis laoreet. Donec lacus nunc, viverra nec.")),
React.createElement(View,null,
React.createElement(TextInput,{style:{height:40,color:'purple',borderWidth:5,borderColor:'purple'}})))))));}});



Expand Down
3 changes: 0 additions & 3 deletions ReactWindows/ReactNative.Tests/ReactNative.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@
<ItemGroup>
<!--A reference to the entire .Net Framework and Windows SDK are automatically included-->
<None Include="project.json" />
<Content Include="Resources\main.jsbundle">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<SDKReference Include="MSTestFramework.Universal, Version=$(UnitTestPlatformVersion)" />
<SDKReference Include="TestPlatform.Universal, Version=$(UnitTestPlatformVersion)" />
</ItemGroup>
Expand Down
20 changes: 0 additions & 20 deletions ReactWindows/ReactNative.Tests/Resources/main.jsbundle

This file was deleted.

6 changes: 5 additions & 1 deletion ReactWindows/ReactNative/ReactNative.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
<Compile Include="ReactPage.cs" />
<Compile Include="ReactRootView.cs" />
<Compile Include="UIManager\BorderedContentControl.cs" />
<Compile Include="UIManager\BorderExtensions.cs" />
<Compile Include="UIManager\ColorHelpers.cs" />
<Compile Include="UIManager\CSSNodeExtensions.cs" />
<Compile Include="UIManager\Events\IOnIntercepTextGotFocusEventListener.cs" />
Expand Down Expand Up @@ -230,6 +231,10 @@
<Compile Include="UIManager\AppRegistry.cs" />
<Compile Include="UIManager\Events\TouchEventType.cs" />
<Compile Include="UIManager\Events\TouchEventTypeExtensions.cs" />
<Compile Include="Views\Image\ReactImageLoadEvent.cs" />
<Compile Include="Views\Image\ReactImageManager.cs" />
<Compile Include="Views\Image\ReactVirtualImageManager.cs" />
<Compile Include="Views\TextInput\ReactMultilineTextInputManager.cs" />
<Compile Include="Views\TextInput\TextBoxExtensions.cs" />
<Compile Include="Views\Text\FontStyleHelpers.cs" />
<Compile Include="UIManager\ReactPointerEventsView.cs" />
Expand Down Expand Up @@ -296,7 +301,6 @@
<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Reference Include="Facebook.CSSLayout">
<HintPath>..\References\Facebook.CSSLayout.dll</HintPath>
Expand Down
7 changes: 4 additions & 3 deletions ReactWindows/ReactNative/Shell/MainReactPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using ReactNative.Modules.Toast;
using ReactNative.Modules.WebSocket;
using ReactNative.UIManager;
using ReactNative.Views.Image;
using ReactNative.Views.Scroll;
using ReactNative.Views.Switch;
using ReactNative.Views.Text;
Expand Down Expand Up @@ -48,15 +49,15 @@ public IReadOnlyList<ViewManager> CreateViewManagers(
{
//new ReactDrawerLayoutManager(),
//new ReactHorizontalScrollViewManager(),
//new ReactImageManager(),
//new ReactProgressBarViewManager(),
new ReactImageManager(),
new ReactVirtualImageManager(),
new ReactRawTextManager(),
//new RecyclerViewBackedScrollViewManager(),
new ReactScrollViewManager(),
new ReactSwitchManager(),
new ReactTextInputManager(),
new ReactTextViewManager(),
//new ReactToolbarManager(),
new ReactMultilineTextInputManager(),
new ReactViewManager(),
//new ReactViewPagerManager(),
//new ReactTextInlineImageViewManager(),
Expand Down
34 changes: 34 additions & 0 deletions ReactWindows/ReactNative/UIManager/BorderExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using Facebook.CSSLayout;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

namespace ReactNative.UIManager
{
static class BorderExtensions
{
public static void SetBorderWidth(this Border border, CSSSpacingType kind, double width)
{
var thickness = border.BorderThickness;
switch (kind)
{
case CSSSpacingType.Left:
thickness.Left = width;
break;
case CSSSpacingType.Top:
thickness.Top = width;
break;
case CSSSpacingType.Right:
thickness.Right = width;
break;
case CSSSpacingType.Bottom:
thickness.Bottom = width;
break;
case CSSSpacingType.All:
thickness = new Thickness(width);
break;
}

border.BorderThickness = thickness;
}
}
}
23 changes: 2 additions & 21 deletions ReactWindows/ReactNative/UIManager/BorderedContentControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,26 +103,7 @@ public void SetBorderWidth(CSSSpacingType kind, double width)

if (_customBorder != null)
{
var thickness = _customBorder.BorderThickness;
switch (kind)
{
case CSSSpacingType.Left:
thickness.Left = width;
break;
case CSSSpacingType.Top:
thickness.Top = width;
break;
case CSSSpacingType.Right:
thickness.Right = width;
break;
case CSSSpacingType.Bottom:
thickness.Bottom = width;
break;
case CSSSpacingType.All:
thickness = new Thickness(width);
break;
}
_customBorder.BorderThickness = thickness;
_customBorder.SetBorderWidth(kind, width);
}
else
{
Expand Down Expand Up @@ -241,7 +222,7 @@ private void EnsureBorder()
{
return;
}

var inner = Content;
base.Content = null;
_customBorder = new Border();
Expand Down
2 changes: 1 addition & 1 deletion ReactWindows/ReactNative/UIManager/LayoutShadowNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ private static T Parse<T>(string value, string paramName)
e => e));

var result = default(object);
if (!lookup.TryGetValue(value.ToLowerInvariant(), out result))
if (!lookup.TryGetValue(value.ToLowerInvariant().Replace("-", ""), out result))
{
throw new ArgumentOutOfRangeException(
paramName,
Expand Down
1 change: 1 addition & 0 deletions ReactWindows/ReactNative/UIManager/ViewProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public static class ViewProperties

public const string BorderWidth = "borderWidth";
public const string BorderLeftWidth = "borderLeftWidth";
public const string BorderColor = "borderColor";
public const string BorderTopWidth = "borderTopWidth";
public const string BorderRightWidth = "borderRightWidth";
public const string BorderBottomWidth = "borderBottomWidth";
Expand Down
80 changes: 80 additions & 0 deletions ReactWindows/ReactNative/Views/Image/ReactImageLoadEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
using ReactNative.UIManager.Events;
using System;
using System.Globalization;

namespace ReactNative.Views.Image
{
/// <summary>
/// Event class for all image loading related events.
/// </summary>
public class ReactImageLoadEvent : Event
{
public const int OnError = 1;
public const int OnLoad = 2;
public const int OnLoadEnd = 3;
public const int OnLoadStart = 4;
public const int OnProgress = 5;

private readonly int _eventType;

/// <summary>
/// Instantiates a <see cref="ReactImageLoadEvent"/>.
/// </summary>
/// <param name="viewId">The view identifier.</param>
/// <param name="eventType">The event identifier.</param>
public ReactImageLoadEvent(int viewId, int eventType)
: base(viewId, TimeSpan.FromTicks(Environment.TickCount))
{
_eventType = eventType;
}

/// <summary>
/// The name of the event.
/// </summary>
public override string EventName
{
get
{
switch (_eventType)
{
case OnError:
return "topError";
case OnLoad:
return "topLoad";
case OnLoadEnd:
return "topLoadEnd";
case OnLoadStart:
return "topLoadStart";
case OnProgress:
return "topProgress";
default:
throw new InvalidOperationException(
string.Format(
CultureInfo.InvariantCulture,
"Invalid image event '{0}'.",
_eventType));
}
}
}

/// <summary>
/// The coalescing key for the event.
/// </summary>
public override short CoalescingKey
{
get
{
return (short)_eventType;
}
}

/// <summary>
/// Dispatches the event.
/// </summary>
/// <param name="eventEmitter">The event emitter.</param>
public override void Dispatch(RCTEventEmitter eventEmitter)
{
eventEmitter.receiveEvent(ViewTag, EventName, null);
}
}
}
Loading