Skip to content

Commit ce3a399

Browse files
committed
merged #138
- fixes single quote escaping in json payload
1 parent c730087 commit ce3a399

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ios/RCTWebViewBridge.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,10 @@ - (void)sendToBridge:(NSString *)message
8787
}
8888
}());
8989
);
90+
// Escape singlequotes or messages containing ' will fail
91+
NSString *quotedMessage = [message stringByReplacingOccurrencesOfString:@"'" withString:@"\\'"];
9092

91-
NSString *command = [NSString stringWithFormat: format, message];
93+
NSString *command = [NSString stringWithFormat: format, quotedMessage];
9294
[_webView stringByEvaluatingJavaScriptFromString:command];
9395
}
9496

0 commit comments

Comments
 (0)