react-native-navigation的迁移库

ColorParser.m 371B

12345678910111213141516
  1. #import "ColorParser.h"
  2. #import "NullColor.h"
  3. #import "NoColor.h"
  4. #import <React/RCTConvert.h>
  5. @implementation ColorParser
  6. + (Color *)parse:(NSDictionary *)json key:(NSString *)key {
  7. if (json[key]) {
  8. return [json[key] isKindOfClass:[NSNumber class]] ? [[Color alloc] initWithValue:[RCTConvert UIColor:json[key]]] : [NoColor new];
  9. }
  10. return [NullColor new];
  11. }
  12. @end