mirror of
https://github.com/status-im/react-native.git
synced 2025-03-03 02:40:31 +00:00
Automated changes to remove implicit capture of self in blocks: Libraries/FBReactKit/BUCK
Reviewed By: javache Differential Revision: D3442470 fbshipit-source-id: 584a2bb3df5f7122166778b8fd44fae45560491e
This commit is contained in:
parent
41064991a2
commit
bcf4bb6edd
@ -54,10 +54,10 @@
|
||||
_logSem = dispatch_semaphore_create(0);
|
||||
RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
|
||||
if (source == RCTLogSourceJavaScript) {
|
||||
_lastLogLevel = level;
|
||||
_lastLogSource = source;
|
||||
_lastLogMessage = message;
|
||||
dispatch_semaphore_signal(_logSem);
|
||||
self->_lastLogLevel = level;
|
||||
self->_lastLogSource = source;
|
||||
self->_lastLogMessage = message;
|
||||
dispatch_semaphore_signal(self->_logSem);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ RCT_EXPORT_MODULE(TestModule)
|
||||
|
||||
_unregisteredTestModule = [UnregisteredTestModule new];
|
||||
_bridge = [[RCTBridge alloc] initWithBundleURL:nil
|
||||
moduleProvider:^{ return @[self, _unregisteredTestModule]; }
|
||||
moduleProvider:^{ return @[self, self->_unregisteredTestModule]; }
|
||||
launchOptions:nil];
|
||||
|
||||
_bridge.executorClass = [TestExecutor class];
|
||||
@ -232,7 +232,7 @@ RCT_EXPORT_MODULE(TestModule)
|
||||
|
||||
dispatch_sync(_methodQueue, ^{
|
||||
// clear the queue
|
||||
XCTAssertTrue(_testMethodCalled);
|
||||
XCTAssertTrue(self->_testMethodCalled);
|
||||
});
|
||||
}
|
||||
|
||||
@ -263,7 +263,7 @@ RCT_EXPORT_MODULE(TestModule)
|
||||
[_bridge.batchedBridge handleBuffer:buffer];
|
||||
|
||||
dispatch_sync(_unregisteredTestModule.methodQueue, ^{
|
||||
XCTAssertTrue(_unregisteredTestModule.testMethodCalled);
|
||||
XCTAssertTrue(self->_unregisteredTestModule.testMethodCalled);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -225,7 +225,7 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
__block RCTTestCustomSetBridgeModule *module;
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
module = [_bridge moduleForClass:[RCTTestCustomSetBridgeModule class]];
|
||||
module = [self->_bridge moduleForClass:[RCTTestCustomSetBridgeModule class]];
|
||||
});
|
||||
|
||||
RUN_RUNLOOP_WHILE(!module);
|
||||
@ -253,7 +253,7 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
__block RCTLazyInitModule *module;
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
module = [_bridge moduleForClass:[RCTLazyInitModule class]];
|
||||
module = [self->_bridge moduleForClass:[RCTLazyInitModule class]];
|
||||
});
|
||||
|
||||
RUN_RUNLOOP_WHILE(!module);
|
||||
|
@ -90,7 +90,7 @@ RCT_EXPORT_METHOD(saveToCameraRoll:(NSURLRequest *)request
|
||||
if ([type isEqualToString:@"video"]) {
|
||||
// It's unclear if writeVideoAtPathToSavedPhotosAlbum is thread-safe
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[_bridge.assetsLibrary writeVideoAtPathToSavedPhotosAlbum:request.URL completionBlock:^(NSURL *assetURL, NSError *saveError) {
|
||||
[self->_bridge.assetsLibrary writeVideoAtPathToSavedPhotosAlbum:request.URL completionBlock:^(NSURL *assetURL, NSError *saveError) {
|
||||
if (saveError) {
|
||||
reject(RCTErrorUnableToSave, nil, saveError);
|
||||
} else {
|
||||
@ -107,7 +107,7 @@ RCT_EXPORT_METHOD(saveToCameraRoll:(NSURLRequest *)request
|
||||
}
|
||||
// It's unclear if writeImageToSavedPhotosAlbum is thread-safe
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[_bridge.assetsLibrary writeImageToSavedPhotosAlbum:loadedImage.CGImage metadata:nil completionBlock:^(NSURL *assetURL, NSError *saveError) {
|
||||
[self->_bridge.assetsLibrary writeImageToSavedPhotosAlbum:loadedImage.CGImage metadata:nil completionBlock:^(NSURL *assetURL, NSError *saveError) {
|
||||
if (saveError) {
|
||||
RCTLogWarn(@"Error saving cropped image: %@", saveError);
|
||||
reject(RCTErrorUnableToSave, nil, saveError);
|
||||
|
@ -67,7 +67,7 @@ RCT_EXPORT_METHOD(cropImage:(NSURLRequest *)imageRequest
|
||||
}
|
||||
|
||||
// Store image
|
||||
[_bridge.imageStoreManager storeImage:croppedImage withBlock:^(NSString *croppedImageTag) {
|
||||
[self->_bridge.imageStoreManager storeImage:croppedImage withBlock:^(NSString *croppedImageTag) {
|
||||
if (!croppedImageTag) {
|
||||
NSString *errorMessage = @"Error storing cropped image in RCTImageStoreManager";
|
||||
RCTLogWarn(@"%@", errorMessage);
|
||||
|
@ -234,11 +234,11 @@ static UIImage *RCTResizeImageIfNeeded(UIImage *image,
|
||||
dispatch_async(_URLCacheQueue, ^{
|
||||
|
||||
// Remove completed tasks
|
||||
for (RCTNetworkTask *task in _pendingTasks.reverseObjectEnumerator) {
|
||||
for (RCTNetworkTask *task in self->_pendingTasks.reverseObjectEnumerator) {
|
||||
switch (task.status) {
|
||||
case RCTNetworkTaskFinished:
|
||||
[_pendingTasks removeObject:task];
|
||||
_activeTasks--;
|
||||
[self->_pendingTasks removeObject:task];
|
||||
self->_activeTasks--;
|
||||
break;
|
||||
case RCTNetworkTaskPending:
|
||||
break;
|
||||
@ -246,8 +246,8 @@ static UIImage *RCTResizeImageIfNeeded(UIImage *image,
|
||||
// Check task isn't "stuck"
|
||||
if (task.requestToken == nil) {
|
||||
RCTLogWarn(@"Task orphaned for request %@", task.request);
|
||||
[_pendingTasks removeObject:task];
|
||||
_activeTasks--;
|
||||
[self->_pendingTasks removeObject:task];
|
||||
self->_activeTasks--;
|
||||
[task cancel];
|
||||
}
|
||||
break;
|
||||
@ -255,12 +255,12 @@ static UIImage *RCTResizeImageIfNeeded(UIImage *image,
|
||||
}
|
||||
|
||||
// Start queued decode
|
||||
NSInteger activeDecodes = _scheduledDecodes - _pendingDecodes.count;
|
||||
while (activeDecodes == 0 || (_activeBytes <= _maxConcurrentDecodingBytes &&
|
||||
activeDecodes <= _maxConcurrentDecodingTasks)) {
|
||||
dispatch_block_t decodeBlock = _pendingDecodes.firstObject;
|
||||
NSInteger activeDecodes = self->_scheduledDecodes - self->_pendingDecodes.count;
|
||||
while (activeDecodes == 0 || (self->_activeBytes <= self->_maxConcurrentDecodingBytes &&
|
||||
activeDecodes <= self->_maxConcurrentDecodingTasks)) {
|
||||
dispatch_block_t decodeBlock = self->_pendingDecodes.firstObject;
|
||||
if (decodeBlock) {
|
||||
[_pendingDecodes removeObjectAtIndex:0];
|
||||
[self->_pendingDecodes removeObjectAtIndex:0];
|
||||
decodeBlock();
|
||||
} else {
|
||||
break;
|
||||
@ -268,13 +268,13 @@ static UIImage *RCTResizeImageIfNeeded(UIImage *image,
|
||||
}
|
||||
|
||||
// Start queued tasks
|
||||
for (RCTNetworkTask *task in _pendingTasks) {
|
||||
if (MAX(_activeTasks, _scheduledDecodes) >= _maxConcurrentLoadingTasks) {
|
||||
for (RCTNetworkTask *task in self->_pendingTasks) {
|
||||
if (MAX(self->_activeTasks, self->_scheduledDecodes) >= self->_maxConcurrentLoadingTasks) {
|
||||
break;
|
||||
}
|
||||
if (task.status == RCTNetworkTaskPending) {
|
||||
[task start];
|
||||
_activeTasks++;
|
||||
self->_activeTasks++;
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -317,8 +317,8 @@ static UIImage *RCTResizeImageIfNeeded(UIImage *image,
|
||||
}
|
||||
dispatch_async(_URLCacheQueue, ^{
|
||||
|
||||
if (!_URLCache) {
|
||||
_URLCache = [[NSURLCache alloc] initWithMemoryCapacity:5 * 1024 * 1024 // 5MB
|
||||
if (!self->_URLCache) {
|
||||
self->_URLCache = [[NSURLCache alloc] initWithMemoryCapacity:5 * 1024 * 1024 // 5MB
|
||||
diskCapacity:200 * 1024 * 1024 // 200MB
|
||||
diskPath:@"React/RCTImageDownloader"];
|
||||
}
|
||||
@ -342,7 +342,7 @@ static UIImage *RCTResizeImageIfNeeded(UIImage *image,
|
||||
}
|
||||
|
||||
// Check if networking module is available
|
||||
if (RCT_DEBUG && ![_bridge respondsToSelector:@selector(networking)]) {
|
||||
if (RCT_DEBUG && ![self->_bridge respondsToSelector:@selector(networking)]) {
|
||||
RCTLogError(@"No suitable image URL loader found for %@. You may need to "
|
||||
" import the RCTNetwork library in order to load images.",
|
||||
request.URL.absoluteString);
|
||||
@ -350,7 +350,7 @@ static UIImage *RCTResizeImageIfNeeded(UIImage *image,
|
||||
}
|
||||
|
||||
// Check if networking module can load image
|
||||
if (RCT_DEBUG && ![_bridge.networking canHandleRequest:request]) {
|
||||
if (RCT_DEBUG && ![self->_bridge.networking canHandleRequest:request]) {
|
||||
RCTLogError(@"No suitable image URL loader found for %@", request.URL.absoluteString);
|
||||
return;
|
||||
}
|
||||
@ -392,7 +392,7 @@ static UIImage *RCTResizeImageIfNeeded(UIImage *image,
|
||||
|
||||
// Check for cached response before reloading
|
||||
// TODO: move URL cache out of RCTImageLoader into its own module
|
||||
NSCachedURLResponse *cachedResponse = [_URLCache cachedResponseForRequest:request];
|
||||
NSCachedURLResponse *cachedResponse = [self->_URLCache cachedResponseForRequest:request];
|
||||
|
||||
while (cachedResponse) {
|
||||
if ([cachedResponse.response isKindOfClass:[NSHTTPURLResponse class]]) {
|
||||
@ -406,7 +406,7 @@ static UIImage *RCTResizeImageIfNeeded(UIImage *image,
|
||||
|
||||
NSURL *redirectURL = [NSURL URLWithString: location relativeToURL: request.URL];
|
||||
request = [NSURLRequest requestWithURL:redirectURL];
|
||||
cachedResponse = [_URLCache cachedResponseForRequest:request];
|
||||
cachedResponse = [self->_URLCache cachedResponseForRequest:request];
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -416,14 +416,14 @@ static UIImage *RCTResizeImageIfNeeded(UIImage *image,
|
||||
}
|
||||
|
||||
// Download image
|
||||
RCTNetworkTask *task = [_bridge.networking networkTaskWithRequest:request completionBlock:^(NSURLResponse *response, NSData *data, NSError *error) {
|
||||
RCTNetworkTask *task = [self->_bridge.networking networkTaskWithRequest:request completionBlock:^(NSURLResponse *response, NSData *data, NSError *error) {
|
||||
if (error) {
|
||||
completionHandler(error, nil);
|
||||
[weakSelf dequeueTasks];
|
||||
return;
|
||||
}
|
||||
|
||||
dispatch_async(_URLCacheQueue, ^{
|
||||
dispatch_async(self->_URLCacheQueue, ^{
|
||||
|
||||
// Cache the response
|
||||
// TODO: move URL cache out of RCTImageLoader into its own module
|
||||
@ -445,11 +445,11 @@ static UIImage *RCTResizeImageIfNeeded(UIImage *image,
|
||||
}];
|
||||
task.downloadProgressBlock = progressHandler;
|
||||
|
||||
if (!_pendingTasks) {
|
||||
_pendingTasks = [NSMutableArray new];
|
||||
if (!self->_pendingTasks) {
|
||||
self->_pendingTasks = [NSMutableArray new];
|
||||
}
|
||||
if (task) {
|
||||
[_pendingTasks addObject:task];
|
||||
[self->_pendingTasks addObject:task];
|
||||
[weakSelf dequeueTasks];
|
||||
}
|
||||
|
||||
@ -498,7 +498,7 @@ static UIImage *RCTResizeImageIfNeeded(UIImage *image,
|
||||
if (image) {
|
||||
CGFloat bytes = image.size.width * image.size.height * image.scale * image.scale * 4;
|
||||
if (bytes <= RCTMaxCachableDecodedImageSizeInBytes) {
|
||||
[_decodedImageCache setObject:image forKey:cacheKey cost:bytes];
|
||||
[self->_decodedImageCache setObject:image forKey:cacheKey cost:bytes];
|
||||
}
|
||||
}
|
||||
completionBlock(error, image);
|
||||
@ -579,7 +579,7 @@ static UIImage *RCTResizeImageIfNeeded(UIImage *image,
|
||||
NSInteger decodedImageBytes = (size.width * scale) * (size.height * scale) * 4;
|
||||
|
||||
// Mark these bytes as in-use
|
||||
_activeBytes += decodedImageBytes;
|
||||
self->_activeBytes += decodedImageBytes;
|
||||
|
||||
// Do actual decompression on a concurrent background queue
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
@ -612,9 +612,9 @@ static UIImage *RCTResizeImageIfNeeded(UIImage *image,
|
||||
|
||||
// We're no longer retaining the uncompressed data, so now we'll mark
|
||||
// the decoding as complete so that the loading task queue can resume.
|
||||
dispatch_async(_URLCacheQueue, ^{
|
||||
_scheduledDecodes--;
|
||||
_activeBytes -= decodedImageBytes;
|
||||
dispatch_async(self->_URLCacheQueue, ^{
|
||||
self->_scheduledDecodes--;
|
||||
self->_activeBytes -= decodedImageBytes;
|
||||
[self dequeueTasks];
|
||||
});
|
||||
});
|
||||
@ -623,17 +623,17 @@ static UIImage *RCTResizeImageIfNeeded(UIImage *image,
|
||||
// The decode operation retains the compressed image data until it's
|
||||
// complete, so we'll mark it as having started, in order to block
|
||||
// further image loads from happening until we're done with the data.
|
||||
_scheduledDecodes++;
|
||||
self->_scheduledDecodes++;
|
||||
|
||||
if (!_pendingDecodes) {
|
||||
_pendingDecodes = [NSMutableArray new];
|
||||
if (!self->_pendingDecodes) {
|
||||
self->_pendingDecodes = [NSMutableArray new];
|
||||
}
|
||||
NSInteger activeDecodes = _scheduledDecodes - _pendingDecodes.count - 1;
|
||||
if (activeDecodes == 0 || (_activeBytes <= _maxConcurrentDecodingBytes &&
|
||||
activeDecodes <= _maxConcurrentDecodingTasks)) {
|
||||
NSInteger activeDecodes = self->_scheduledDecodes - self->_pendingDecodes.count - 1;
|
||||
if (activeDecodes == 0 || (self->_activeBytes <= self->_maxConcurrentDecodingBytes &&
|
||||
activeDecodes <= self->_maxConcurrentDecodingTasks)) {
|
||||
decodeBlock();
|
||||
} else {
|
||||
[_pendingDecodes addObject:decodeBlock];
|
||||
[self->_pendingDecodes addObject:decodeBlock];
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -66,7 +66,7 @@ RCT_EXPORT_MODULE()
|
||||
{
|
||||
RCTAssertParam(block);
|
||||
dispatch_async(_methodQueue, ^{
|
||||
block(_store[imageTag]);
|
||||
block(self->_store[imageTag]);
|
||||
});
|
||||
}
|
||||
|
||||
@ -117,7 +117,7 @@ RCT_EXPORT_METHOD(addImageFromBase64:(NSString *)base64String
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
NSData *imageData = [[NSData alloc] initWithBase64EncodedString:base64String options:0];
|
||||
if (imageData) {
|
||||
dispatch_async(_methodQueue, ^{
|
||||
dispatch_async(self->_methodQueue, ^{
|
||||
successCallback(@[[self _storeImageData:imageData]]);
|
||||
});
|
||||
} else {
|
||||
@ -147,7 +147,7 @@ RCT_EXPORT_METHOD(addImageFromBase64:(NSString *)base64String
|
||||
}
|
||||
|
||||
NSString *imageTag = request.URL.absoluteString;
|
||||
NSData *imageData = _store[imageTag];
|
||||
NSData *imageData = self->_store[imageTag];
|
||||
if (!imageData) {
|
||||
NSError *error = RCTErrorWithMessage([NSString stringWithFormat:@"Invalid imageTag: %@", imageTag]);
|
||||
[delegate URLRequest:cancellationBlock didCompleteWithError:error];
|
||||
@ -206,7 +206,7 @@ RCT_EXPORT_METHOD(addImageFromBase64:(NSString *)base64String
|
||||
RCTLogWarn(@"RCTImageStoreManager.imageForTag() is deprecated and has poor performance. Use an alternative method instead.");
|
||||
__block NSData *imageData;
|
||||
dispatch_sync(_methodQueue, ^{
|
||||
imageData = _store[imageTag];
|
||||
imageData = self->_store[imageTag];
|
||||
});
|
||||
return [UIImage imageWithData:imageData];
|
||||
}
|
||||
@ -215,7 +215,7 @@ RCT_EXPORT_METHOD(addImageFromBase64:(NSString *)base64String
|
||||
{
|
||||
RCTAssertParam(block);
|
||||
dispatch_async(_methodQueue, ^{
|
||||
NSData *imageData = _store[imageTag];
|
||||
NSData *imageData = self->_store[imageTag];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
// imageWithData: is not thread-safe, so we can't do this on methodQueue
|
||||
block([UIImage imageWithData:imageData]);
|
||||
|
@ -216,7 +216,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
|
||||
RCTImageLoaderProgressBlock progressHandler = nil;
|
||||
if (_onProgress) {
|
||||
progressHandler = ^(int64_t loaded, int64_t total) {
|
||||
_onProgress(@{
|
||||
self->_onProgress(@{
|
||||
@"loaded": @((double)loaded),
|
||||
@"total": @((double)total),
|
||||
});
|
||||
|
@ -95,7 +95,7 @@ static NSString *RCTGenerateFormBoundary()
|
||||
headers[@"content-type"] = partContentType;
|
||||
}
|
||||
[headers enumerateKeysAndObjectsUsingBlock:^(NSString *parameterKey, NSString *parameterValue, BOOL *stop) {
|
||||
[_multipartBody appendData:[[NSString stringWithFormat:@"%@: %@\r\n", parameterKey, parameterValue]
|
||||
[self->_multipartBody appendData:[[NSString stringWithFormat:@"%@: %@\r\n", parameterKey, parameterValue]
|
||||
dataUsingEncoding:NSUTF8StringEncoding]];
|
||||
}];
|
||||
|
||||
@ -239,7 +239,7 @@ RCT_EXPORT_MODULE()
|
||||
[request setValue:(@(request.HTTPBody.length)).description forHTTPHeaderField:@"Content-Length"];
|
||||
}
|
||||
|
||||
dispatch_async(_methodQueue, ^{
|
||||
dispatch_async(self->_methodQueue, ^{
|
||||
block(request);
|
||||
});
|
||||
|
||||
@ -287,7 +287,7 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
__block RCTURLRequestCancellationBlock cancellationBlock = nil;
|
||||
RCTNetworkTask *task = [self networkTaskWithRequest:request completionBlock:^(NSURLResponse *response, NSData *data, NSError *error) {
|
||||
dispatch_async(_methodQueue, ^{
|
||||
dispatch_async(self->_methodQueue, ^{
|
||||
cancellationBlock = callback(error, data ? @{@"body": data, @"contentType": RCTNullIfNil(response.MIMEType)} : nil);
|
||||
});
|
||||
}];
|
||||
@ -365,14 +365,14 @@ RCT_EXPORT_MODULE()
|
||||
__block RCTNetworkTask *task;
|
||||
|
||||
RCTURLRequestProgressBlock uploadProgressBlock = ^(int64_t progress, int64_t total) {
|
||||
dispatch_async(_methodQueue, ^{
|
||||
dispatch_async(self->_methodQueue, ^{
|
||||
NSArray *responseJSON = @[task.requestID, @((double)progress), @((double)total)];
|
||||
[self sendEventWithName:@"didSendNetworkData" body:responseJSON];
|
||||
});
|
||||
};
|
||||
|
||||
void (^responseBlock)(NSURLResponse *) = ^(NSURLResponse *response) {
|
||||
dispatch_async(_methodQueue, ^{
|
||||
dispatch_async(self->_methodQueue, ^{
|
||||
NSDictionary<NSString *, NSString *> *headers;
|
||||
NSInteger status;
|
||||
if ([response isKindOfClass:[NSHTTPURLResponse class]]) { // Might be a local file request
|
||||
@ -390,14 +390,14 @@ RCT_EXPORT_MODULE()
|
||||
};
|
||||
|
||||
void (^incrementalDataBlock)(NSData *) = incrementalUpdates ? ^(NSData *data) {
|
||||
dispatch_async(_methodQueue, ^{
|
||||
dispatch_async(self->_methodQueue, ^{
|
||||
[self sendData:data forTask:task];
|
||||
});
|
||||
} : nil;
|
||||
|
||||
RCTURLRequestCompletionBlock completionBlock =
|
||||
^(NSURLResponse *response, NSData *data, NSError *error) {
|
||||
dispatch_async(_methodQueue, ^{
|
||||
dispatch_async(self->_methodQueue, ^{
|
||||
if (!incrementalUpdates) {
|
||||
[self sendData:data forTask:task];
|
||||
}
|
||||
@ -407,7 +407,7 @@ RCT_EXPORT_MODULE()
|
||||
];
|
||||
|
||||
[self sendEventWithName:@"didCompleteNetworkResponse" body:responseJSON];
|
||||
[_tasksByRequestID removeObjectForKey:task.requestID];
|
||||
[self->_tasksByRequestID removeObjectForKey:task.requestID];
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -35,16 +35,16 @@ RCT_EXPORT_METHOD(verifySnapshot:(RCTResponseSenderBlock)callback)
|
||||
|
||||
[_bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
||||
|
||||
NSString *testName = NSStringFromSelector(_testSelector);
|
||||
if (!_snapshotCounter) {
|
||||
_snapshotCounter = [NSMutableDictionary new];
|
||||
NSString *testName = NSStringFromSelector(self->_testSelector);
|
||||
if (!self->_snapshotCounter) {
|
||||
self->_snapshotCounter = [NSMutableDictionary new];
|
||||
}
|
||||
_snapshotCounter[testName] = (@([_snapshotCounter[testName] integerValue] + 1)).stringValue;
|
||||
self->_snapshotCounter[testName] = (@([self->_snapshotCounter[testName] integerValue] + 1)).stringValue;
|
||||
|
||||
NSError *error = nil;
|
||||
BOOL success = [_controller compareSnapshotOfView:_view
|
||||
selector:_testSelector
|
||||
identifier:_snapshotCounter[testName]
|
||||
BOOL success = [self->_controller compareSnapshotOfView:self->_view
|
||||
selector:self->_testSelector
|
||||
identifier:self->_snapshotCounter[testName]
|
||||
error:&error];
|
||||
callback(@[@(success)]);
|
||||
}];
|
||||
@ -76,7 +76,7 @@ RCT_EXPORT_METHOD(markTestCompleted)
|
||||
RCT_EXPORT_METHOD(markTestPassed:(BOOL)success)
|
||||
{
|
||||
[_bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, __unused NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
||||
_status = success ? RCTTestStatusPassed : RCTTestStatusFailed;
|
||||
self->_status = success ? RCTTestStatusPassed : RCTTestStatusFailed;
|
||||
}];
|
||||
}
|
||||
|
||||
|
@ -80,9 +80,9 @@ RCT_EXPORT_METHOD(setValues:(NSDictionary *)values)
|
||||
[values enumerateKeysAndObjectsUsingBlock:^(NSString *key, id json, BOOL *stop) {
|
||||
id plist = [RCTConvert NSPropertyList:json];
|
||||
if (plist) {
|
||||
[_defaults setObject:plist forKey:key];
|
||||
[self->_defaults setObject:plist forKey:key];
|
||||
} else {
|
||||
[_defaults removeObjectForKey:key];
|
||||
[self->_defaults removeObjectForKey:key];
|
||||
}
|
||||
}];
|
||||
|
||||
|
@ -471,9 +471,9 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
|
||||
}
|
||||
|
||||
[self _readUntilHeaderCompleteWithCallback:^(RCTSRWebSocket *socket, NSData *data) {
|
||||
CFHTTPMessageAppendBytes(_receivedHTTPHeaders, (const UInt8 *)data.bytes, data.length);
|
||||
CFHTTPMessageAppendBytes(self->_receivedHTTPHeaders, (const UInt8 *)data.bytes, data.length);
|
||||
|
||||
if (CFHTTPMessageIsHeaderComplete(_receivedHTTPHeaders)) {
|
||||
if (CFHTTPMessageIsHeaderComplete(self->_receivedHTTPHeaders)) {
|
||||
RCTSRLog(@"Finished reading headers %@", CFBridgingRelease(CFHTTPMessageCopyAllHeaderFields(_receivedHTTPHeaders)));
|
||||
[socket _HTTPHeadersDidFinish];
|
||||
} else {
|
||||
@ -643,7 +643,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
|
||||
// Need to shunt this on the _callbackQueue first to see if they received any messages
|
||||
[self _performDelegateBlock:^{
|
||||
[self closeWithCode:RCTSRStatusCodeProtocolError reason:message];
|
||||
dispatch_async(_workQueue, ^{
|
||||
dispatch_async(self->_workQueue, ^{
|
||||
[self _disconnect];
|
||||
});
|
||||
}];
|
||||
@ -653,7 +653,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
|
||||
{
|
||||
dispatch_async(_workQueue, ^{
|
||||
if (self.readyState != RCTSR_CLOSED) {
|
||||
_failed = YES;
|
||||
self->_failed = YES;
|
||||
[self _performDelegateBlock:^{
|
||||
if ([self.delegate respondsToSelector:@selector(webSocket:didFailWithError:)]) {
|
||||
[self.delegate webSocket:self didFailWithError:error];
|
||||
@ -661,7 +661,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
|
||||
}];
|
||||
|
||||
self.readyState = RCTSR_CLOSED;
|
||||
_selfRetain = nil;
|
||||
self->_selfRetain = nil;
|
||||
|
||||
RCTSRLog(@"Failing with error %@", error.localizedDescription);
|
||||
|
||||
@ -713,7 +713,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
|
||||
{
|
||||
// Need to pingpong this off _callbackQueue first to make sure messages happen in order
|
||||
[self _performDelegateBlock:^{
|
||||
dispatch_async(_workQueue, ^{
|
||||
dispatch_async(self->_workQueue, ^{
|
||||
[self _sendFrameWithOpcode:RCTSROpCodePong data:pingData];
|
||||
});
|
||||
}];
|
||||
@ -990,7 +990,7 @@ static const uint8_t RCTSRPayloadLenMask = 0x7F;
|
||||
[socket _closeWithProtocolError:@"Client must receive unmasked data"];
|
||||
}
|
||||
|
||||
size_t extra_bytes_needed = header.masked ? sizeof(_currentReadMaskKey) : 0;
|
||||
size_t extra_bytes_needed = header.masked ? sizeof(self->_currentReadMaskKey) : 0;
|
||||
|
||||
if (header.payload_length == 126) {
|
||||
extra_bytes_needed += sizeof(uint16_t);
|
||||
@ -1020,7 +1020,7 @@ static const uint8_t RCTSRPayloadLenMask = 0x7F;
|
||||
}
|
||||
|
||||
if (header.masked) {
|
||||
assert(mapped_size >= sizeof(_currentReadMaskOffset) + offset);
|
||||
assert(mapped_size >= sizeof(self->_currentReadMaskOffset) + offset);
|
||||
memcpy(_socket->_currentReadMaskKey, ((uint8_t *)mapped_buffer) + offset, sizeof(_socket->_currentReadMaskKey));
|
||||
}
|
||||
|
||||
@ -1033,12 +1033,12 @@ static const uint8_t RCTSRPayloadLenMask = 0x7F;
|
||||
- (void)_readFrameNew;
|
||||
{
|
||||
dispatch_async(_workQueue, ^{
|
||||
_currentFrameData.length = 0;
|
||||
self->_currentFrameData.length = 0;
|
||||
|
||||
_currentFrameOpcode = 0;
|
||||
_currentFrameCount = 0;
|
||||
_readOpCount = 0;
|
||||
_currentStringScanPosition = 0;
|
||||
self->_currentFrameOpcode = 0;
|
||||
self->_currentFrameCount = 0;
|
||||
self->_readOpCount = 0;
|
||||
self->_currentStringScanPosition = 0;
|
||||
|
||||
[self _readFrameContinue];
|
||||
});
|
||||
@ -1081,7 +1081,7 @@ static const uint8_t RCTSRPayloadLenMask = 0x7F;
|
||||
if (!_failed) {
|
||||
[self _performDelegateBlock:^{
|
||||
if ([self.delegate respondsToSelector:@selector(webSocket:didCloseWithCode:reason:wasClean:)]) {
|
||||
[self.delegate webSocket:self didCloseWithCode:_closeCode reason:_closeReason wasClean:YES];
|
||||
[self.delegate webSocket:self didCloseWithCode:self->_closeCode reason:self->_closeReason wasClean:YES];
|
||||
}
|
||||
}];
|
||||
}
|
||||
@ -1388,9 +1388,9 @@ static const size_t RCTSRFrameHeaderOverhead = 32;
|
||||
if (self.readyState >= RCTSR_CLOSING) {
|
||||
return;
|
||||
}
|
||||
assert(_readBuffer);
|
||||
assert(self->_readBuffer);
|
||||
|
||||
if (self.readyState == RCTSR_CONNECTING && aStream == _inputStream) {
|
||||
if (self.readyState == RCTSR_CONNECTING && aStream == self->_inputStream) {
|
||||
[self didConnect];
|
||||
}
|
||||
[self _pumpWriting];
|
||||
@ -1402,8 +1402,8 @@ static const size_t RCTSRFrameHeaderOverhead = 32;
|
||||
RCTSRLog(@"NSStreamEventErrorOccurred %@ %@", aStream, [aStream.streamError copy]);
|
||||
// TODO: specify error better!
|
||||
[self _failWithError:aStream.streamError];
|
||||
_readBufferOffset = 0;
|
||||
_readBuffer.length = 0;
|
||||
self->_readBufferOffset = 0;
|
||||
self->_readBuffer.length = 0;
|
||||
break;
|
||||
|
||||
}
|
||||
@ -1414,14 +1414,14 @@ static const size_t RCTSRFrameHeaderOverhead = 32;
|
||||
if (aStream.streamError) {
|
||||
[self _failWithError:aStream.streamError];
|
||||
} else {
|
||||
dispatch_async(_workQueue, ^{
|
||||
dispatch_async(self->_workQueue, ^{
|
||||
if (self.readyState != RCTSR_CLOSED) {
|
||||
self.readyState = RCTSR_CLOSED;
|
||||
_selfRetain = nil;
|
||||
self->_selfRetain = nil;
|
||||
}
|
||||
|
||||
if (!_sentClose && !_failed) {
|
||||
_sentClose = YES;
|
||||
if (!self->_sentClose && !self->_failed) {
|
||||
self->_sentClose = YES;
|
||||
// If we get closed in this state it's probably not clean because we should be sending this when we send messages
|
||||
[self _performDelegateBlock:^{
|
||||
if ([self.delegate respondsToSelector:@selector(webSocket:didCloseWithCode:reason:wasClean:)]) {
|
||||
@ -1440,13 +1440,13 @@ static const size_t RCTSRFrameHeaderOverhead = 32;
|
||||
const int bufferSize = 2048;
|
||||
uint8_t buffer[bufferSize];
|
||||
|
||||
while (_inputStream.hasBytesAvailable) {
|
||||
NSInteger bytes_read = [_inputStream read:buffer maxLength:bufferSize];
|
||||
while (self->_inputStream.hasBytesAvailable) {
|
||||
NSInteger bytes_read = [self->_inputStream read:buffer maxLength:bufferSize];
|
||||
|
||||
if (bytes_read > 0) {
|
||||
[_readBuffer appendBytes:buffer length:bytes_read];
|
||||
[self->_readBuffer appendBytes:buffer length:bytes_read];
|
||||
} else if (bytes_read < 0) {
|
||||
[self _failWithError:_inputStream.streamError];
|
||||
[self _failWithError:self->_inputStream.streamError];
|
||||
}
|
||||
|
||||
if (bytes_read != bufferSize) {
|
||||
|
@ -154,10 +154,10 @@ RCT_EXPORT_MODULE()
|
||||
}
|
||||
|
||||
NSNumber *expectedID = @(lastID++);
|
||||
_callbacks[expectedID] = [callback copy];
|
||||
self->_callbacks[expectedID] = [callback copy];
|
||||
NSMutableDictionary<NSString *, id> *messageWithID = [message mutableCopy];
|
||||
messageWithID[@"id"] = expectedID;
|
||||
[_socket send:RCTJSONStringify(messageWithID, NULL)];
|
||||
[self->_socket send:RCTJSONStringify(messageWithID, NULL)];
|
||||
});
|
||||
}
|
||||
|
||||
@ -215,7 +215,7 @@ RCT_EXPORT_MODULE()
|
||||
- (void)injectJSONText:(NSString *)script asGlobalObjectNamed:(NSString *)objectName callback:(RCTJavaScriptCompleteBlock)onComplete
|
||||
{
|
||||
dispatch_async(_jsQueue, ^{
|
||||
_injectedObjects[objectName] = script;
|
||||
self->_injectedObjects[objectName] = script;
|
||||
onComplete(nil);
|
||||
});
|
||||
}
|
||||
|
@ -26,7 +26,7 @@
|
||||
#import "RCTRedBox.h"
|
||||
|
||||
#define RCTAssertJSThread() \
|
||||
RCTAssert(![NSStringFromClass([_javaScriptExecutor class]) isEqualToString:@"RCTJSCExecutor"] || \
|
||||
RCTAssert(![NSStringFromClass([self->_javaScriptExecutor class]) isEqualToString:@"RCTJSCExecutor"] || \
|
||||
[[[NSThread currentThread] name] isEqualToString:RCTJSCThreadName], \
|
||||
@"This method must be called on JS thread")
|
||||
|
||||
@ -174,7 +174,7 @@ RCT_EXTERN NSArray<Class> *RCTGetModuleClasses(void);
|
||||
} else if (self.bundleURL) {
|
||||
[RCTJavaScriptLoader loadBundleAtURL:self.bundleURL onComplete:^(NSError *error, NSData *source, int64_t sourceLength) {
|
||||
if (error && [self.delegate respondsToSelector:@selector(fallbackSourceURLForBridge:)]) {
|
||||
NSURL *fallbackURL = [self.delegate fallbackSourceURLForBridge:_parentBridge];
|
||||
NSURL *fallbackURL = [self.delegate fallbackSourceURLForBridge:self->_parentBridge];
|
||||
if (fallbackURL && ![fallbackURL isEqual:self.bundleURL]) {
|
||||
RCTLogError(@"Failed to load bundle(%@) with error:(%@)", self.bundleURL, error.localizedDescription);
|
||||
self.bundleURL = fallbackURL;
|
||||
@ -190,7 +190,7 @@ RCT_EXTERN NSArray<Class> *RCTGetModuleClasses(void);
|
||||
[self didFinishLoading];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName:RCTJavaScriptDidLoadNotification
|
||||
object:_parentBridge userInfo:@{@"bridge": self}];
|
||||
object:self->_parentBridge userInfo:@{@"bridge": self}];
|
||||
});
|
||||
onSourceLoad(nil, nil, 0);
|
||||
}
|
||||
@ -462,7 +462,7 @@ RCT_EXTERN NSArray<Class> *RCTGetModuleClasses(void);
|
||||
sourceCodeModule.scriptURL = self.bundleURL;
|
||||
|
||||
[self enqueueApplicationScript:sourceCode url:self.bundleURL onComplete:^(NSError *loadError) {
|
||||
if (!_valid) {
|
||||
if (!self->_valid) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -474,8 +474,8 @@ RCT_EXTERN NSArray<Class> *RCTGetModuleClasses(void);
|
||||
}
|
||||
|
||||
// Register the display link to start sending js calls after everything is setup
|
||||
NSRunLoop *targetRunLoop = [_javaScriptExecutor isKindOfClass:[RCTJSCExecutor class]] ? [NSRunLoop currentRunLoop] : [NSRunLoop mainRunLoop];
|
||||
[_displayLink addToRunLoop:targetRunLoop];
|
||||
NSRunLoop *targetRunLoop = [self->_javaScriptExecutor isKindOfClass:[RCTJSCExecutor class]] ? [NSRunLoop currentRunLoop] : [NSRunLoop mainRunLoop];
|
||||
[self->_displayLink addToRunLoop:targetRunLoop];
|
||||
|
||||
// Perform the state update and notification on the main thread, so we can't run into
|
||||
// timing issues with RCTRootView
|
||||
@ -483,7 +483,7 @@ RCT_EXTERN NSArray<Class> *RCTGetModuleClasses(void);
|
||||
[self didFinishLoading];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName:RCTJavaScriptDidLoadNotification
|
||||
object:_parentBridge userInfo:@{@"bridge": self}];
|
||||
object:self->_parentBridge userInfo:@{@"bridge": self}];
|
||||
});
|
||||
}];
|
||||
|
||||
@ -505,7 +505,7 @@ RCT_EXTERN NSArray<Class> *RCTGetModuleClasses(void);
|
||||
[_performanceLogger markStopForTag:RCTPLBridgeStartup];
|
||||
_loading = NO;
|
||||
[_javaScriptExecutor executeBlockOnJavaScriptQueue:^{
|
||||
for (dispatch_block_t call in _pendingCalls) {
|
||||
for (dispatch_block_t call in self->_pendingCalls) {
|
||||
call();
|
||||
}
|
||||
}];
|
||||
@ -637,24 +637,24 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
|
||||
}
|
||||
|
||||
dispatch_group_notify(group, dispatch_get_main_queue(), ^{
|
||||
[_javaScriptExecutor executeBlockOnJavaScriptQueue:^{
|
||||
[_displayLink invalidate];
|
||||
_displayLink = nil;
|
||||
[self->_javaScriptExecutor executeBlockOnJavaScriptQueue:^{
|
||||
[self->_displayLink invalidate];
|
||||
self->_displayLink = nil;
|
||||
|
||||
[_javaScriptExecutor invalidate];
|
||||
_javaScriptExecutor = nil;
|
||||
[self->_javaScriptExecutor invalidate];
|
||||
self->_javaScriptExecutor = nil;
|
||||
|
||||
if (RCTProfileIsProfiling()) {
|
||||
RCTProfileUnhookModules(self);
|
||||
}
|
||||
|
||||
_moduleDataByName = nil;
|
||||
_moduleDataByID = nil;
|
||||
_moduleClassesByID = nil;
|
||||
_pendingCalls = nil;
|
||||
self->_moduleDataByName = nil;
|
||||
self->_moduleDataByID = nil;
|
||||
self->_moduleClassesByID = nil;
|
||||
self->_pendingCalls = nil;
|
||||
|
||||
if (_flowIDMap != NULL) {
|
||||
CFRelease(_flowIDMap);
|
||||
if (self->_flowIDMap != NULL) {
|
||||
CFRelease(self->_flowIDMap);
|
||||
}
|
||||
}];
|
||||
});
|
||||
@ -778,7 +778,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
|
||||
}
|
||||
|
||||
RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"FetchApplicationScriptCallbacks", nil);
|
||||
[_javaScriptExecutor flushedQueue:^(id json, NSError *error)
|
||||
[self->_javaScriptExecutor flushedQueue:^(id json, NSError *error)
|
||||
{
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"js_call,init", @{
|
||||
@"json": RCTNullIfNil(json),
|
||||
@ -889,7 +889,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
|
||||
capacity:_moduleDataByName.count];
|
||||
|
||||
[moduleIDs enumerateObjectsUsingBlock:^(NSNumber *moduleID, NSUInteger i, __unused BOOL *stop) {
|
||||
RCTModuleData *moduleData = _moduleDataByID[moduleID.integerValue];
|
||||
RCTModuleData *moduleData = self->_moduleDataByID[moduleID.integerValue];
|
||||
dispatch_queue_t queue = moduleData.methodQueue;
|
||||
NSMutableOrderedSet<NSNumber *> *set = [buckets objectForKey:queue];
|
||||
if (!set) {
|
||||
@ -910,11 +910,11 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
|
||||
@autoreleasepool {
|
||||
for (NSNumber *indexObj in calls) {
|
||||
NSUInteger index = indexObj.unsignedIntegerValue;
|
||||
if (RCT_DEV && callID != -1 && _flowIDMap != NULL && RCTProfileIsProfiling()) {
|
||||
if (RCT_DEV && callID != -1 && self->_flowIDMap != NULL && RCTProfileIsProfiling()) {
|
||||
[self.flowIDMapLock lock];
|
||||
int64_t newFlowID = (int64_t)CFDictionaryGetValue(_flowIDMap, (const void *)(_flowID + index));
|
||||
int64_t newFlowID = (int64_t)CFDictionaryGetValue(self->_flowIDMap, (const void *)(self->_flowID + index));
|
||||
_RCTProfileEndFlowEvent(@(newFlowID));
|
||||
CFDictionaryRemoveValue(_flowIDMap, (const void *)(_flowID + index));
|
||||
CFDictionaryRemoveValue(self->_flowIDMap, (const void *)(self->_flowID + index));
|
||||
[self.flowIDMapLock unlock];
|
||||
}
|
||||
[self _handleRequestNumber:index
|
||||
|
@ -55,7 +55,7 @@
|
||||
|
||||
CFRunLoopRef cfRunLoop = [strongSelf->_runLoop getCFRunLoop];
|
||||
|
||||
if (!_runLoop) {
|
||||
if (!self->_runLoop) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -277,7 +277,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init);
|
||||
RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, [NSString stringWithFormat:@"[RCTModuleData gatherConstants] %@", _moduleClass], nil);
|
||||
(void)[self instance];
|
||||
RCTExecuteOnMainThread(^{
|
||||
_constantsToExport = [_instance constantsToExport] ?: @{};
|
||||
self->_constantsToExport = [self->_instance constantsToExport] ?: @{};
|
||||
}, YES);
|
||||
}
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"", nil);
|
||||
|
@ -158,12 +158,12 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
|
||||
dispatch_get_main_queue(), ^{
|
||||
|
||||
[UIView transitionWithView:self
|
||||
duration:_loadingViewFadeDuration
|
||||
duration:self->_loadingViewFadeDuration
|
||||
options:UIViewAnimationOptionTransitionCrossDissolve
|
||||
animations:^{
|
||||
_loadingView.hidden = YES;
|
||||
self->_loadingView.hidden = YES;
|
||||
} completion:^(__unused BOOL finished) {
|
||||
[_loadingView removeFromSuperview];
|
||||
[self->_loadingView removeFromSuperview];
|
||||
}];
|
||||
});
|
||||
} else {
|
||||
@ -342,8 +342,8 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder:(nonnull NSCoder *)aDecoder)
|
||||
[super insertReactSubview:subview atIndex:atIndex];
|
||||
[_bridge->_performanceLogger markStopForTag:RCTPLTTI];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (!_contentHasAppeared) {
|
||||
_contentHasAppeared = YES;
|
||||
if (!self->_contentHasAppeared) {
|
||||
self->_contentHasAppeared = YES;
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:RCTContentDidAppearNotification
|
||||
object:self.superview];
|
||||
}
|
||||
|
@ -477,7 +477,7 @@ static void RCTInstallJSCProfiler(RCTBridge *bridge, JSContextRef context)
|
||||
}
|
||||
|
||||
JSContext *context = strongSelf.context.context;
|
||||
RCTInstallJSCProfiler(_bridge, context.JSGlobalContextRef);
|
||||
RCTInstallJSCProfiler(self->_bridge, context.JSGlobalContextRef);
|
||||
}];
|
||||
|
||||
// Inject handler used by HMR
|
||||
@ -501,7 +501,7 @@ static void RCTInstallJSCProfiler(RCTBridge *bridge, JSContextRef context)
|
||||
{
|
||||
[self executeBlockOnJavaScriptQueue:^{
|
||||
BOOL enabled = [notification.name isEqualToString:RCTProfileDidStartProfiling];
|
||||
[_bridge enqueueJSCall:@"Systrace.setEnabled" args:@[enabled ? @YES : @NO]];
|
||||
[self->_bridge enqueueJSCall:@"Systrace.setEnabled" args:@[enabled ? @YES : @NO]];
|
||||
}];
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,7 @@ RCT_EXPORT_MODULE()
|
||||
- (void)clearAllData
|
||||
{
|
||||
dispatch_async(RCTGetMethodQueue(), ^{
|
||||
[_manifest removeAllObjects];
|
||||
[self->_manifest removeAllObjects];
|
||||
[RCTGetCache() removeAllObjects];
|
||||
RCTDeleteStorageDirectory();
|
||||
});
|
||||
|
@ -70,26 +70,26 @@ RCT_EXPORT_METHOD(showMessage:(NSString *)message color:(UIColor *)color backgro
|
||||
}
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
_showDate = [NSDate date];
|
||||
if (!_window && !RCTRunningInTestEnvironment()) {
|
||||
self->_showDate = [NSDate date];
|
||||
if (!self->_window && !RCTRunningInTestEnvironment()) {
|
||||
CGFloat screenWidth = [UIScreen mainScreen].bounds.size.width;
|
||||
_window = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, screenWidth, 22)];
|
||||
_window.windowLevel = UIWindowLevelStatusBar + 1;
|
||||
self->_window = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, screenWidth, 22)];
|
||||
self->_window.windowLevel = UIWindowLevelStatusBar + 1;
|
||||
|
||||
// set a root VC so rotation is supported
|
||||
_window.rootViewController = [UIViewController new];
|
||||
self->_window.rootViewController = [UIViewController new];
|
||||
|
||||
_label = [[UILabel alloc] initWithFrame:_window.bounds];
|
||||
_label.font = [UIFont systemFontOfSize:12.0];
|
||||
_label.textAlignment = NSTextAlignmentCenter;
|
||||
self->_label = [[UILabel alloc] initWithFrame:self->_window.bounds];
|
||||
self->_label.font = [UIFont systemFontOfSize:12.0];
|
||||
self->_label.textAlignment = NSTextAlignmentCenter;
|
||||
|
||||
[_window addSubview:_label];
|
||||
[self->_window addSubview:self->_label];
|
||||
}
|
||||
|
||||
_label.text = message;
|
||||
_label.textColor = color;
|
||||
_window.backgroundColor = backgroundColor;
|
||||
_window.hidden = NO;
|
||||
self->_label.text = message;
|
||||
self->_label.textColor = color;
|
||||
self->_window.backgroundColor = backgroundColor;
|
||||
self->_window.hidden = NO;
|
||||
});
|
||||
}
|
||||
|
||||
@ -101,18 +101,18 @@ RCT_EXPORT_METHOD(hide)
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
const NSTimeInterval MIN_PRESENTED_TIME = 0.6;
|
||||
NSTimeInterval presentedTime = [[NSDate date] timeIntervalSinceDate:_showDate];
|
||||
NSTimeInterval presentedTime = [[NSDate date] timeIntervalSinceDate:self->_showDate];
|
||||
NSTimeInterval delay = MAX(0, MIN_PRESENTED_TIME - presentedTime);
|
||||
CGRect windowFrame = _window.frame;
|
||||
CGRect windowFrame = self->_window.frame;
|
||||
[UIView animateWithDuration:0.25
|
||||
delay:delay
|
||||
options:0
|
||||
animations:^{
|
||||
_window.frame = CGRectOffset(windowFrame, 0, -windowFrame.size.height);
|
||||
self->_window.frame = CGRectOffset(windowFrame, 0, -windowFrame.size.height);
|
||||
} completion:^(__unused BOOL finished) {
|
||||
_window.frame = windowFrame;
|
||||
_window.hidden = YES;
|
||||
_window = nil;
|
||||
self->_window.frame = windowFrame;
|
||||
self->_window.hidden = YES;
|
||||
self->_window = nil;
|
||||
}];
|
||||
});
|
||||
}
|
||||
|
@ -192,12 +192,12 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
_executorOverride = [_defaults objectForKey:@"executor-override"];
|
||||
self->_executorOverride = [self->_defaults objectForKey:@"executor-override"];
|
||||
});
|
||||
|
||||
// Delay setup until after Bridge init
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[weakSelf updateSettings:_settings];
|
||||
[weakSelf updateSettings:self->_settings];
|
||||
[weakSelf connectPackager];
|
||||
});
|
||||
|
||||
@ -389,12 +389,12 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
// Hit these setters again after bridge has finished loading
|
||||
self.profilingEnabled = _profilingEnabled;
|
||||
self.liveReloadEnabled = _liveReloadEnabled;
|
||||
self.executorClass = _executorClass;
|
||||
self.profilingEnabled = self->_profilingEnabled;
|
||||
self.liveReloadEnabled = self->_liveReloadEnabled;
|
||||
self.executorClass = self->_executorClass;
|
||||
|
||||
// Inspector can only be shown after JS has loaded
|
||||
if ([_settings[@"showInspector"] boolValue]) {
|
||||
if ([self->_settings[@"showInspector"] boolValue]) {
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
[self.bridge.eventDispatcher sendDeviceEventWithName:@"toggleElementInspector" body:nil];
|
||||
@ -457,8 +457,8 @@ RCT_EXPORT_MODULE()
|
||||
if (!jsDebuggingExecutorClass) {
|
||||
[items addObject:[RCTDevMenuItem buttonItemWithTitle:[NSString stringWithFormat:@"%@ Debugger Unavailable", _webSocketExecutorName] handler:^{
|
||||
UIAlertView *alert = RCTAlertView(
|
||||
[NSString stringWithFormat:@"%@ Debugger Unavailable", _webSocketExecutorName],
|
||||
[NSString stringWithFormat:@"You need to include the RCTWebSocket library to enable %@ debugging", _webSocketExecutorName],
|
||||
[NSString stringWithFormat:@"%@ Debugger Unavailable", self->_webSocketExecutorName],
|
||||
[NSString stringWithFormat:@"You need to include the RCTWebSocket library to enable %@ debugging", self->_webSocketExecutorName],
|
||||
nil,
|
||||
@"OK",
|
||||
nil);
|
||||
@ -476,19 +476,19 @@ RCT_EXPORT_MODULE()
|
||||
if (_liveReloadURL) {
|
||||
NSString *liveReloadTitle = _liveReloadEnabled ? @"Disable Live Reload" : @"Enable Live Reload";
|
||||
[items addObject:[RCTDevMenuItem buttonItemWithTitle:liveReloadTitle handler:^{
|
||||
weakSelf.liveReloadEnabled = !_liveReloadEnabled;
|
||||
weakSelf.liveReloadEnabled = !self->_liveReloadEnabled;
|
||||
}]];
|
||||
|
||||
NSString *profilingTitle = RCTProfileIsProfiling() ? @"Stop Systrace" : @"Start Systrace";
|
||||
[items addObject:[RCTDevMenuItem buttonItemWithTitle:profilingTitle handler:^{
|
||||
weakSelf.profilingEnabled = !_profilingEnabled;
|
||||
weakSelf.profilingEnabled = !self->_profilingEnabled;
|
||||
}]];
|
||||
}
|
||||
|
||||
if ([self hotLoadingAvailable]) {
|
||||
NSString *hotLoadingTitle = _hotLoadingEnabled ? @"Disable Hot Reloading" : @"Enable Hot Reloading";
|
||||
[items addObject:[RCTDevMenuItem buttonItemWithTitle:hotLoadingTitle handler:^{
|
||||
weakSelf.hotLoadingEnabled = !_hotLoadingEnabled;
|
||||
weakSelf.hotLoadingEnabled = !self->_hotLoadingEnabled;
|
||||
}]];
|
||||
}
|
||||
|
||||
@ -576,7 +576,7 @@ RCT_EXPORT_METHOD(reload)
|
||||
[_bridge startProfiling];
|
||||
} else {
|
||||
[_bridge stopProfiling:^(NSData *logData) {
|
||||
RCTProfileSendResult(_bridge, @"systrace", logData);
|
||||
RCTProfileSendResult(self->_bridge, @"systrace", logData);
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
@ -359,18 +359,18 @@ RCT_EXPORT_MODULE()
|
||||
- (void)showErrorMessage:(NSString *)message withStack:(NSArray<NSDictionary *> *)stack isUpdate:(BOOL)isUpdate
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (!_window) {
|
||||
_window = [[RCTRedBoxWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
||||
_window.actionDelegate = self;
|
||||
if (!self->_window) {
|
||||
self->_window = [[RCTRedBoxWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
||||
self->_window.actionDelegate = self;
|
||||
}
|
||||
[_window showErrorMessage:message withStack:stack isUpdate:isUpdate];
|
||||
[self->_window showErrorMessage:message withStack:stack isUpdate:isUpdate];
|
||||
});
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(dismiss)
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[_window dismiss];
|
||||
[self->_window dismiss];
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -271,15 +271,15 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"UIManager invalidate", nil);
|
||||
for (NSNumber *rootViewTag in _rootViewTags) {
|
||||
[(id<RCTInvalidating>)_viewRegistry[rootViewTag] invalidate];
|
||||
for (NSNumber *rootViewTag in self->_rootViewTags) {
|
||||
[(id<RCTInvalidating>)self->_viewRegistry[rootViewTag] invalidate];
|
||||
}
|
||||
|
||||
_rootViewTags = nil;
|
||||
_shadowViewRegistry = nil;
|
||||
_viewRegistry = nil;
|
||||
_bridgeTransactionListeners = nil;
|
||||
_bridge = nil;
|
||||
self->_rootViewTags = nil;
|
||||
self->_shadowViewRegistry = nil;
|
||||
self->_viewRegistry = nil;
|
||||
self->_bridgeTransactionListeners = nil;
|
||||
self->_bridge = nil;
|
||||
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"", nil);
|
||||
@ -386,7 +386,7 @@ dispatch_queue_t RCTGetUIManagerQueue(void)
|
||||
__weak RCTUIManager *weakSelf = self;
|
||||
dispatch_async(RCTGetUIManagerQueue(), ^{
|
||||
RCTUIManager *strongSelf = weakSelf;
|
||||
if (!_viewRegistry) {
|
||||
if (!self->_viewRegistry) {
|
||||
return;
|
||||
}
|
||||
RCTRootShadowView *shadowView = [RCTRootShadowView new];
|
||||
@ -426,7 +426,7 @@ dispatch_queue_t RCTGetUIManagerQueue(void)
|
||||
|
||||
NSNumber *reactTag = view.reactTag;
|
||||
dispatch_async(RCTGetUIManagerQueue(), ^{
|
||||
RCTShadowView *shadowView = _shadowViewRegistry[reactTag];
|
||||
RCTShadowView *shadowView = self->_shadowViewRegistry[reactTag];
|
||||
RCTAssert(shadowView != nil, @"Could not locate shadow view with tag #%@", reactTag);
|
||||
|
||||
BOOL dirtyLayout = NO;
|
||||
@ -459,7 +459,7 @@ dispatch_queue_t RCTGetUIManagerQueue(void)
|
||||
|
||||
NSNumber *reactTag = view.reactTag;
|
||||
dispatch_async(RCTGetUIManagerQueue(), ^{
|
||||
RCTShadowView *shadowView = _shadowViewRegistry[reactTag];
|
||||
RCTShadowView *shadowView = self->_shadowViewRegistry[reactTag];
|
||||
RCTAssert(shadowView != nil, @"Could not locate root view with tag #%@", reactTag);
|
||||
|
||||
shadowView.intrinsicContentSize = size;
|
||||
@ -477,7 +477,7 @@ dispatch_queue_t RCTGetUIManagerQueue(void)
|
||||
__weak RCTUIManager *weakSelf = self;
|
||||
dispatch_async(RCTGetUIManagerQueue(), ^{
|
||||
RCTUIManager *strongSelf = weakSelf;
|
||||
if (!_viewRegistry) {
|
||||
if (!self->_viewRegistry) {
|
||||
return;
|
||||
}
|
||||
RCTShadowView *shadowView = strongSelf->_shadowViewRegistry[reactTag];
|
||||
@ -502,8 +502,8 @@ dispatch_queue_t RCTGetUIManagerQueue(void)
|
||||
}
|
||||
[registry removeObjectForKey:subview.reactTag];
|
||||
|
||||
if (registry == (NSMutableDictionary<NSNumber *, id<RCTComponent>> *)_viewRegistry) {
|
||||
[_bridgeTransactionListeners removeObject:subview];
|
||||
if (registry == (NSMutableDictionary<NSNumber *, id<RCTComponent>> *)self->_viewRegistry) {
|
||||
[self->_bridgeTransactionListeners removeObject:subview];
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -609,7 +609,7 @@ dispatch_queue_t RCTGetUIManagerQueue(void)
|
||||
CGSize contentSize = shadowView.frame.size;
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
UIView *view = _viewRegistry[reactTag];
|
||||
UIView *view = self->_viewRegistry[reactTag];
|
||||
RCTAssert(view != nil, @"view (for ID %@) not found", reactTag);
|
||||
|
||||
RCTRootView *rootView = (RCTRootView *)[view superview];
|
||||
@ -802,7 +802,7 @@ RCT_EXPORT_METHOD(removeSubviewsFromContainerWithID:(nonnull NSNumber *)containe
|
||||
void (^completion)(BOOL) = ^(BOOL finished) {
|
||||
completionsCalled++;
|
||||
|
||||
[_viewsToBeDeleted removeObject:removedChild];
|
||||
[self->_viewsToBeDeleted removeObject:removedChild];
|
||||
[container removeReactSubview:removedChild];
|
||||
|
||||
if (animation.callback && completionsCalled == children.count) {
|
||||
|
@ -97,7 +97,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
|
||||
_maxFPS = MAX(_maxFPS, _FPS);
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
_label.text = [NSString stringWithFormat:@"%lu", (unsigned long)_FPS];
|
||||
self->_label.text = [NSString stringWithFormat:@"%lu", (unsigned long)self->_FPS];
|
||||
});
|
||||
|
||||
CGFloat scale = 60.0 / _height;
|
||||
|
@ -329,9 +329,9 @@ RCT_EXPORT_MODULE()
|
||||
[self.container addSubview:self.jsGraph];
|
||||
[self.container addSubview:self.jsGraphLabel];
|
||||
[executor executeBlockOnJavaScriptQueue:^{
|
||||
_jsDisplayLink = [CADisplayLink displayLinkWithTarget:self
|
||||
self->_jsDisplayLink = [CADisplayLink displayLinkWithTarget:self
|
||||
selector:@selector(threadUpdate:)];
|
||||
[_jsDisplayLink addToRunLoop:[NSRunLoop currentRunLoop]
|
||||
[self->_jsDisplayLink addToRunLoop:[NSRunLoop currentRunLoop]
|
||||
forMode:NSRunLoopCommonModes];
|
||||
}];
|
||||
}
|
||||
@ -398,7 +398,7 @@ RCT_EXPORT_MODULE()
|
||||
const void *buffer,
|
||||
size_t size
|
||||
) {
|
||||
write(_stderr, buffer, size);
|
||||
write(self->_stderr, buffer, size);
|
||||
|
||||
NSString *log = [[NSString alloc] initWithBytes:buffer
|
||||
length:size
|
||||
@ -495,8 +495,8 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
[UIView animateWithDuration:.25 animations:^{
|
||||
CGRect tmp = self.container.frame;
|
||||
self.container.frame = _storedMonitorFrame;
|
||||
_storedMonitorFrame = tmp;
|
||||
self.container.frame = self->_storedMonitorFrame;
|
||||
self->_storedMonitorFrame = tmp;
|
||||
}];
|
||||
}
|
||||
|
||||
|
@ -343,7 +343,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
|
||||
}
|
||||
|
||||
[props enumerateKeysAndObjectsUsingBlock:^(NSString *key, id json, __unused BOOL *stop) {
|
||||
[self propBlockForKey:key inDictionary:_viewPropBlocks](view, json);
|
||||
[self propBlockForKey:key inDictionary:self->_viewPropBlocks](view, json);
|
||||
}];
|
||||
|
||||
if ([view respondsToSelector:@selector(didSetProps:)]) {
|
||||
@ -358,7 +358,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
|
||||
}
|
||||
|
||||
[props enumerateKeysAndObjectsUsingBlock:^(NSString *key, id json, __unused BOOL *stop) {
|
||||
[self propBlockForKey:key inDictionary:_shadowPropBlocks](shadowView, json);
|
||||
[self propBlockForKey:key inDictionary:self->_shadowPropBlocks](shadowView, json);
|
||||
}];
|
||||
|
||||
if ([shadowView respondsToSelector:@selector(didSetProps:)]) {
|
||||
|
@ -61,18 +61,18 @@ const CGFloat RCTMapZoomBoundBuffer = 0.01;
|
||||
|
||||
if (_legalLabel) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
CGRect frame = _legalLabel.frame;
|
||||
if (_legalLabelInsets.left) {
|
||||
frame.origin.x = _legalLabelInsets.left;
|
||||
} else if (_legalLabelInsets.right) {
|
||||
frame.origin.x = self.frame.size.width - _legalLabelInsets.right - frame.size.width;
|
||||
CGRect frame = self->_legalLabel.frame;
|
||||
if (self->_legalLabelInsets.left) {
|
||||
frame.origin.x = self->_legalLabelInsets.left;
|
||||
} else if (self->_legalLabelInsets.right) {
|
||||
frame.origin.x = self.frame.size.width - self->_legalLabelInsets.right - frame.size.width;
|
||||
}
|
||||
if (_legalLabelInsets.top) {
|
||||
frame.origin.y = _legalLabelInsets.top;
|
||||
} else if (_legalLabelInsets.bottom) {
|
||||
frame.origin.y = self.frame.size.height - _legalLabelInsets.bottom - frame.size.height;
|
||||
if (self->_legalLabelInsets.top) {
|
||||
frame.origin.y = self->_legalLabelInsets.top;
|
||||
} else if (self->_legalLabelInsets.bottom) {
|
||||
frame.origin.y = self.frame.size.height - self->_legalLabelInsets.bottom - frame.size.height;
|
||||
}
|
||||
_legalLabel.frame = frame;
|
||||
self->_legalLabel.frame = frame;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -101,8 +101,8 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:coder)
|
||||
_modalViewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
|
||||
}
|
||||
[self.reactViewController presentViewController:_modalViewController animated:[self hasAnimationType] completion:^{
|
||||
if (_onShow) {
|
||||
_onShow(nil);
|
||||
if (self->_onShow) {
|
||||
self->_onShow(nil);
|
||||
}
|
||||
}];
|
||||
_isPresented = YES;
|
||||
|
@ -395,24 +395,24 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
|
||||
(RCTWrapperViewController *)[context viewControllerForKey:UITransitionContextToViewControllerKey];
|
||||
|
||||
// This may be triggered by a navigation controller unrelated to me: if so, ignore.
|
||||
if (fromController.navigationController != _navigationController ||
|
||||
toController.navigationController != _navigationController) {
|
||||
if (fromController.navigationController != self->_navigationController ||
|
||||
toController.navigationController != self->_navigationController) {
|
||||
return;
|
||||
}
|
||||
|
||||
NSUInteger indexOfFrom = [self.reactSubviews indexOfObject:fromController.navItem];
|
||||
NSUInteger indexOfTo = [self.reactSubviews indexOfObject:toController.navItem];
|
||||
CGFloat destination = indexOfFrom < indexOfTo ? 1.0 : -1.0;
|
||||
_dummyView.frame = (CGRect){{destination, 0}, CGSizeZero};
|
||||
_currentlyTransitioningFrom = indexOfFrom;
|
||||
_currentlyTransitioningTo = indexOfTo;
|
||||
self->_dummyView.frame = (CGRect){{destination, 0}, CGSizeZero};
|
||||
self->_currentlyTransitioningFrom = indexOfFrom;
|
||||
self->_currentlyTransitioningTo = indexOfTo;
|
||||
self.paused = NO;
|
||||
}
|
||||
completion:^(__unused id<UIViewControllerTransitionCoordinatorContext> context) {
|
||||
[weakSelf freeLock];
|
||||
_currentlyTransitioningFrom = 0;
|
||||
_currentlyTransitioningTo = 0;
|
||||
_dummyView.frame = CGRectZero;
|
||||
self->_currentlyTransitioningFrom = 0;
|
||||
self->_currentlyTransitioningTo = 0;
|
||||
self->_dummyView.frame = CGRectZero;
|
||||
self.paused = YES;
|
||||
// Reset the parallel position tracker
|
||||
}];
|
||||
|
@ -653,12 +653,12 @@ RCT_SCROLL_EVENT_HANDLER(scrollViewDidZoom, onScroll)
|
||||
// Check if new or changed
|
||||
CGRect newFrame = subview.frame;
|
||||
BOOL frameChanged = NO;
|
||||
if (_cachedChildFrames.count <= idx) {
|
||||
if (self->_cachedChildFrames.count <= idx) {
|
||||
frameChanged = YES;
|
||||
[_cachedChildFrames addObject:[NSValue valueWithCGRect:newFrame]];
|
||||
} else if (!CGRectEqualToRect(newFrame, [_cachedChildFrames[idx] CGRectValue])) {
|
||||
[self->_cachedChildFrames addObject:[NSValue valueWithCGRect:newFrame]];
|
||||
} else if (!CGRectEqualToRect(newFrame, [self->_cachedChildFrames[idx] CGRectValue])) {
|
||||
frameChanged = YES;
|
||||
_cachedChildFrames[idx] = [NSValue valueWithCGRect:newFrame];
|
||||
self->_cachedChildFrames[idx] = [NSValue valueWithCGRect:newFrame];
|
||||
}
|
||||
|
||||
// Create JS frame object
|
||||
|
@ -185,7 +185,7 @@ static void RCTProcessMetaProps(const float metaProps[META_PROP_COUNT], float st
|
||||
_didUpdateSubviews = NO;
|
||||
[self didUpdateReactSubviews];
|
||||
[applierBlocks addObject:^(NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
||||
UIView *view = viewRegistry[_reactTag];
|
||||
UIView *view = viewRegistry[self->_reactTag];
|
||||
[view clearSortedSubviews];
|
||||
[view didUpdateReactSubviews];
|
||||
}];
|
||||
@ -195,7 +195,7 @@ static void RCTProcessMetaProps(const float metaProps[META_PROP_COUNT], float st
|
||||
UIColor *parentBackgroundColor = parentProperties[RCTBackgroundColorProp];
|
||||
if (parentBackgroundColor) {
|
||||
[applierBlocks addObject:^(NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
||||
UIView *view = viewRegistry[_reactTag];
|
||||
UIView *view = viewRegistry[self->_reactTag];
|
||||
[view reactSetInheritedBackgroundColor:parentBackgroundColor];
|
||||
}];
|
||||
}
|
||||
|
@ -107,16 +107,16 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
|
||||
[self.reactSubviews enumerateObjectsUsingBlock:^(UIView *view, NSUInteger index, __unused BOOL *stop) {
|
||||
|
||||
RCTTabBarItem *tab = (RCTTabBarItem *)view;
|
||||
UIViewController *controller = _tabController.viewControllers[index];
|
||||
if (_unselectedTintColor) {
|
||||
[tab.barItem setTitleTextAttributes:@{NSForegroundColorAttributeName: _unselectedTintColor} forState:UIControlStateNormal];
|
||||
UIViewController *controller = self->_tabController.viewControllers[index];
|
||||
if (self->_unselectedTintColor) {
|
||||
[tab.barItem setTitleTextAttributes:@{NSForegroundColorAttributeName: self->_unselectedTintColor} forState:UIControlStateNormal];
|
||||
}
|
||||
|
||||
[tab.barItem setTitleTextAttributes:@{NSForegroundColorAttributeName: self.tintColor} forState:UIControlStateSelected];
|
||||
|
||||
controller.tabBarItem = tab.barItem;
|
||||
if (tab.selected) {
|
||||
_tabController.selectedViewController = controller;
|
||||
self->_tabController.selectedViewController = controller;
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user