Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public Map<String, Object> getExportedCustomBubblingEventTypeConstants() {
MapBuilder.of(
"bubbled", "onSubmitEditing", "captured", "onSubmitEditingCapture")))
.put(
"topEndEditing",
"topEndEditing",
MapBuilder.of(
"phasedRegistrationNames",
MapBuilder.of("bubbled", "onEndEditing", "captured", "onEndEditingCapture")))
Expand Down
3 changes: 2 additions & 1 deletion ReactWindows/ReactNative.Tests/Resources/main.jsbundle

Large diffs are not rendered by default.

17 changes: 10 additions & 7 deletions ReactWindows/ReactNative/ReactNative.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,13 @@
<Compile Include="Common\ReactConstants.cs" />
<Compile Include="Bridge\ReactApplicationContext.cs" />
<Compile Include="CoreModulesPackage.cs" />
<Compile Include="UIManager\Events\IOnIntercepTextGotFocusEventListener.cs" />
<Compile Include="UIManager\Events\IOnInterceptTextInputEventListener.cs" />
<Compile Include="LifecycleState.cs" />
<Compile Include="IReactInstanceManager.cs" />
<Compile Include="Modules\Core\ExceptionsManagerModule.cs" />
<Compile Include="Modules\Core\Timing.cs" />
<Compile Include="Modules\Storage\AsyncStorageModule.cs" />
<Compile Include="Modules\Toast\ToastHelper.cs" />
<Compile Include="Modules\Toast\ToastModule.cs" />
<Compile Include="Modules\WebSocket\WebSocketModule.cs" />
<Compile Include="ReactInstanceManagerImpl.cs" />
<Compile Include="Hosting\JavaScriptBackgroundWorkItemCallback.cs" />
Expand Down Expand Up @@ -248,16 +248,20 @@
<Compile Include="UIManager\ViewManager.cs" />
<Compile Include="UIManager\ViewManager.Generic.cs" />
<Compile Include="UIManager\ViewManagerRegistry.cs" />
<Compile Include="UIManager\ViewManagersPropertyCache.cs" />
<Compile Include="Views\ViewManagersPropertyCache.cs" />
<Compile Include="UIManager\ViewProperties.cs" />
<Compile Include="Touch\ICatalystInterceptingViewGroup.cs" />
<Compile Include="Views\Text\InlineManager.cs" />
<Compile Include="Views\Text\InlineManager.cs" />
<Compile Include="Views\Text\ReactRawTextManager.cs" />
<Compile Include="Views\Text\ReactTextShadowNode.cs" />
<Compile Include="Views\Text\ReactTextViewManager.cs" />
<Compile Include="Views\Text\ReactVirtualTextViewManager.cs" />
<Compile Include="Touch\ICatalystInterceptingViewGroup.cs" />
<Compile Include="Views\TextInput\ReactTextChangedEvent.cs" />
<Compile Include="Views\TextInput\ReactTextInputBlurEvent.cs" />
<Compile Include="Views\TextInput\ReactTextInputFocusEvent.cs" />
<Compile Include="Views\View\ReactPanel.cs" />
<Compile Include="Views\View\ReactViewManager.cs" />
<Compile Include="Views\TextInput\ReactTextInputManager.cs" />
<EmbeddedResource Include="Properties\ReactNative.rd.xml" />
</ItemGroup>
<ItemGroup>
Expand All @@ -274,8 +278,7 @@
<Folder Include="JavaScript\uwp-native\" />
</ItemGroup>
<ItemGroup>
<Reference Include="Facebook.CSSLayout, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Reference Include="Facebook.CSSLayout">
<HintPath>..\References\Facebook.CSSLayout.dll</HintPath>
</Reference>
</ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion ReactWindows/ReactNative/Shell/MainReactPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using ReactNative.Modules.WebSocket;
using ReactNative.UIManager;
using ReactNative.Views.Text;
using ReactNative.Views.TextInput;
using ReactNative.Views.View;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -40,7 +41,7 @@ public IReadOnlyList<ViewManager> CreateViewManagers(
//new RecyclerViewBackedScrollViewManager(),
//new ReactScrollViewManager(),
//new ReactSwitchManager(),
//new ReactTextInputManager(),
new ReactTextInputManager(),
new ReactTextViewManager(),
//new ReactToolbarManager(),
new ReactViewManager(),
Expand Down
18 changes: 15 additions & 3 deletions ReactWindows/ReactNative/UIManager/BaseViewManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,19 +105,31 @@ public void SetTranslationY(TFrameworkElement view, double distance)
transform.TranslateY = distance;
}

