Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deeplinking is being interrupted by "Cannot read property 'apply' of undefined". #35577

Closed
seco35 opened this issue Dec 6, 2022 · 34 comments
Closed
Labels
API: Linking Needs: Triage 🔍 Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@seco35
Copy link

seco35 commented Dec 6, 2022

Description

This error occured after upgrading to 0.7x from 0.67 and deeplink worked properly before doing the upgrade.

Have to mention that in both cases (background state & starting through deeplink) the url of the deeplink is there (looking with console.log()).
This error is being thrown only if the app is in background, starting the app through deeplink throws no error.

TypeError: Cannot read property 'apply' of undefined, js engine: hermes

While debugging on simulator, I could just minimize the thrown error and actions defined for the deeplink are processed properly. However the thrown error seems to block the execution of the deeplink actions on a real device.

The error is caused as shown in the thrown error at emit()-method of EventEmitter.js (Line 105):

registration.listener.apply(registration.context, args);

Adding a check if the listener is undefined before execution solves the issue for me and deeplink works as expected (both on the simulator and the real device):

if(typeof registration.listener !== "undefined" )
          registration.listener.apply(registration.context, args);

Unfortunately I am not sure, how this does effect the app in general and whether it must be solved by doing something else.

Version

0.70.4

Output of npx react-native info

System:
OS: macOS 13.0
CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
Memory: 32.26 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.14.0 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 8.3.1 - /usr/local/bin/npm
Watchman: 2022.03.21.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 16.0, macOS 12.3, tvOS 16.0, watchOS 9.0
Android SDK:
API Levels: 30, 31, 32
Build Tools: 30.0.2, 30.0.3, 32.0.0, 32.1.0
System Images: android-30 | Google APIs Intel x86 Atom, android-30 | Google Play Intel x86 Atom, android-31 | Google Play Intel x86 Atom_64
Android NDK: Not Found
IDEs:
Android Studio: 2021.2 AI-212.5712.43.2112.8609683
Xcode: 14.0.1/14A400 - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_322 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.1.0 => 18.1.0
react-native: 0.70.4 => 0.70.4
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps to reproduce

Create a project and configure deeplinking using the docs.

Add to AppDelegate.m:

- (BOOL)application:(UIApplication *)application
   openURL:(NSURL *)url
   options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
  return [RCTLinkingManager application:application openURL:url options:options];
}

