Skip to content

Commit af2c417

Browse files
committed
Fix #85 - callback associated with button in Alert.alert not working
1 parent 63c6b78 commit af2c417

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

React/Modules/RCTAlertManager.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,10 @@ - (void)invalidate
9999
[_alertCallbacks addObject:callback ?: ^(__unused id unused) {}];
100100
[_alertButtonKeys addObject:buttonKeys];
101101

102-
[alertView runModal];
102+
NSInteger buttonPosition = [alertView runModal];
103+
NSString *buttonKey = [buttonKeys objectAtIndex: buttonPosition - NSAlertFirstButtonReturn];
104+
105+
callback(@[buttonKey]);
103106
}
104107

105108
@end

0 commit comments

Comments
 (0)