React-native: flatMap is not a function on iOS 10

Created on 31 Aug 2019  路  9Comments  路  Source: facebook/react-native

React Native version:

0.59.10

Steps To Reproduce

  1. Run your app on iOS 10
  2. Use Array.prototype.flatMap, e.g. [].flatMap(item => item)

Describe what you expected to happen:
Should work like on other OS and platforms

Probably other new ES features don't work too

Snack, code example, screenshot, or link to a repository:

Bug iOS Stale

Most helpful comment

This is happening in RN version 0.60.4 too

Edit
Now I'm seeing the issue on iOS 11 also, with "react-native": "0.61.4"

All 9 comments

This is happening in RN version 0.60.4 too

Edit
Now I'm seeing the issue on iOS 11 also, with "react-native": "0.61.4"

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

Still seeing this on react native 0.61.5 iOS 11

I am seeing this on iOS 11.3 and Expo 36 version of React native.

Seems flatMap will work iOS 12 and above only.

Safari iOS added support from iOS 12 onwards - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flatMap

How would you configure react-native to use a polyfill for flatMap on systems that don't support it?

To support iOS 11 and below, you can add array-flat-polyfill to your project, then add to your App.js:

import 'array-flat-polyfill'

It will only add the polyfill, if it doesn't already exist.

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

Was this page helpful?
0 / 5 - 0 ratings