-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue1176 improve ios marker performance by X100 #1187
Merged
christopherdro
merged 6 commits into
react-native-maps:master
from
ericapply:issue1176-ios-marker-performance
Aug 15, 2017
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a9ec71b
Issue1176 attempt to fix UI lag success by re-using UIImage
bosung90 e7884eb
Now use NSMutableDictionary instead of single UIImage
bosung90 748e7a5
appearAnimation happen at init rather than setIcon
bosung90 d6e86de
Init NSMutableDictionary
bosung90 9dbcadd
Merge commit 'ca7eee1b59182ea02fd0f92b1cbbdc9bff7b9b8c' into issue117…
bosung90 b871662
Remove reference to other app
bosung90 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// | ||
// GlobalVars.h | ||
// EvoApp | ||
// | ||
// Created by Eric Kim on 2017-04-04. | ||
// Copyright © 2017 Facebook. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import <UIKit/UIKit.h> | ||
|
||
@interface GlobalVars : NSObject | ||
{ | ||
NSMutableDictionary *dict; | ||
} | ||
|
||
+ (GlobalVars *)sharedInstance; | ||
|
||
- (UIImage *)getSharedUIImage:(NSString *)imageSrc; | ||
|
||
@property(strong, nonatomic, readwrite) NSMutableDictionary *dict; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// | ||
// GlobalVars.m | ||
// EvoApp | ||
// | ||
// Created by Eric Kim on 2017-04-04. | ||
// Copyright © 2017 Facebook. All rights reserved. | ||
// | ||
|
||
#import "GlobalVars.h" | ||
|
||
@implementation GlobalVars | ||
|
||
@synthesize dict = _dict; | ||
|
||
+ (GlobalVars *)sharedInstance { | ||
static dispatch_once_t onceToken; | ||
static GlobalVars *instance = nil; | ||
dispatch_once(&onceToken, ^{ | ||
instance = [[GlobalVars alloc] init]; | ||
}); | ||
return instance; | ||
} | ||
|
||
- (UIImage *)getSharedUIImage:(NSString *)imageSrc { | ||
|
||
UIImage* cachedImage = dict[imageSrc]; | ||
|
||
CGImageRef cgref = [cachedImage CGImage]; | ||
CIImage *cim = [cachedImage CIImage]; | ||
|
||
if (cim == nil && cgref == NULL) { | ||
UIImage *newImage; | ||
if ([imageSrc hasPrefix:@"http://"] || [imageSrc hasPrefix:@"https://"]){ | ||
NSURL *url = [NSURL URLWithString:imageSrc]; | ||
NSData *data = [NSData dataWithContentsOfURL:url]; | ||
newImage = [UIImage imageWithData:data scale:[UIScreen mainScreen].scale]; | ||
} else { | ||
newImage = [UIImage imageWithContentsOfFile:imageSrc]; | ||
} | ||
dict[imageSrc] = newImage; | ||
return newImage; | ||
} else { | ||
return cachedImage; | ||
} | ||
} | ||
|
||
- (id)init { | ||
self = [super init]; | ||
if (self) { | ||
dict = [[NSMutableDictionary alloc] init]; | ||
} | ||
return self; | ||
} | ||
|
||
@end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove reference to EvoApp