Skip to content

Commit

Permalink
fix(ios): fixed an error when getBoundingClientRect's options was null
Browse files Browse the repository at this point in the history
  • Loading branch information
wwwcg authored and hippy-actions[bot] committed Dec 21, 2023
1 parent 276d26e commit d03bef0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions renderer/native/ios/renderer/component/view/HippyViewManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ - (HippyViewManagerUIBlock)uiBlockToAmendWithShadowViewRegistry:(__unused NSDict
HIPPY_EXPORT_METHOD(getBoundingClientRect:(nonnull NSNumber *)hippyTag
options:(nullable NSDictionary *)options
callback:(HippyPromiseResolveBlock)callback ) {
if (options && [[options objectForKey:HippyViewManagerGetBoundingRelToContainerKey] boolValue]) {
if (options && [options isKindOfClass:NSDictionary.class] &&
[[options objectForKey:HippyViewManagerGetBoundingRelToContainerKey] boolValue]) {
[self measureInWindow:hippyTag withErrMsg:YES callback:callback];
} else {
[self measureInAppWindow:hippyTag withErrMsg:YES callback:callback];
Expand Down Expand Up @@ -118,7 +119,7 @@ - (void)measureInWindow:(NSNumber *)componentTag
}

HIPPY_EXPORT_METHOD(measureInAppWindow:(NSNumber *)componentTag
callback:(HippyPromiseResolveBlock)callback) {
callback:(HippyPromiseResolveBlock)callback) {
[self measureInAppWindow:componentTag withErrMsg:NO callback:callback];
}

Expand All @@ -141,8 +142,8 @@ - (void)measureInAppWindow:(NSNumber *)componentTag
}

HIPPY_EXPORT_METHOD(getScreenShot:(nonnull NSNumber *)componentTag
params:(NSDictionary *__nonnull)params
callback:(HippyPromiseResolveBlock)callback) {
params:(NSDictionary *__nonnull)params
callback:(HippyPromiseResolveBlock)callback) {
[self.bridge.uiManager addUIBlock:^(__unused HippyUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
UIView *view = viewRegistry[componentTag];
if (view == nil) {
Expand Down Expand Up @@ -181,8 +182,8 @@ - (void)measureInAppWindow:(NSNumber *)componentTag
}

HIPPY_EXPORT_METHOD(getLocationOnScreen:(nonnull NSNumber *)componentTag
params:(NSDictionary *__nonnull)params
callback:(HippyPromiseResolveBlock)callback) {
params:(NSDictionary *__nonnull)params
callback:(HippyPromiseResolveBlock)callback) {
[self.bridge.uiManager addUIBlock:^(__unused HippyUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
UIView *view = viewRegistry[componentTag];
if (view == nil) {
Expand Down

0 comments on commit d03bef0

Please sign in to comment.