Browse Source

interaction

Daniel Zlotin 6 years ago
parent
commit
c1cbcd1c8d
2 changed files with 16 additions and 0 deletions
  1. 12
    0
      lib/src/events/EventsRegistry.test.ts
  2. 4
    0
      lib/src/events/EventsRegistry.ts

+ 12
- 0
lib/src/events/EventsRegistry.test.ts View File

@@ -45,4 +45,16 @@ describe('EventsRegistry', () => {
45 45
     expect(mockNativeEventsReceiver.registerComponentDidDisappear).toHaveBeenCalledTimes(1);
46 46
     expect(mockNativeEventsReceiver.registerComponentDidDisappear).toHaveBeenCalledWith(cb);
47 47
   });
48
+
49
+  it('exposes interaction event', () => {
50
+    const subscription = {};
51
+    const cb = jest.fn();
52
+    mockNativeEventsReceiver.registerInteraction.mockReturnValueOnce(subscription);
53
+
54
+    const result = uut.interaction(cb);
55
+
56
+    expect(result).toBe(subscription);
57
+    expect(mockNativeEventsReceiver.registerInteraction).toHaveBeenCalledTimes(1);
58
+    expect(mockNativeEventsReceiver.registerInteraction).toHaveBeenCalledWith(cb);
59
+  });
48 60
 });

+ 4
- 0
lib/src/events/EventsRegistry.ts View File

@@ -18,4 +18,8 @@ export class EventsRegistry {
18 18
   public componentDidDisappear(callback): EventSubscription {
19 19
     return this.nativeEventsReceiver.registerComponentDidDisappear(callback);
20 20
   }
21
+
22
+  public interaction(callback): EventSubscription {
23
+    return this.nativeEventsReceiver.registerInteraction(callback);
24
+  }
21 25
 }