RCTKeyCommands.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /**
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. #import <UIKit/UIKit.h>
  8. @interface RCTKeyCommands : NSObject
  9. + (instancetype)sharedInstance;
  10. /**
  11. * Register a single-press keyboard command.
  12. */
  13. - (void)registerKeyCommandWithInput:(NSString *)input
  14. modifierFlags:(UIKeyModifierFlags)flags
  15. action:(void (^)(UIKeyCommand *command))block;
  16. /**
  17. * Unregister a single-press keyboard command.
  18. */
  19. - (void)unregisterKeyCommandWithInput:(NSString *)input
  20. modifierFlags:(UIKeyModifierFlags)flags;
  21. /**
  22. * Check if a single-press command is registered.
  23. */
  24. - (BOOL)isKeyCommandRegisteredForInput:(NSString *)input
  25. modifierFlags:(UIKeyModifierFlags)flags;
  26. /**
  27. * Register a double-press keyboard command.
  28. */
  29. - (void)registerDoublePressKeyCommandWithInput:(NSString *)input
  30. modifierFlags:(UIKeyModifierFlags)flags
  31. action:(void (^)(UIKeyCommand *command))block;
  32. /**
  33. * Unregister a double-press keyboard command.
  34. */
  35. - (void)unregisterDoublePressKeyCommandWithInput:(NSString *)input
  36. modifierFlags:(UIKeyModifierFlags)flags;
  37. /**
  38. * Check if a double-press command is registered.
  39. */
  40. - (BOOL)isDoublePressKeyCommandRegisteredForInput:(NSString *)input
  41. modifierFlags:(UIKeyModifierFlags)flags;
  42. @end