RCTConvert+Text.m 960 B

1234567891011121314151617181920212223242526272829303132333435
  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 <React/RCTConvert+Text.h>
  8. @implementation RCTConvert (Text)
  9. + (UITextAutocorrectionType)UITextAutocorrectionType:(id)json
  10. {
  11. return
  12. json == nil ? UITextAutocorrectionTypeDefault :
  13. [RCTConvert BOOL:json] ? UITextAutocorrectionTypeYes :
  14. UITextAutocorrectionTypeNo;
  15. }
  16. + (UITextSpellCheckingType)UITextSpellCheckingType:(id)json
  17. {
  18. return
  19. json == nil ? UITextSpellCheckingTypeDefault :
  20. [RCTConvert BOOL:json] ? UITextSpellCheckingTypeYes :
  21. UITextSpellCheckingTypeNo;
  22. }
  23. RCT_ENUM_CONVERTER(RCTTextTransform, (@{
  24. @"none": @(RCTTextTransformNone),
  25. @"capitalize": @(RCTTextTransformCapitalize),
  26. @"uppercase": @(RCTTextTransformUppercase),
  27. @"lowercase": @(RCTTextTransformLowercase),
  28. }), RCTTextTransformUndefined, integerValue)
  29. @end