RCTKeyCommands.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 modifierFlags:(UIKeyModifierFlags)flags;
  20. /**
  21. * Check if a single-press command is registered.
  22. */
  23. - (BOOL)isKeyCommandRegisteredForInput:(NSString *)input modifierFlags:(UIKeyModifierFlags)flags;
  24. /**
  25. * Register a double-press keyboard command.
  26. */
  27. - (void)registerDoublePressKeyCommandWithInput:(NSString *)input
  28. modifierFlags:(UIKeyModifierFlags)flags
  29. action:(void (^)(UIKeyCommand *command))block;
  30. /**
  31. * Unregister a double-press keyboard command.
  32. */
  33. - (void)unregisterDoublePressKeyCommandWithInput:(NSString *)input modifierFlags:(UIKeyModifierFlags)flags;
  34. /**
  35. * Check if a double-press command is registered.
  36. */
  37. - (BOOL)isDoublePressKeyCommandRegisteredForInput:(NSString *)input modifierFlags:(UIKeyModifierFlags)flags;
  38. @end