Skip to content

Commit

Permalink
Revert "Use RCTComponentEvent (facebookarchive#487)"
Browse files Browse the repository at this point in the history
This reverts commit 3eb205e.
  • Loading branch information
mdaines-root committed Oct 30, 2019
1 parent 5d016be commit 454a3a4
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions ios/RCTFBSDK/login/RCTFBSDKLoginButtonManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#import "RCTFBSDKLoginButtonManager.h"

#import <React/RCTBridge.h>
#import <React/RCTComponentEvent.h>
#import <React/RCTEventDispatcher.h>
#import <React/RCTUtils.h>
#import <React/UIView+React.h>
Expand Down Expand Up @@ -59,32 +58,26 @@ - (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),
@"grantedPermissions": result.isCancelled ? [NSNull null] : result.grantedPermissions.allObjects,
@"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

0 comments on commit 454a3a4

Please sign in to comment.