Skip to content

Commit

Permalink
refactor: reduce string duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillzyusko committed Feb 11, 2024
1 parent 8b5ea44 commit 7e6e045
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/bindings.native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,16 @@ export const KeyboardController = (
)
) as KeyboardControllerModule;

const KEYBOARD_CONTROLLER_NAMESPACE = "KeyboardController::";
const eventEmitter = new NativeEventEmitter(KeyboardController);

export const KeyboardEvents: KeyboardEventsModule = {
addListener: (name, cb) =>
eventEmitter.addListener("KeyboardController::" + name, cb),
eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb),
};
export const FocusedInputEvents: FocusedInputEventsModule = {
addListener: (name, cb) =>
eventEmitter.addListener("KeyboardController::" + name, cb),
eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb),
};
export const KeyboardControllerView: React.FC<KeyboardControllerProps> =
require("./specs/KeyboardControllerViewNativeComponent").default;
Expand Down

0 comments on commit 7e6e045

Please sign in to comment.