Fixed broken struct arguments
This commit is contained in:
parent
b4c82a4089
commit
fc6e209223
|
@ -163,12 +163,12 @@ RCT_EXPORT_MODULE()
|
|||
|
||||
#pragma mark - Public API
|
||||
|
||||
RCT_EXPORT_METHOD(startObserving:(RCTLocationOptions)options)
|
||||
RCT_EXPORT_METHOD(startObserving:(NSDictionary *)optionsJSON)
|
||||
{
|
||||
[self checkLocationConfig];
|
||||
|
||||
// Select best options
|
||||
_observerOptions = options;
|
||||
_observerOptions = [RCTConvert RCTLocationOptions:optionsJSON];
|
||||
for (RCTLocationRequest *request in _pendingRequests) {
|
||||
_observerOptions.accuracy = MIN(_observerOptions.accuracy, request.options.accuracy);
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ RCT_EXPORT_METHOD(stopObserving)
|
|||
}
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(getCurrentPosition:(RCTLocationOptions)options
|
||||
RCT_EXPORT_METHOD(getCurrentPosition:(NSDictionary *)optionsJSON
|
||||
withSuccessCallback:(RCTResponseSenderBlock)successBlock
|
||||
errorCallback:(RCTResponseSenderBlock)errorBlock)
|
||||
{
|
||||
|
@ -219,6 +219,7 @@ RCT_EXPORT_METHOD(getCurrentPosition:(RCTLocationOptions)options
|
|||
}
|
||||
|
||||
// Check if previous recorded location exists and is good enough
|
||||
RCTLocationOptions options = [RCTConvert RCTLocationOptions:optionsJSON];
|
||||
if (_lastLocationEvent &&
|
||||
CFAbsoluteTimeGetCurrent() - [RCTConvert NSTimeInterval:_lastLocationEvent[@"timestamp"]] < options.maximumAge &&
|
||||
[_lastLocationEvent[@"coords"][@"accuracy"] doubleValue] >= options.accuracy) {
|
||||
|
|
|
@ -375,10 +375,14 @@ static NSString *RCTStringUpToFirstArgument(NSString *methodName)
|
|||
RCT_CONVERT_CASE('B', BOOL)
|
||||
RCT_CONVERT_CASE('@', id)
|
||||
RCT_CONVERT_CASE('^', void *)
|
||||
|
||||
case '{':
|
||||
RCTAssert(NO, @"Argument %zd of %C[%@ %@] is defined as %@, however RCT_EXPORT_METHOD() "
|
||||
"does not currently support struct-type arguments.", i - 2,
|
||||
[reactMethodName characterAtIndex:0], _moduleClassName,
|
||||
objCMethodName, argumentName);
|
||||
break;
|
||||
default:
|
||||
defaultCase(argumentType);
|
||||
break;
|
||||
}
|
||||
} else if ([argumentName isEqualToString:@"RCTResponseSenderBlock"]) {
|
||||
addBlockArgument();
|
||||
|
@ -434,7 +438,6 @@ static NSString *RCTStringUpToFirstArgument(NSString *methodName)
|
|||
|
||||
default:
|
||||
defaultCase(argumentType);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1001,11 +1001,12 @@ RCT_EXPORT_METHOD(measureLayoutRelativeToParent:(NSNumber *)reactTag
|
|||
* Only layouts for views that are within the rect passed in are returned. Invokes the error callback if the
|
||||
* passed in parent view does not exist. Invokes the supplied callback with the array of computed layouts.
|
||||
*/
|
||||
RCT_EXPORT_METHOD(measureViewsInRect:(CGRect)rect
|
||||
RCT_EXPORT_METHOD(measureViewsInRect:(id)rectJSON
|
||||
parentView:(NSNumber *)reactTag
|
||||
errorCallback:(RCTResponseSenderBlock)errorCallback
|
||||
callback:(RCTResponseSenderBlock)callback)
|
||||
{
|
||||
CGRect rect = [RCTConvert CGRect:rectJSON];
|
||||
RCTShadowView *shadowView = _shadowViewRegistry[reactTag];
|
||||
if (!shadowView) {
|
||||
RCTLogError(@"Attempting to measure view that does not exist (tag #%@)", reactTag);
|
||||
|
@ -1101,8 +1102,9 @@ RCT_EXPORT_METHOD(scrollWithoutAnimationTo:(NSNumber *)reactTag
|
|||
}
|
||||
|
||||
RCT_EXPORT_METHOD(zoomToRect:(NSNumber *)reactTag
|
||||
withRect:(CGRect)rect)
|
||||
withRect:(id)rectJSON)
|
||||
{
|
||||
CGRect rect = [RCTConvert CGRect:rectJSON];
|
||||
[self addUIBlock:^(RCTUIManager *uiManager, RCTSparseArray *viewRegistry){
|
||||
UIView *view = viewRegistry[reactTag];
|
||||
if ([view conformsToProtocol:@protocol(RCTScrollableProtocol)]) {
|
||||
|
|
Loading…
Reference in New Issue