- (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity
 restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler
{
 return [RCTLinkingManager application:application
                  continueUserActivity:userActivity
                    restorationHandler:restorationHandler];
}

in JSX:

 Linking.getInitialURL().then(url => { //ACTIONS FOR DEEPLINK START }
 Linking.addEventListener('url',(url)=>{ //ACTIONS FOR DEEPLINK DURING RUNTIME})

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

Bug

@s123121
Copy link

s123121 commented Dec 9, 2022

Upgrading from 0.67 to 0.70.6 and meet exactly this problem

@taoqf
Copy link

taoqf commented Dec 10, 2022

I came to this, too. and I find the null modules is always the multiple depended in my project.

@seco35 seco35 mentioned this issue Dec 12, 2022
@olosegres
Copy link

Same problem after update to 0.70.6

@seco35
Copy link
Author

seco35 commented Dec 20, 2022

@olosegres @s123121 @taoqf
Have you tried the workaround (adding check for undefined)? Does it solve your issues too?

@SerafinAna
Copy link

SerafinAna commented Dec 29, 2022

I also have this issue with React native 0.69.7
does anyone use in the project firebase package. maybe this is causing the problem

@seco35
Copy link
Author

seco35 commented Jan 9, 2023

I also have this issue with React native 0.69.7

does anyone use in the project firebase package. maybe this is causing the problem

No firebase usage within my project.

@gdeusdara
Copy link

Same problem after updating to 0.71.0

@iBotPeaches
Copy link
Contributor

@seco35 - I investigated this and I believe a regression occurred in this commit - e5c5dcd

old

// The subscription may have been removed during this event loop.
if (subscription && subscription.listener) {
    subscription.listener.apply(subscription.context, args);
}

new

if (registrations != null) {
    for (const registration of [...registrations]) {
        registration.listener.apply(registration.context, args);
    }
}

It seems a possibility that we could have a registration without listener. I'm guessing since this was changed in RN70 that it might be at least the original issue reported here. Thought the typing looks like this shouldn't be possible :/

TypeError: Cannot read property 'apply' of undefined, js engine: hermes

@yungsters - Sorry for ping, but you authored the commit I linked and perhaps have an idea if I'm off base or not on this research.

DerBasler pushed a commit to DerBasler/react-native that referenced this issue Feb 7, 2023
DerBasler pushed a commit to DerBasler/react-native that referenced this issue Feb 8, 2023
@DerBasler
Copy link

Thanks for the investigation @iBotPeaches hopefully they will merge it soon.

@AlexandreMuskus
Copy link

hey guys!

when is this correction expected to be published?

@yungsters
Copy link
Contributor

This error is symptomatic of EventEmitter.addListener(…) being called with a non-function second argument.

Can someone help me understand the source of the non-function value being supplied to the 2nd argument to EventEmitter.addListener(…)? That is what should be fixed here.

cc @javache

@DerBasler
Copy link

DerBasler commented Feb 9, 2023

I was able to evaluate the problematic package in my case was:
import { TextField } from '@ubaids/react-native-material-textfield';
which I replaced with
import { TextField } from 'rn-material-ui-textfield';

But the problem only happened in a specific scenario but I will do some further investigation once I find some time.

**Turns out that only fixed the issue on IOS 🤔 man this is confusing

@gdeusdara
Copy link

I put a console.log in the addListener function:

  addListener<TEvent: $Keys<TEventToArgsMap>>(
    eventType: TEvent,
    listener: (...args: $ElementType<TEventToArgsMap, TEvent>) => mixed,
    context: mixed,
  ): EventSubscription {
    console.log('onAddListener - ', eventType, listener) // <-- THIS LINE HERE
    const registrations = allocate(this._registry, eventType);
    const registration: Registration<$ElementType<TEventToArgsMap, TEvent>> = {
      context,
      listener,
      remove(): void {
        registrations.delete(registration);
      },
    };
    registrations.add(registration);
    return registration;
  }

And in the emit function:

emit<TEvent: $Keys<TEventToArgsMap>>(
    eventType: TEvent,
    ...args: $ElementType<TEventToArgsMap, TEvent>
  ): void {
    const registrations: ?Set<
      Registration<$ElementType<TEventToArgsMap, TEvent>>,
    > = this._registry[eventType];
    console.log('inside emit function - ',eventType, args, registrations, this._registry); // <--- THIS LINE HERE
    if (registrations != null) {
      for (const registration of [...registrations]) {
        registration.listener?.apply(registration.context, args); // <-- also put a verification here to be able to initialize app
      }
    }
  }

It turns out, with the debug version, everything seems to be perfectly fine. like this:
Screenshot 2023-02-09 at 11 13 35

But when I build the release version for android, it comes like this:
Screenshot 2023-02-09 at 11 15 20

So any event I call in my app does not receive a response. Such as Network requests, hardwareBackPress, etc.

I've just migrated from react-native 0.61.5 to 0.71.2.
I am probably doing something wrong.

@javache
Copy link
Member

javache commented Feb 10, 2023

So any event I call in my app does not receive a response.

This seems different from the original issue, which was causing a crash when events were emitted.

Is it possible you have multiple copies of react-native in your application?

@gdeusdara
Copy link

So any event I call in my app does not receive a response.

This seems different from the original issue, which was causing a crash when events were emitted.

Is it possible you have multiple copies of react-native in your application?

This new problem is happening because I used this trick in the first comment:

if(typeof registration.listener !== "undefined" )
registration.listener.apply(registration.context, args);

But, in my case, I just used the ? before .apply

registration.listener?.apply(registration.context, args);

If I don't use this, the same thing described in the original issue happens to me.

TypeError: Cannot read property 'apply' of undefined, js engine: hermes

I was able to make my app work properly by downgrading to version 0.69.8 (which is the last version that doesn't have this new EventEmitter)

@yungsters
Copy link
Contributor

What happens if you change addListener to throw if it receives a non-function second argument?

Do you get an error and more meaningful stack trace?

@gdeusdara
Copy link

gdeusdara commented Feb 10, 2023

@yungsters I put here, like this:

addListener<TEvent: $Keys<TEventToArgsMap>>(
    eventType: TEvent,
    listener: (...args: $ElementType<TEventToArgsMap, TEvent>) => mixed,
    context: mixed,
  ): EventSubscription {

    console.log(eventType, listener, typeof listener) // <-- CONSOLE.LOG HERE
    if (typeof listener != 'function') { // <-- VERIFICATION
      throw new Error(
        'No listener',
      );
    }

    const registrations = allocate(this._registry, eventType);
    const registration: Registration<$ElementType<TEventToArgsMap, TEvent>> = {
      context,
      listener,
      remove(): void {
        registrations.delete(registration);
      },
    };
    registrations.add(registration);
    return registration;
  }

And also this:

console.log('inside emit function - ',eventType, args, registrations, this._registry); // <--- THIS LINE HERE

in the emit function, like in my previous comment.

These are the logs when I initialize the release version of the app:

info Starting logkitty
[11:43:32] D | ReactNative ▶︎ [CodePush] Loading JS bundle from "assets://index.android.bundle"

[11:43:33] I | ReactNativeJS ▶︎ 'didUpdateDimensions', [Function], 'function'

[11:43:33] I | ReactNativeJS ▶︎ 'hardwareBackPress', [Function], 'function'

[11:43:33] I | ReactNativeJS ▶︎ 'keyboardDidShow', [Function], 'function'
                             └ 'keyboardDidHide', [Function], 'function'

[11:43:33] I | ReactNativeJS ▶︎ 'onGestureHandlerEvent', [Function: S], 'function'
                             └ 'onGestureHandlerStateChange', [Function: S], 'function'

[11:43:33] I | ReactNativeJS ▶︎ 'ReactNativeBlobUtilMessage', [Function], 'function'

[11:43:33] I | ReactNativeJS ▶︎ 'ReactNativeBlobUtilMessage', [Function], 'function'

[11:43:33] I | ReactNativeJS ▶︎ 'websocketMessage', [Function], 'function'
                             │ 'websocketOpen', [Function], 'function'
                             └ 'websocketClosed', [Function], 'function'

[11:43:33] I | ReactNativeJS ▶︎ 'websocketFailed', [Function], 'function'

[11:43:33] I | ReactNativeJS ▶︎ 'appearanceChanged', [Function], 'function'

[11:43:33] I | ReactNativeJS ▶︎ Running "myApp
                             │ 'collectBugExtraData', [Function: value], 'function'
                             └ 'collectRedBoxExtraData', [Function: value], 'function'

[11:43:33] I | ReactNativeJS ▶︎ 'inside emit function - ', 'RNDeviceInfo_powerStateDidChange', [ 'charging' ], undefined, { didUpdateDimensions: {},
                             │ hardwareBackPress: {},
                             │ keyboardDidShow: {},
                             │ keyboardDidHide: {},
                             │ onGestureHandlerEvent: {},
                             │ onGestureHandlerStateChange: {},
                             │ ReactNativeBlobUtilMessage: {},
                             │ websocketMessage: {},
                             │ websocketOpen: {},
                             │ websocketClosed: {},
                             │ websocketFailed: {},
                             │ appearanceChanged: {},
                             │ collectBugExtraData: {},
                             └ collectRedBoxExtraData: {} }

It does not Throw, and the this._registry is without the correct Set(s) inside.
Debug works fine.

Maybe is some config in the release mode that is wrong? It does not make sense to me

@Naman-Garaaz
Copy link

Naman-Garaaz commented Feb 25, 2023

I am also facing the same issue after upgrading from 066.4 to 0.70.6 reactnative

@AlexandreMuskus
Copy link

hey guys!

when is this correction expected to be published?

DerBasler pushed a commit to DerBasler/react-native that referenced this issue Apr 7, 2023
DerBasler pushed a commit to DerBasler/react-native that referenced this issue Apr 7, 2023
@DerBasler
Copy link

@AlexandreMuskus I just updated the pr. But now it will not fix your issue it will only help you to find the problem.
If you need a quick fix I would advise you to make a script which changes the following 2a2c1f2

DerBasler pushed a commit to DerBasler/react-native that referenced this issue Apr 7, 2023
DerBasler pushed a commit to DerBasler/react-native that referenced this issue Apr 8, 2023
DerBasler pushed a commit to DerBasler/react-native that referenced this issue Apr 8, 2023
@teopaquet
Copy link

Hey,
When is this correction expected to be published?

@ChristopherAChase
Copy link

Hello, just curious if there is any update on this issue or not? I'm running into the exact same error as OP.

@yungsters
Copy link
Contributor

React Native v0.72 will include 2780ba3, which changes EventEmitter to throw a TypeError when addListener is called with a second argument that is not a function.

This should help everyone here narrow down the originating source of this error in order to find out where the non-function is coming from (and where to fix the root cause).

@mikollo
Copy link

mikollo commented Aug 16, 2023

Hi! I encountered the same problem and made a slight adjustment to this line, which seemed a bit off. The spread operation appeared unnecessary:

-      for (const registration of [...registrations]) {
+      for (const registration of registrations) {

To my surprise, this change fixed the issue cc @yungsters . The problem arose after upgrading from version 0.69 to 0.72. I have Hermes enabled.

Here's a complete patch file for anyone else who might be grappling with this issue:

diff --git a/node_modules/react-native/Libraries/vendor/emitter/EventEmitter.js b/node_modules/react-native/Libraries/vendor/emitter/EventEmitter.js
index 6bd2025..6b64e0c 100644
--- a/node_modules/react-native/Libraries/vendor/emitter/EventEmitter.js
+++ b/node_modules/react-native/Libraries/vendor/emitter/EventEmitter.js
@@ -109,7 +109,7 @@ export default class EventEmitter<TEventToArgsMap: {...}>
       Registration<$ElementType<TEventToArgsMap, TEvent>>,
     > = this._registry[eventType];
     if (registrations != null) {
-      for (const registration of [...registrations]) {
+      for (const registration of registrations) {
         registration.listener.apply(registration.context, args);
       }
     }

@Ancez
Copy link

Ancez commented Aug 24, 2023

I had the same error, and I fixed it by doing this
image

For me, the incorrect setup of expo-notifications caused the error.

I hope this helps some else out there

Edit
I agree with @mikollo's comment about changing [...registrations] to registrations

@javache
Copy link
Member

javache commented Sep 1, 2023

Hi! I encountered the same problem and made a slight adjustment to this line, which seemed a bit off. The spread operation appeared unnecessary:

-      for (const registration of [...registrations]) {
+      for (const registration of registrations) {

To my surprise, this change fixed the issue cc @yungsters . The problem arose after upgrading from version 0.69 to 0.72. I have Hermes enabled.

The spread is required to allow listeners to be added and removed during the execution of the event callback.

@mikollo
Copy link

mikollo commented Sep 18, 2023

Hi! I encountered the same problem and made a slight adjustment to this line, which seemed a bit off. The spread operation appeared unnecessary:

-      for (const registration of [...registrations]) {
+      for (const registration of registrations) {

To my surprise, this change fixed the issue cc @yungsters . The problem arose after upgrading from version 0.69 to 0.72. I have Hermes enabled.

The spread is required to allow listeners to be added and removed during the execution of the event callback.

So the idea is to make a copy of registrations? @javache But, since it is a Set, it should've been done without the conversion to an array, which is unnecessary, like this:

      for (const registration of new Set(registrations)) {

updated patch:

diff --git a/node_modules/react-native/Libraries/vendor/emitter/EventEmitter.js b/node_modules/react-native/Libraries/vendor/emitter/EventEmitter.js
index 6bd2025..ab63eff 100644
--- a/node_modules/react-native/Libraries/vendor/emitter/EventEmitter.js
+++ b/node_modules/react-native/Libraries/vendor/emitter/EventEmitter.js
@@ -109,7 +109,7 @@ export default class EventEmitter<TEventToArgsMap: {...}>
       Registration<$ElementType<TEventToArgsMap, TEvent>>,
     > = this._registry[eventType];
     if (registrations != null) {
-      for (const registration of [...registrations]) {
+      for (const registration of new Set(registrations)) {
         registration.listener.apply(registration.context, args);
       }
     }

It solves the issue, which seems to be caused by a bug in the JS engine/compiler/transpiler (?).

Essentially, it incorrectly converts a Set to an Array when using the spread operator, which can be reproduced like this:

         const registrations = new Set();

          registrations.add(1);

          registrations.add(2);

          registrations.add(3);

          console.log([...registrations].join(" ")); // logs [object Set], while it should be 1 2 3

          console.log(Array.from(registrations).join(" ")); // 1 2 3

I cannot reproduce it on https://hermesengine.dev/playground/, so I presume it is caused by Babel.

@javache
Copy link
Member

javache commented Sep 18, 2023

It solves the issue, which seems to be caused by a bug in the JS engine/compiler/transpiler (?).

That's great! It would be good to understand which layer of the stack is causing this bug though. Polyfilling of Set/Map should no longer be required for RN builds, since modern JS engines support them natively.

@yungsters
Copy link
Contributor

@mikollo — It seems like the spread operator (...) is not correctly iterating over Set in your application.

Can you try verifying the following in your environment?

console.log([...new Set([1, 2, 3])].length);
// Should be 3, but seems to be 1 for you.

console.log([...new Set([1, 2, 3])].toString());
// Should be "1,2,3", but seems to be "[object Set]" for you.

Are you able to reproduce this in a standard application setup?

We can certainly (and probably should) replace [...registrations] with new Set(registrations) or Array.from(registrations), but if there is something else that's broken with spreading iterators into arrays… that's also worrisome and worth fixing.

yungsters added a commit to yungsters/react-native that referenced this issue Sep 18, 2023
Summary:
Switches `EventEmitter#emit` to use `Array.from` instead of the spread operator.

This should be functionally identical (with marginally less overhead of the runtime having to determine the type of `registrations`), but there seems to be [some unexpected Babel configurations in the community](facebook#35577 (comment)) that causes this line of code to do the wrong things.

Although we should independently root cause the Babel plugin configuration problems, this change might provide immediate relief and is also not any worse (e.g. in terms of code readability). This also adds a descriptive comment explaining the intention of the call to `Array.from`.

Changelog:
[Fixed][General] - Fix a potential bug in `EventEmitter` when used with certain Babel configurations that incorrectly polyfill the spread operator for iterables.

Differential Revision: D49389813
@yungsters
Copy link
Contributor

yungsters commented Sep 18, 2023

In the meantime, I've created #39525 to change EventEmitter to use Array.from instead of the spread operator.

@mikollo
Copy link

mikollo commented Sep 18, 2023

I now see what was the root cause, I had the loose option turned on in my Babel config:

    [
      "@babel/plugin-transform-spread",
      {
        loose: true,
      },
    ],

and it transpiles [...registrations] to [].concat(registrations). And since concat does not treat all array-like objects as arrays by default, the problem arises. It was actually predicted in this comment for the Babel PR which introduced the concat mechanism - babel/babel#9108 (comment).

I believe this is not a standard application setup (loose mode turned on), and therefore a bug on the react-native side. I guess this issue can be closed. Thank you for your help!

@yungsters
Copy link
Contributor

Thanks for following up with that context, @mikollo!

I am curious whether other folks who have encountered this issue (and commented above) also made use of the loose option when configuring @babel/plugin-transform-spread. It would be great if anyone else who has reported this issue could chime in on whether their problems are the result of the same root cause.

yungsters added a commit to yungsters/react-native that referenced this issue Sep 19, 2023
Summary:

Switches `EventEmitter#emit` to use `Array.from` instead of the spread operator.

This should be functionally identical (with marginally less overhead of the runtime having to determine the type of `registrations`), but there seems to be [some unexpected Babel configurations in the community](facebook#35577 (comment)) that causes this line of code to do the wrong things.

Although we should independently root cause the Babel plugin configuration problems, this change might provide immediate relief and is also not any worse (e.g. in terms of code readability). This also adds a descriptive comment explaining the intention of the call to `Array.from`.

Changelog:
[Fixed][General] - Fix a potential bug in `EventEmitter` when used with certain Babel configurations that incorrectly polyfill the spread operator for iterables.

Reviewed By: javache

Differential Revision: D49389813
facebook-github-bot pushed a commit that referenced this issue Sep 19, 2023
Summary:
Pull Request resolved: #39525

Switches `EventEmitter#emit` to use `Array.from` instead of the spread operator.

This should be functionally identical (with marginally less overhead of the runtime having to determine the type of `registrations`), but there seems to be [some unexpected Babel configurations in the community](#35577 (comment)) that causes this line of code to do the wrong things.

Although we should independently root cause the Babel plugin configuration problems, this change might provide immediate relief and is also not any worse (e.g. in terms of code readability). This also adds a descriptive comment explaining the intention of the call to `Array.from`.

Changelog:
[Fixed][General] - Fix a potential bug in `EventEmitter` when used with certain Babel configurations that incorrectly polyfill the spread operator for iterables.

Reviewed By: javache

Differential Revision: D49389813

fbshipit-source-id: 7caf63734fc047496afe2f1ed6d918c22747258a
ShevO27 pushed a commit to ShevO27/react-native that referenced this issue Sep 26, 2023
Summary:
Pull Request resolved: facebook#39525

Switches `EventEmitter#emit` to use `Array.from` instead of the spread operator.

This should be functionally identical (with marginally less overhead of the runtime having to determine the type of `registrations`), but there seems to be [some unexpected Babel configurations in the community](facebook#35577 (comment)) that causes this line of code to do the wrong things.

Although we should independently root cause the Babel plugin configuration problems, this change might provide immediate relief and is also not any worse (e.g. in terms of code readability). This also adds a descriptive comment explaining the intention of the call to `Array.from`.

Changelog:
[Fixed][General] - Fix a potential bug in `EventEmitter` when used with certain Babel configurations that incorrectly polyfill the spread operator for iterables.

Reviewed By: javache

Differential Revision: D49389813

fbshipit-source-id: 7caf63734fc047496afe2f1ed6d918c22747258a
huntie pushed a commit that referenced this issue Oct 11, 2023
Summary:
Pull Request resolved: #39525

Switches `EventEmitter#emit` to use `Array.from` instead of the spread operator.

This should be functionally identical (with marginally less overhead of the runtime having to determine the type of `registrations`), but there seems to be [some unexpected Babel configurations in the community](#35577 (comment)) that causes this line of code to do the wrong things.

Although we should independently root cause the Babel plugin configuration problems, this change might provide immediate relief and is also not any worse (e.g. in terms of code readability). This also adds a descriptive comment explaining the intention of the call to `Array.from`.

Changelog:
[Fixed][General] - Fix a potential bug in `EventEmitter` when used with certain Babel configurations that incorrectly polyfill the spread operator for iterables.

Reviewed By: javache

Differential Revision: D49389813

fbshipit-source-id: 7caf63734fc047496afe2f1ed6d918c22747258a
Saadnajmi added a commit to microsoft/react-native-macos that referenced this issue Oct 16, 2023
* Move hermes-engine.podspec and hermes-utils.rb from hermes-engine to hermes folders when building (facebook#39575)

* Update Xcode 15 patches to be more robust (facebook#39710)

Summary:
Pull Request resolved: facebook#39710

Last week Apple released Xcode 15, which required us to ship a workaround for the new linker.
Unfortunately, the previous fix was not good enough and there were some edge cases that were not covered.
For example, in some occasions the flags are read as an array and the `-Wl` and the `-ld_classic` flags were separated and not properly removed when moving from Xcode 15 to Xcpde 14.3.1.

This change fixes those edge cases, with a more robust solution where:
- We convert the flags to a string.
- We trim the string and the values properly.
- We add the flags when running `pod install` with Xcode 15 as the default iOS toolchain.
- We remove the flags when running `pod install` with Xcode <15 as the default iOS toolchain.

## Changelog:
[Internal] - Make the Xcode 15 workaround more robust.

Reviewed By: dmytrorykun

Differential Revision: D49748844

fbshipit-source-id: 34976d148f123c5aacba6487a500874bb938fe99

# Conflicts:
#	packages/react-native/scripts/cocoapods/__tests__/utils-test.rb
#	packages/react-native/scripts/cocoapods/utils.rb

* Fix Gemfile, setting Active support to < 7.1.0 (facebook#39828)

Summary:
Pull Request resolved: facebook#39828

Active Suppert released a new Gem which is incompatible with Cocoapods 1.13.0, the latest release, as they removed a method used by cocoapods.

This fix ensures that we install compatible versions of the Gem.

## Changelog:
[iOS][Fixed] - Set the max version of Active support to 7.0.8

Reviewed By: hoxyq

Differential Revision: D49949782

fbshipit-source-id: 278097502d3a416567cc8c0b90090fee4fb21503

# Conflicts:
#	Gemfile

* RN: Switch EventEmitter to `Array.from(...)` (facebook#39525)

Summary:
Pull Request resolved: facebook#39525

Switches `EventEmitter#emit` to use `Array.from` instead of the spread operator.

This should be functionally identical (with marginally less overhead of the runtime having to determine the type of `registrations`), but there seems to be [some unexpected Babel configurations in the community](facebook#35577 (comment)) that causes this line of code to do the wrong things.

Although we should independently root cause the Babel plugin configuration problems, this change might provide immediate relief and is also not any worse (e.g. in terms of code readability). This also adds a descriptive comment explaining the intention of the call to `Array.from`.

Changelog:
[Fixed][General] - Fix a potential bug in `EventEmitter` when used with certain Babel configurations that incorrectly polyfill the spread operator for iterables.

Reviewed By: javache

Differential Revision: D49389813

fbshipit-source-id: 7caf63734fc047496afe2f1ed6d918c22747258a

* [Local] Fix CI for 0.72, with Acitve Support and Xcode15 (facebook#40855)

* [0.72.6] Bump version numbers

* Bump deprecated-react-native-prop-types to ^4.2.3

This version correctly sets a dependency on `"@react-native/normalize-colors": "<0.73.0"` (from `"*"`), preventing future unwanted breakages.

* Fix broken Loading/Refreshing indicator on Android

Summary:
The Loading.../Refreshing... indicator is currently broken on Android.
The reason is related to D42599220
We used to have a Toast shown to users on Android as a fallback, but as the
DevLoadingView is not always loaded as a module in the core package, this ends up in the banner never beign shown to the user (on RN Tester or template apps).

Changelog:
[Android] [Fixed] - Fix broken Loading/Refreshing indicator on Android

Reviewed By: cipolleschi

Differential Revision: D49876757

fbshipit-source-id: 400e002327ebca908e3e7a7f81c5066888ac4e9b

---------

Co-authored-by: Riccardo Cipolleschi <cipolleschi@meta.com>
Co-authored-by: Tim Yung <yungsters@meta.com>
Co-authored-by: Distiller <distiller@static.38.39.185.90.cyberlynk.net>
Co-authored-by: Alex Hunt <hello@alexhunt.io>
Co-authored-by: Nicola Corti <ncor@meta.com>
Copy link

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Mar 17, 2024
Copy link

This issue was closed because it has been stalled for 7 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API: Linking Needs: Triage 🔍 Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests