This is an example app to demonstrate that the Array.reverse
bug for iOS 12 exists in React Native as well.
Some have called to calling this a "Safari bug", but that is misleading. The bug exists in the JavascriptCore
-framework for iOS, which several other apps/frameworks depend upon, React Native among them.
Buggy-check code borrowed from the array-reverse-polyfill-package:
var a = [1, 2];
return String(a) === String(a.reverse());
If you have Xcode + React Native dependencies installed, from terminal run:
git clone git@github.com:cbrevik/arrayReverseBug.git
cd arrayReverseBug
yarn install
react-native run-ios --device "The name of your iPhone with iOS 12"
This example will also work using iOS simulator if you have Xcode 10+.
If your device/simulator is running iOS 12, the following should be displayed:
Important! If the React Native remote debugger is attached, the bug will not occur.
This is because the remote debugger uses Chrome, instead of JavascriptCore
: