Skip to content

Commit

Permalink
fix(iOS): Replace unsupported nullish coalescing operator for older i…
Browse files Browse the repository at this point in the history
…OS versions
  • Loading branch information
kowoohyuk authored and TheAlmightyBob committed Apr 19, 2024
1 parent 7420ed8 commit 9979a98
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions apple/RNCWebViewImpl.m
Original file line number Diff line number Diff line change
Expand Up @@ -1635,10 +1635,10 @@ - (void)setInjectedJavaScriptObject:(NSString *)source
initWithSource: [
NSString
stringWithFormat:
@"window.%@ ??= {};"
@"window.%@ = window.%@ || {};"
"window.%@.injectedObjectJson = function () {"
" return `%@`;"
"};", MessageHandlerName, MessageHandlerName, source
"};", MessageHandlerName, MessageHandlerName, MessageHandlerName, source
]
injectionTime:WKUserScriptInjectionTimeAtDocumentStart
/* TODO: For a separate (minor) PR: use logic like this (as react-native-wkwebview does) so that messaging can be used in all frames if desired.
Expand Down Expand Up @@ -1686,10 +1686,10 @@ - (void)setMessagingEnabled:(BOOL)messagingEnabled {
initWithSource: [
NSString
stringWithFormat:
@"window.%@ ??= {};"
@"window.%@ = window.%@ || {};"
"window.%@.postMessage = function (data) {"
" window.webkit.messageHandlers.%@.postMessage(String(data));"
"};", MessageHandlerName, MessageHandlerName, MessageHandlerName
"};", MessageHandlerName, MessageHandlerName, MessageHandlerName, MessageHandlerName
]
injectionTime:WKUserScriptInjectionTimeAtDocumentStart
/* TODO: For a separate (minor) PR: use logic like this (as react-native-wkwebview does) so that messaging can be used in all frames if desired.
Expand Down

0 comments on commit 9979a98

Please sign in to comment.