-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
Bug Description
In NavViewModule.mm, the setFollowingPerspective method declares the perspective parameter as double, but then casts it to NSInteger when passing it to the view controller. This type mismatch can lead to unexpected behavior or subtle bugs when the value is converted.
Location
ios/react-native-navigation-sdk/NavViewModule.mm, in the setFollowingPerspective:perspective:resolve:reject: method.
Current Code
- (void)setFollowingPerspective:(NSString *)nativeID
perspective:(double)perspective
resolve:(RCTPromiseResolveBlock)resolve
reject:(RCTPromiseRejectBlock)reject {
NavViewController *viewController = [self getViewControllerForNativeID:nativeID];
if (viewController) {
dispatch_async(dispatch_get_main_queue(), ^{
[viewController setFollowingPerspective:@((NSInteger)perspective)];
resolve(nil);
});
}
...
}Suggested Fix
Change the parameter type from double to NSInteger to match its actual usage, and remove the unnecessary cast:
- (void)setFollowingPerspective:(NSString *)nativeID
perspective:(NSInteger)perspective
resolve:(RCTPromiseResolveBlock)resolve
reject:(RCTPromiseRejectBlock)reject {
NavViewController *viewController = [self getViewControllerForNativeID:nativeID];
if (viewController) {
dispatch_async(dispatch_get_main_queue(), ^{
[viewController setFollowingPerspective:@(perspective)];
resolve(nil);
});
}
...
}Environment
- SDK version: 0.14.1
- Platform: iOS
- React Native: 0.76+
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels