Search code examples
iosreactjscreate-react-app

reactjs not loading on iOS


My react web app is not loading on iOS, especially v15.5.

Only black page is loaded when I access to the website using iPhone or iPad.

Is there a way to solve this problem?


Solution

  • The issue is happening because of regex usage. Looks like Safari doesn't support lookbehind yet (that is, your (?<=/)). One alternative would be to put the / that comes before in a non-captured group, and then extract only the first group (the content after the / and before the #).

    /(?:\/)([^#]+)(?=#*)/
    

    Also, (?=#*) is odd - you probably want to lookahead for something (such as # or the end of the string), rather than a * quantifier (zero or more occurrences of #). It might be better to use something like

    /(?:\/)([^#]+)(?=#|$)/
    

    or just omit the lookahead entirely (because the ([^#]+) is greedy), depending on your circumstances.