mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-02-09 09:12:06 +08:00
- [ReactNative] Oss RCTSlider | Tadeu Zagallo - [ReactNative] Oss RCTSwitch | Tadeu Zagallo - [ReactNative] Remove ImageSourcePropType | Christopher Chedeau - [ReactNative] s/Image.sourcePropType/Image.propTypes.source/ | Christopher Chedeau - [ReactNative] s/Text.stylePropType/Text.propTypes.style/ | Christopher Chedeau - [ReactNative] s/View.stylePropType/View.propTypes.style/ | Christopher Chedeau - [ReactNative] Remove nativePropTypes | Christopher Chedeau - [ReactNative] Inline ScrollViewPropTypes | Christopher Chedeau - [ReactNative] Unify ScrollView.android and ScrollView.ios | Christopher Chedeau - [ReactNative] Move around and reformat comments for the documentation | Christopher Chedeau - Improved Geolocation API | Nick Lockwood - [React Native] Move copyProperties and mergeHelpers to github dir | Ben Alpert - Fixed some misspellings that are propagating through our code | Skotch Vail - [ReactNative] OSS DatePicker | Spencer Ahrens - [React Native] Update core modules for React 0.13 | Ben Alpert - [React Native] Update React to v0.13.0-rc2 | Ben Alpert - [react-packager] onchange endpoint that informs of changes | Amjad Masad - [react-packager] dev option needs to default to true for backwards compat | Amjad Masad
94 lines
2.7 KiB
Objective-C
94 lines
2.7 KiB
Objective-C
// Copyright 2004-present Facebook. All Rights Reserved.
|
|
|
|
#import <QuartzCore/QuartzCore.h>
|
|
#import <UIKit/UIKit.h>
|
|
|
|
#import "../Layout/Layout.h"
|
|
#import "../Views/RCTAnimationType.h"
|
|
#import "../Views/RCTPointerEvents.h"
|
|
|
|
/**
|
|
* This class provides a collection of conversion functions for mapping
|
|
* JSON objects to native types and classes. These are useful when writing
|
|
* custom RCTViewManager setter methods.
|
|
*/
|
|
@interface RCTConvert : NSObject
|
|
|
|
+ (BOOL)BOOL:(id)json;
|
|
+ (double)double:(id)json;
|
|
+ (float)float:(id)json;
|
|
+ (int)int:(id)json;
|
|
|
|
+ (NSArray *)NSArray:(id)json;
|
|
+ (NSDictionary *)NSDictionary:(id)json;
|
|
+ (NSString *)NSString:(id)json;
|
|
+ (NSNumber *)NSNumber:(id)json;
|
|
+ (NSInteger)NSInteger:(id)json;
|
|
+ (NSUInteger)NSUInteger:(id)json;
|
|
|
|
+ (NSURL *)NSURL:(id)json;
|
|
+ (NSURLRequest *)NSURLRequest:(id)json;
|
|
|
|
+ (NSDate *)NSDate:(id)json;
|
|
+ (NSTimeZone *)NSTimeZone:(id)json;
|
|
+ (NSTimeInterval)NSTimeInterval:(id)json;
|
|
|
|
+ (NSTextAlignment)NSTextAlignment:(id)json;
|
|
+ (NSWritingDirection)NSWritingDirection:(id)json;
|
|
+ (UIKeyboardType)UIKeyboardType:(id)json;
|
|
|
|
+ (CGFloat)CGFloat:(id)json;
|
|
+ (CGPoint)CGPoint:(id)json;
|
|
+ (CGSize)CGSize:(id)json;
|
|
+ (CGRect)CGRect:(id)json;
|
|
+ (UIEdgeInsets)UIEdgeInsets:(id)json;
|
|
|
|
+ (CATransform3D)CATransform3D:(id)json;
|
|
+ (CGAffineTransform)CGAffineTransform:(id)json;
|
|
|
|
+ (UIColor *)UIColor:(id)json;
|
|
+ (CGColorRef)CGColor:(id)json;
|
|
|
|
+ (UIImage *)UIImage:(id)json;
|
|
+ (CGImageRef)CGImage:(id)json;
|
|
|
|
+ (UIFont *)UIFont:(UIFont *)font withSize:(id)json;
|
|
+ (UIFont *)UIFont:(UIFont *)font withWeight:(id)json;
|
|
+ (UIFont *)UIFont:(UIFont *)font withFamily:(id)json;
|
|
+ (UIFont *)UIFont:(UIFont *)font withFamily:(id)json size:(id)json weight:(id)json;
|
|
|
|
+ (BOOL)css_overflow:(id)json;
|
|
+ (css_flex_direction_t)css_flex_direction_t:(id)json;
|
|
+ (css_justify_t)css_justify_t:(id)json;
|
|
+ (css_align_t)css_align_t:(id)json;
|
|
+ (css_position_type_t)css_position_type_t:(id)json;
|
|
+ (css_wrap_type_t)css_wrap_type_t:(id)json;
|
|
|
|
+ (RCTPointerEvents)RCTPointerEvents:(id)json;
|
|
+ (RCTAnimationType)RCTAnimationType:(id)json;
|
|
|
|
@end
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/**
|
|
* This function will attempt to set a property using a json value by first
|
|
* inferring the correct type from all available information, and then
|
|
* applying an appropriate conversion method. If the property does not
|
|
* exist, or the type cannot be inferred, the function will return NO.
|
|
*/
|
|
BOOL RCTSetProperty(id target, NSString *keypath, id json);
|
|
|
|
/**
|
|
* This function attempts to copy a property from the source object to the
|
|
* destination object using KVC. If the property does not exist, or cannot
|
|
* be set, it will do nothing and return NO.
|
|
*/
|
|
BOOL RCTCopyProperty(id target, id source, NSString *keypath);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|