public void RCTEventEmitter_InvokeTests()
        {
            var module = new RCTEventEmitter();

            var name = default(string);
            var args = default(object[]);
            module.InvocationHandler = new MockInvocationHandler((n, a) =>
            {
                name = n;
                args = a;
            });

            var targetTag = 42;
            var eventName = "foo";
            var @event = new JObject();
            module.receiveEvent(targetTag, eventName, @event);
            Assert.AreEqual(nameof(RCTEventEmitter.receiveEvent), name);
            Assert.AreEqual(3, args.Length);
            Assert.AreEqual(targetTag, args[0]);
            Assert.AreSame(eventName, args[1]);
            Assert.AreSame(@event, args[2]);

            var touches = new JArray();
            var changedIndices = new JArray();
            module.receiveTouches(eventName, touches, changedIndices);
            Assert.AreEqual(nameof(RCTEventEmitter.receiveTouches), name);
            Assert.AreEqual(3, args.Length);
            Assert.AreSame(eventName, args[0]);
            Assert.AreSame(touches, args[1]);
            Assert.AreSame(changedIndices, args[2]);
        }
        public override void Dispatch(RCTEventEmitter eventEmitter)
        {
            var eventData = new JObject
            {
                { "target", ViewTag },
                { "value", this.newValue }
            };

            eventEmitter.receiveEvent(ViewTag, EventName, eventData);
        }
        public override void Dispatch(RCTEventEmitter eventEmitter)
        {
            var eventData = new JObject
            {
                { "target", ViewTag },
                { "text", _text },
            };

            eventEmitter.receiveEvent(ViewTag, EventName, eventData);
        }
        /// <summary>
        /// Called when the host receives the resume event.
        /// </summary>
        public void OnResume()
        {
            DispatcherHelpers.AssertOnDispatcher();

            if (_rctEventEmitter == null)
            {
                _rctEventEmitter = _reactContext.GetJavaScriptModule <RCTEventEmitter>();
            }

            CompositionTarget.Rendering += ScheduleDispatch;
        }
        public override void Dispatch(RCTEventEmitter eventEmitter)
        {
            var eventData = new JObject
            {
                { "target", ViewTag },
                { "code", _code },
                { "description", _description },
            };

            eventEmitter.receiveEvent(ViewTag, EventName, eventData);
        }
        public override void Dispatch(RCTEventEmitter eventEmitter)
        {
            var eventData = new JObject
            {
                { "target", ViewTag },
                { "key", _key },
                { "keyCode", _keyCode },
                { "shiftKey", _shiftKey },
                { "altKey", _altKey },
                { "ctrlKey", _ctrlKey },
            };

            eventEmitter.receiveEvent(ViewTag, EventName, eventData);
        }
        public override void Dispatch(RCTEventEmitter eventEmitter)
        {
            var selectionData = new JObject
            {
                { "start", _start },
                { "end", _end },
            };

            var eventData = new JObject
            {
                { "selection", selectionData },
            };

            eventEmitter.receiveEvent(ViewTag, EventName, eventData);
        }
        public override void Dispatch(RCTEventEmitter eventEmitter)
        {
            var eventArgs = new JObject
            {
                { "target", ViewTag },
                {
                    "layout",
                    new JObject
                    {
                        { "x", _x },
                        { "y", _y },
                        { "width", _width },
                        { "height", _height },
                    }
                },
            };

            eventEmitter.receiveEvent(ViewTag, EventName, eventArgs);
        }
 public override void Dispatch(RCTEventEmitter eventEmitter)
 {
     eventEmitter.receiveEvent(ViewTag, EventName, new JObject());
 }
 public override void Dispatch(RCTEventEmitter eventEmitter)
 {
     eventEmitter.receiveEvent(ViewTag, EventName, _eventArgs);
 }
Esempio n. 11
0
 /// <summary>
 /// Dispatch this event to JavaScript using the given event emitter.
 /// </summary>
 /// <param name="eventEmitter">The event emitter.</param>
 public abstract void Dispatch(RCTEventEmitter eventEmitter);
Esempio n. 12
0
 /// <summary>
 /// Dispatch this event to JavaScript using the given event emitter.
 /// </summary>
 /// <param name="eventEmitter">The event emitter.</param>
 public abstract void Dispatch(RCTEventEmitter eventEmitter);