It looks to me like this is a bug:
The code is taking the whole URL and escaping anything that is not a valid character in the “host” part of the URL:
I think the only sensible thing for this code to do is expect a validly formatted URL that it passes to the
URLWithString method. If the string turns out not to be a valid URL then the result will be nil and perhaps the
createEventAsync call can return a promise that resolves to an error to indicate that.
createEventAsync wants to do the escaping it would probably have to accept the parts of the URL and escape them as appropriate before constructing the full URL. e.g. (but of course irrelevant parts could be left out):
pathComponents: ["/", "script.ext"],
I think the first option makes more sense.
Could you create a new issue at https://github.com/expo/expo/issues?