Fix ios/objective-c types and errors/red boxes.

This commit is contained in:
Mikael Sand
2017-08-11 02:27:33 +03:00
parent f32800bfbd
commit f3cd34f2e1
10 changed files with 72 additions and 56 deletions
+1 -1
View File
@@ -13,7 +13,7 @@
@interface RNSVGGlyphContext : NSObject
- (instancetype)initWithDimensions:(CGFloat)width height:(CGFloat)height;
- (void)pushContext:(NSDictionary *)font deltaX:(NSArray<NSNumber *> *)deltaX deltaY:(NSArray<NSNumber *> *)deltaY positionX:(NSString *)positionX positionY:(NSString *)positionY;
- (void)pushContext:(NSDictionary *)font deltaX:(NSArray<NSString *> *)deltaX deltaY:(NSArray<NSString *> *)deltaY positionX:(NSArray<NSString *> *)positionX positionY:(NSArray<NSString *> *)positionY;
- (void)popContext;
- (CTFontRef)getGlyphFont;
- (CGPoint)getNextGlyphPoint:(CGPoint)offset glyphWidth:(CGFloat)glyphWidth;
+6 -4
View File
@@ -38,16 +38,16 @@
return self;
}
- (void)pushContext:(NSDictionary *)font deltaX:(NSArray<NSNumber *> *)deltaX deltaY:(NSArray<NSNumber *> *)deltaY positionX:(NSString *)positionX positionY:(NSString *)positionY
- (void)pushContext:(NSDictionary *)font deltaX:(NSArray<NSString *> *)deltaX deltaY:(NSArray<NSString *> *)deltaY positionX:(NSArray<NSString *> *)positionX positionY:(NSArray<NSString *> *)positionY
{
CGPoint location = _currentLocation;
if (positionX) {
location.x = [RNSVGPercentageConverter stringToFloat:positionX relative:_width offset:0];
location.x = [RNSVGPercentageConverter stringToFloat:[positionX firstObject] relative:_width offset:0];
}
if (positionY) {
location.y = [RNSVGPercentageConverter stringToFloat:positionY relative:_height offset:0];
location.y = [RNSVGPercentageConverter stringToFloat:[positionY firstObject] relative:_height offset:0];
}
[_locationContext addObject:[NSValue valueWithCGPoint:location]];
@@ -127,6 +127,8 @@
NSNumber *fontSize;
NSString *fontWeight;
NSString *fontStyle;
NSNumberFormatter *f = [[NSNumberFormatter alloc] init];
f.numberStyle = NSNumberFormatterDecimalStyle;
for (NSDictionary *font in [_fontContext reverseObjectEnumerator]) {
if (!fontFamily) {
@@ -134,7 +136,7 @@
}
if (fontSize == nil) {
fontSize = font[@"fontSize"];
fontSize = [f numberFromString:font[@"fontSize"]];
}
if (!fontWeight) {
+4 -4
View File
@@ -14,10 +14,10 @@
@interface RNSVGText : RNSVGGroup
@property (nonatomic, assign) RNSVGTextAnchor textAnchor;
@property (nonatomic, strong) NSArray<NSNumber *> *deltaX;
@property (nonatomic, strong) NSArray<NSNumber *> *deltaY;
@property (nonatomic, strong) NSString *positionX;
@property (nonatomic, strong) NSString *positionY;
@property (nonatomic, strong) NSArray<NSString *> *deltaX;
@property (nonatomic, strong) NSArray<NSString *> *deltaY;
@property (nonatomic, strong) NSArray<NSString *> *positionX;
@property (nonatomic, strong) NSArray<NSString *> *positionY;
@property (nonatomic, strong) NSDictionary *font;
- (RNSVGText *)getTextRoot;