diff --git a/ios/RCTFBSDK/login/RCTFBSDKLoginButtonManager.m b/ios/RCTFBSDK/login/RCTFBSDKLoginButtonManager.m index 6a02965e..ca865b01 100644 --- a/ios/RCTFBSDK/login/RCTFBSDKLoginButtonManager.m +++ b/ios/RCTFBSDK/login/RCTFBSDKLoginButtonManager.m @@ -19,7 +19,6 @@ #import "RCTFBSDKLoginButtonManager.h" #import -#import #import #import #import @@ -59,8 +58,9 @@ - (UIView *)view - (void)loginButton:(FBSDKLoginButton *)loginButton didCompleteWithResult:(FBSDKLoginManagerLoginResult *)result error:(NSError *)error { - NSDictionary *body = @{ + NSDictionary *event = @{ @"type": @"loginFinished", + @"target": loginButton.reactTag, @"error": error ? RCTJSErrorFromNSError(error) : [NSNull null], @"result": error ? [NSNull null] : @{ @"isCancelled": @(result.isCancelled), @@ -68,23 +68,16 @@ - (void)loginButton:(FBSDKLoginButton *)loginButton didCompleteWithResult:(FBSDK @"declinedPermissions": result.isCancelled ? [NSNull null] : result.declinedPermissions.allObjects, }, }; - - RCTComponentEvent *event = [[RCTComponentEvent alloc] initWithName:@"topChange" - viewTag:loginButton.reactTag - body:body]; - [self.bridge.eventDispatcher sendEvent:event]; + [self.bridge.eventDispatcher sendInputEventWithName:@"topChange" body:event]; } - (void)loginButtonDidLogOut:(FBSDKLoginButton *)loginButton { - NSDictionary *body = @{ + NSDictionary *event = @{ + @"target": loginButton.reactTag, @"type": @"logoutFinished", }; - - RCTComponentEvent *event = [[RCTComponentEvent alloc] initWithName:@"topChange" - viewTag:loginButton.reactTag - body:body]; - [self.bridge.eventDispatcher sendEvent:event]; + [self.bridge.eventDispatcher sendInputEventWithName:@"topChange" body:event]; } @end