Skip to content

cbrevik/arrayReverseBug

Repository files navigation

React Native Array.reverse bug

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());

Using this example

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+.

Screenshots

If your device/simulator is running iOS 12, the following should be displayed:

Buggy iOS 12 screenshot

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:

Non-buggy iOS 12 screenshot

Links

About

Example of the Array.reverse-bug in iOS 12 with React Native

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published