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

[TM] Add spec for KeyboardObserver #24881

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
[TM] Add spec for KeyboardObserver
  • Loading branch information
ericlewis committed May 16, 2019
commit a8085d311a467523972b8722c751dc35d8a28876
5 changes: 2 additions & 3 deletions Libraries/Components/Keyboard/Keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@
const LayoutAnimation = require('../../LayoutAnimation/LayoutAnimation');
const invariant = require('invariant');
const NativeEventEmitter = require('../../EventEmitter/NativeEventEmitter');
const KeyboardObserver = require('../../BatchedBridge/NativeModules')
.KeyboardObserver;
const dismissKeyboard = require('../../Utilities/dismissKeyboard');
const KeyboardEventEmitter = new NativeEventEmitter(KeyboardObserver);
import NativeKeyboardObserver from './NativeKeyboardObserver';
const KeyboardEventEmitter = new NativeEventEmitter(NativeKeyboardObserver);

export type KeyboardEventName =
| 'keyboardWillShow'
Expand Down
21 changes: 21 additions & 0 deletions Libraries/Components/Keyboard/NativeKeyboardObserver.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @format
*/

'use strict';

import type {TurboModule} from 'RCTExport';
import * as TurboModuleRegistry from 'TurboModuleRegistry';

export interface Spec extends TurboModule {
+addListener: (eventName: string) => void;
+removeListeners: (count: number) => void;
}

export default TurboModuleRegistry.getEnforcing<Spec>('KeyboardObserver');