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 8#import "RNCPickerManager.h" 9#import "RNCPicker.h" 10 11#import <React/RCTBridge.h> 12#import <React/RCTFont.h> 13 14@implementation RNCPickerManager 15 16RCT_EXPORT_MODULE() 17 18- (UIView *)view 19{ 20 return [RNCPicker new]; 21} 22 23RCT_EXPORT_VIEW_PROPERTY(items, NSArray<NSDictionary *>) 24RCT_EXPORT_VIEW_PROPERTY(selectedIndex, NSInteger) 25RCT_EXPORT_VIEW_PROPERTY(selectionColor, NSInteger) 26RCT_EXPORT_VIEW_PROPERTY(onChange, RCTBubblingEventBlock) 27RCT_EXPORT_VIEW_PROPERTY(color, UIColor) 28RCT_EXPORT_VIEW_PROPERTY(textAlign, NSTextAlignment) 29RCT_EXPORT_VIEW_PROPERTY(numberOfLines, NSInteger) 30RCT_CUSTOM_VIEW_PROPERTY(fontSize, NSNumber, RNCPicker) 31{ 32 view.font = [RCTFont updateFont:view.font withSize:json ?: @(defaultView.font.pointSize)]; 33} 34RCT_CUSTOM_VIEW_PROPERTY(fontWeight, NSString, __unused RNCPicker) 35{ 36 view.font = [RCTFont updateFont:view.font withWeight:json]; // defaults to normal 37} 38RCT_CUSTOM_VIEW_PROPERTY(fontStyle, NSString, __unused RNCPicker) 39{ 40 view.font = [RCTFont updateFont:view.font withStyle:json]; // defaults to normal 41} 42RCT_CUSTOM_VIEW_PROPERTY(fontFamily, NSString, RNCPicker) 43{ 44 view.font = [RCTFont updateFont:view.font withFamily:json ?: defaultView.font.familyName]; 45} 46RCT_CUSTOM_VIEW_PROPERTY(themeVariant, NSString, RNCPicker) 47{ 48 if (@available(iOS 13.4, *)) { 49 if (json) { 50 if ([json isEqual:@"dark"]) 51 view.overrideUserInterfaceStyle = UIUserInterfaceStyleDark; 52 else if ([json isEqual:@"light"]) 53 view.overrideUserInterfaceStyle = UIUserInterfaceStyleLight; 54 else 55 view.overrideUserInterfaceStyle = UIUserInterfaceStyleUnspecified; 56 } 57 } 58} 59 60@end 61