private void SetRotationX(TFrameworkElement view, double rotation)
/// <summary>
/// Sets the rotateX property of the <typeparamref name="TFrameworkElement"/>.
/// </summary>
/// <param name="view">The WPF <typeparamref name="TFrameworkElement"/>.</param>
/// <param name="rotation">The rotation degrees</param>
[ReactProperty(PROP_DECOMPOSED_MATRIX_ROTATE_X, DefaultDouble = 1.0)]
public void SetRotationX(TFrameworkElement view, double rotation)
{
var transform = EnsureTransform(view);
transform.RotationX = rotation;
}

private void SetRotationY(TFrameworkElement view, double rotation)
/// <summary>
/// Sets the rotateY property of the <typeparamref name="TFrameworkElement"/>.
/// </summary>
/// <param name="view">The WPF <typeparamref name="TFrameworkElement"/>.</param>
/// <param name="rotation">The rotation degrees</param>
[ReactProperty(PROP_DECOMPOSED_MATRIX_ROTATE_Y, DefaultDouble = 1.0)]
public void SetRotationY(TFrameworkElement view, double rotation)
{
var transform = EnsureTransform(view);
transform.RotationY = rotation;
}

private void SetTransformMatrix(TFrameworkElement view, JObject matrix)
protected void SetTransformMatrix(TFrameworkElement view, JObject matrix)
{
// TODO: eliminate closure in action.
LookupAndDo<double>(matrix, PROP_DECOMPOSED_MATRIX_TRANSLATE_X, value => SetTranslationX(view, value));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

namespace ReactNative.UIManager.Events
{
/// <summary>
/// The interface for defining the methods for receiving and losing <see cref="TextBox"/> control focus.
/// </summary>
public interface IOnIntercepTextFocusEventListener
{
void OnInterceptLostFocusEvent(object sender, RoutedEventArgs @event);

void OnInterceptGotFocusEvent(object sender, RoutedEventArgs @event);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Input;

namespace ReactNative.UIManager.Events
{
public interface IOnInterceptTextInputEventListener
{
/// <summary>
/// Called when a onInterceptTouch is invoked on a view group
/// </summary>
/// <param name="event"> The motion event being dispatched down the hierarchy.</param>
/// <returns>Return true to steal motion event from the children and have the dispatched to this view, or return false to allow motion event to be delivered to children view</returns>
void OnInterceptTextChangeEvent(object sender, TextChangedEventArgs @event);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public sealed override void OnDropViewInstance(ThemedReactContext reactContext,
/// </param>
/// <param name="commandId">Identifer for the command.</param>
/// <param name="args">Optional arguments for the command.</param>
public override void ReceiveCommand(FrameworkElement view, int commandId, JArray args)
public sealed override void ReceiveCommand(FrameworkElement view, int commandId, JArray args)
{
ReceiveCommand((TPanel)view, commandId, args);
}
Expand Down
2 changes: 1 addition & 1 deletion ReactWindows/ReactNative/UIManager/ViewManager.Generic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public override Type ShadowNodeType
/// <see cref="ReactShadowNode"/>.
/// </remarks>
/// <returns>The shadow node instance.</returns>
public override ReactShadowNode CreateShadowNodeInstance()
public sealed override ReactShadowNode CreateShadowNodeInstance()
{
return CreateShadowNodeInstanceCore();
}
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 @@ -10,6 +10,7 @@ namespace ReactNative.UIManager
public static class ViewProperties
{
public const string ViewClassName = "RCTView";
public const string TextInputClassName = "RCTTextField";

// Layout only (only affect positions of children, causes no drawing)
// !!! Keep in sync with s_layoutOnlyProperties below !!!
Expand Down
64 changes: 64 additions & 0 deletions ReactWindows/ReactNative/Views/TextInput/ReactTextChangedEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
using Newtonsoft.Json.Linq;
using ReactNative.UIManager.Events;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ReactNative.Views.TextInput
{
/// <summary>
/// Event emitted by <see cref="TextBox"/> native view when text changes.
/// </summary>
class ReactTextChangedEvent : Event
{
public static readonly String EVENT_NAME = "topChange";
private String _Text;
private double _ContentWidth;
private double _ContentHeight;

public ReactTextChangedEvent(int viewId, string text, double contentSizeWidth,
double contentSizeHeight) : base(viewId, TimeSpan.FromTicks(Environment.TickCount))
{
_Text = text;
_ContentWidth = contentSizeWidth;
_ContentHeight = contentSizeHeight;
}

/// <summary>
/// Gets the name of the Event
/// </summary>
public override string EventName
{
get
{
return EVENT_NAME;
}
}

/// <summary>
/// Push the event up to the event emitter.
/// </summary>
/// <param name="rctEventEmitter">The event emitter to dispatch the event to.</param>
public override void Dispatch(RCTEventEmitter rctEventEmitter)
{
rctEventEmitter.receiveEvent(this.ViewTag, this.EventName, this.GetEventJavascriptProperties);
}

private JObject GetEventJavascriptProperties
{
get
{
return new JObject()
{
{ "width", _ContentWidth },
{ "height", _ContentWidth },
{ "text", _Text },
{ "width", _ContentWidth },
{"target", this.ViewTag }
};
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using Newtonsoft.Json.Linq;
using ReactNative.UIManager.Events;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ReactNative.Views.TextInput
{
/// <summary>
/// Event emitted by <see cref="TextBox"/> native view when the control gains focus.
/// </summary>
class ReactTextInputBlurEvent : Event
{
public static readonly String EVENT_NAME = "topBlur";

public ReactTextInputBlurEvent(int viewId) : base(viewId, TimeSpan.FromTicks(Environment.TickCount))
{
}

/// <summary>
/// Gets the name of the Event
/// </summary>
public override string EventName
{
get
{
return EVENT_NAME;
}
}

/// <summary>
/// Push the event up to the event emitter.
/// </summary>
/// <param name="rctEventEmitter">The event emitter to dispatch the event to.</param>
public override void Dispatch(RCTEventEmitter eventEmitter)
{
eventEmitter.receiveEvent(this.ViewTag, this.EventName, this.GetEventJavascriptProperties);
}

private JObject GetEventJavascriptProperties
{
get
{
return new JObject()
{
{"target", this.ViewTag }
};
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using Newtonsoft.Json.Linq;
using ReactNative.UIManager.Events;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ReactNative.Views.TextInput
{
class ReactTextInputFocusEvent : Event
{
public static readonly String EVENT_NAME = "topFocus";

public ReactTextInputFocusEvent(int viewId) : base(viewId, TimeSpan.FromTicks(Environment.TickCount))
{
}

public override string EventName
{
get
{
return EVENT_NAME;
}
}

/// <summary>
/// Push the on focus event up to the event emitter.
/// </summary>
/// <param name="rctEventEmitter">The event emitter to dispatch the event to.</param>
public override void Dispatch(RCTEventEmitter eventEmitter)
{
eventEmitter.receiveEvent(this.ViewTag, this.EventName, this.GetEventJavascriptProperties);
}

private JObject GetEventJavascriptProperties
{
get
{
return new JObject()
{
{"target", this.ViewTag }
};
}
}
}
}
Loading