Commit Graph

12270 Commits

Author SHA1 Message Date
Stephanie Nicholson 55508b285a fix up -Wstrict-prototypes breaks
Summary: As title

Differential Revision: D45240712

fbshipit-source-id: bfb30643f11683c3bca3b66a5d602c1fd8e948dd
2023-04-24 11:42:18 -07:00
Pranav Yadav efc6e147f9 merge getExtendsProps & getProps fns - Flow (#36891)
Summary:
[Codegen 102] This PR is subtask of umbrella https://github.com/facebook/react-native/issues/34872. It extracts the code to compute the `extendsProps` and the props properties in Flow in a `getProps() -> {extendsProps, props}` function into the same `index.js` file. This will help unifying the `buildComponentSchema` functions between Flow and TS so we can factor it out in a later step.

## Changelog:

[INTERNAL][CHANGED] - merge `getExtendsProps` & `getProps` fns into `getProps` fn - Flow.

Pull Request resolved: https://github.com/facebook/react-native/pull/36891

Test Plan: - `yarn flow && yarn test react-native-codegen`  --> *should be green.*

Reviewed By: rshest

Differential Revision: D45044653

Pulled By: cipolleschi

fbshipit-source-id: 9fcdaef60dfbc3332d880b19c6e575d948d21986
2023-04-24 10:46:21 -07:00
Nick Gerleman 8812f35313 Remove "activityindicator" subspec from React-Fabric pod (#37044)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37044

This directory doesn't exist.

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D45204159

fbshipit-source-id: b6794dc28c01ef1484a256a950fd6775f6323d84
2023-04-24 10:46:16 -07:00
Facebook Community Bot 0ceac71275 Re-sync with internal repository (#37068)
Co-authored-by: Facebook Community Bot <6422482+facebook-github-bot@users.noreply.github.com>
2023-04-24 17:25:19 +01:00
Krystof Woldrich f05d202813 POC: Mixed stack traces for Android and iOS Turbo Modules (#36925)
Summary:
This is a POC of how the platform and native exceptions could be passed to the JS layer to get the full stack trace from a JS call to the platform stack trace where an error occurred. This is a follow-up on [the Better Error Reporting Post](https://github.com/reactwg/react-native-new-architecture/discussions/122).

At the moment this works for sync calls only. The calls are wrapped in try-catch and platform exceptions are passed in JS Error cause with `name`, `message`, and `stack`. Throwables have an extra `stackArray` to pass structured stack information.

## Future:

Extract the error assembly to a separate function and add tests.

How to utilize `callStackReturnAddresses` on iOS and what structure information about the stack could be passed to JS?

RedBox in JS should display the JS Error with cause -> the platform error and its stack trace. Currently, only the JS stack is shown in the RedBox.

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[GENERAL][ADDED] - TBA

Pull Request resolved: https://github.com/facebook/react-native/pull/36925

Test Plan:
| iOS | Android |
|--------|--------|
| ![ios-error-cause](https://user-images.githubusercontent.com/31292499/232463156-a4ebc698-ca1f-439f-8f3f-91738b5a0a1c.png) | ![android-error-cause](https://user-images.githubusercontent.com/31292499/232463137-9712d06a-7c02-4483-a136-55e49d71300a.png) |

Example of Throwable in JS:
```json
{
  "name": "Error",
  "message": "Exception in HostFunction: Intentional exception from JVM getObjectThrows with {\"c\":null,\"b\":\"foo\",\"a\":1}",
  "stack": "[native code]\ngetObjectThrows@http://10.0.2.2:8081/js/RNTesterApp.android.bundle?platform=android&dev=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:129497:129\nonPress@http://10.0.2.2:8081/js/RNTesterApp.android.bundle?platform=android&dev=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:129626:71\n_performTransitionSideEffects@http://10.0.2.2:8081/js/RNTesterApp.android.bundle?platform=android&dev=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:51558:22\n_receiveSignal@http://10.0.2.2:8081/js/RNTesterApp.android.bundle?platform=android&dev=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:51514:45\nonResponderRelease@http://10.0.2.2:8081/js/RNTesterApp.android.bundle?platform=android&dev=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:51377:34\ninvokeGuardedCallbackProd@http://10.0.2.2:8081/js/RNTesterApp.android.bundle?platform=android&dev=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:3292:21\ninvokeGuardedCallback@http://10.0.2.2:8081/js/RNTesterApp.android.bundle?platform=android&dev=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:3378:42\ninvokeGuardedCallbackAndCatchFirstError@http://10.0.2.2:8081/js/RNTesterApp.android.bundle?platform=android&dev=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:3381:36\nexecuteDispatch@http://10.0.2.2:8081/js/RNTesterApp.android.bundle?platform=android&dev=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:3445:48\nexecuteDispatchesInOrder@http://10.0.2.2:8081/js/RNTesterApp.android.bundle?platform=android&dev=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:3462:26\nexecuteDispatchesAndRelease@http://10.0.2.2:8081/js/RNTesterApp.android.bundle?platform=android&dev=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:5186:35\nforEach@[native code]\nforEachAccumulated@http://10.0.2.2:8081/js/RNTesterApp.android.bundle?platform=android&dev=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:3904:22\nrunEventsInBatch@http://10.0.2.2:8081/js/RNTesterApp.android.bundle?platform=android&dev=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:5204:27\nrunExtractedPluginEventsInBatch@http://10.0.2.2:8081/js/RNTesterApp.android.bundle?platform=android&dev=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:5226:25\nhttp://10.0.2.2:8081/js/RNTesterApp.android.bundle?platform=android&dev=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:5244:42\nbatchedUpdates$1@http://10.0.2.2:8081/js/RNTesterApp.android.bundle?platform=android&dev=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:15080:20\nbatchedUpdates@http://10.0.2.2:8081/js/RNTesterApp.android.bundle?platform=android&dev=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:5175:36\ndispatchEvent@http://10.0.2.2:8081/js/RNTesterApp.android.bundle?platform=android&dev=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:5237:23",
  "cause": {
    "name": "java.lang.RuntimeException",
    "message": "Intentional exception from JVM getObjectThrows with {\"c\":null,\"b\":\"foo\",\"a\":1}",
    "stack": "com.facebook.fbreact.specs.SampleTurboModule.getObjectThrows(SampleTurboModule.java:194)\ncom.facebook.jni.NativeRunnable.run(Native Method)\nandroid.os.Handler.handleCallback(Handler.java:942)\nandroid.os.Handler.dispatchMessage(Handler.java:99)\ncom.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)\nandroid.os.Looper.loopOnce(Looper.java:201)\nandroid.os.Looper.loop(Looper.java:288)\ncom.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:228)\njava.lang.Thread.run(Thread.java:1012)\n",
    "stackArray": [
      {
        "className": "com.facebook.fbreact.specs.SampleTurboModule",
        "fileName": "SampleTurboModule.java",
        "lineNumber": 194,
        "methodName": "getObjectThrows"
      },
      {
        "className": "com.facebook.jni.NativeRunnable",
        "fileName": "NativeRunnable.java",
        "lineNumber": -2,
        "methodName": "run"
      },
      {
        "className": "android.os.Handler",
        "fileName": "Handler.java",
        "lineNumber": 942,
        "methodName": "handleCallback"
      },
      {
        "className": "android.os.Handler",
        "fileName": "Handler.java",
        "lineNumber": 99,
        "methodName": "dispatchMessage"
      },
      {
        "className": "com.facebook.react.bridge.queue.MessageQueueThreadHandler",
        "fileName": "MessageQueueThreadHandler.java",
        "lineNumber": 27,
        "methodName": "dispatchMessage"
      },
      {
        "className": "android.os.Looper",
        "fileName": "Looper.java",
        "lineNumber": 201,
        "methodName": "loopOnce"
      },
      {
        "className": "android.os.Looper",
        "fileName": "Looper.java",
        "lineNumber": 288,
        "methodName": "loop"
      },
      {
        "className": "com.facebook.react.bridge.queue.MessageQueueThreadImpl$4",
        "fileName": "MessageQueueThreadImpl.java",
        "lineNumber": 228,
        "methodName": "run"
      },
      {
        "className": "java.lang.Thread",
        "fileName": "Thread.java",
        "lineNumber": 1012,
        "methodName": "run"
      }
    ]
  },
  "line": 129497,
  "column": 129,
  "sourceURL": "http://10.0.2.2:8081/js/RNTesterApp.android.bundle?platform=android&dev=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true"
}
```

Example of NSException in JS:

```json
{
  "name": "Error",
  "message": "Exception in HostFunction: Intentional exception from ObjC getObjectThrows",
  "stack": "@[native code]\ngetObjectThrows@http://localhost:8081/js/RNTesterApp.ios.bundle:125422:129\nonPress@http://localhost:8081/js/RNTesterApp.ios.bundle:125549:71\n_performTransitionSideEffects@http://localhost:8081/js/RNTesterApp.ios.bundle:51025:22\n_receiveSignal@http://localhost:8081/js/RNTesterApp.ios.bundle:50981:45\nonResponderRelease@http://localhost:8081/js/RNTesterApp.ios.bundle:50844:34\ninvokeGuardedCallbackProd@http://localhost:8081/js/RNTesterApp.ios.bundle:3232:21\ninvokeGuardedCallback@http://localhost:8081/js/RNTesterApp.ios.bundle:3318:42\ninvokeGuardedCallbackAndCatchFirstError@http://localhost:8081/js/RNTesterApp.ios.bundle:3321:36\nexecuteDispatch@http://localhost:8081/js/RNTesterApp.ios.bundle:3385:48\nexecuteDispatchesInOrder@http://localhost:8081/js/RNTesterApp.ios.bundle:3402:26\nexecuteDispatchesAndRelease@http://localhost:8081/js/RNTesterApp.ios.bundle:5126:35\nforEach@[native code]\nforEachAccumulated@http://localhost:8081/js/RNTesterApp.ios.bundle:3844:22\nrunEventsInBatch@http://localhost:8081/js/RNTesterApp.ios.bundle:5144:27\nrunExtractedPluginEventsInBatch@http://localhost:8081/js/RNTesterApp.ios.bundle:5166:25\n@http://localhost:8081/js/RNTesterApp.ios.bundle:5184:42\nbatchedUpdates$1@http://localhost:8081/js/RNTesterApp.ios.bundle:15020:20\nbatchedUpdates@http://localhost:8081/js/RNTesterApp.ios.bundle:5115:36\ndispatchEvent@http://localhost:8081/js/RNTesterApp.ios.bundle:5177:23",
  "cause": {
    "name": "Excepption",
    "message": "Intentional exception from ObjC getObjectThrows",
    "stack": "0   CoreFoundation                      0x0000000180437330 __exceptionPreprocess + 172\n1   libobjc.A.dylib                     0x0000000180051274 objc_exception_throw + 56\n2   RNTester                            0x0000000103535900 -[RCTSampleTurboModule getObjectThrows:] + 120\n3   CoreFoundation                      0x000000018043d6c0 __invoking___ + 144\n4   CoreFoundation                      0x000000018043aa44 -[NSInvocation invoke] + 276\n5   CoreFoundation                      0x000000018043acdc -[NSInvocation invokeWithTarget:] + 60\n6   RNTester                            0x00000001032b066c ___ZN8facebook5react15ObjCTurboModule23performMethodInvocationERNS_3jsi7RuntimeENS0_26TurboModuleMethodValueKindEPKcP12NSInvocationP14NSMutableArray_block_invoke + 244\n7   RNTester                            0x00000001032afe68 _ZN8facebook5react15ObjCTurboModule23performMethodInvocationERNS_3jsi7RuntimeENS0_26TurboModuleMethodValueKindEPKcP12NSInvocationP14NSMutableArray + 528\n8   RNTester                            0x00000001032b38f0 _ZN8facebook5react15ObjCTurboModule16invokeObjCMethodERNS_3jsi7RuntimeENS0_26TurboModuleMethodValueKindERKNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEEP13objc_selectorPKNS2_5ValueEm + 608\n9   RNTester                            0x0000000103533c18 _ZN8facebook5reactL61__hostFunction_NativeSampleTurboModuleSpecJSI_getObjectThrowsERNS_3jsi7RuntimeERNS0_11TurboModuleEPKNS1_5ValueEm + 112\n10  RNTester                            0x0000000102f1b0c4 _ZZN8facebook5react11TurboModule6createERNS_3jsi7RuntimeERKNS2_10PropNameIDEENKUlS4_RKNS2_5ValueEPS9_mE_clES4_SA_SB_m + 68\n11  RNTester                            0x0000000102f1b074 _ZNSt3__18__invokeB6v15006IRZN8facebook5react11TurboModule6createERNS1_3jsi7RuntimeERKNS4_10PropNameIDEEUlS6_RKNS4_5ValueEPSB_mE_JS6_SC_SD_mEEEDTclclsr3stdE7declvalIT_EEspclsr3stdE7declvalIT0_EEEEOSG_DpOSH_ + 72\n12  RNTester                            0x0000000102f1affc _ZNSt3__128__invoke_void_return_wrapperIN8facebook3jsi5ValueELb0EE6__callIJRZNS1_5react11TurboModule6createERNS2_7RuntimeERKNS2_10PropNameIDEEUlS9_RKS3_PSD_mE_S9_SE_SF_mEEES3_DpOT_ + 64\n13  RNTester                            0x0000000102f1afb0 _ZNSt3__110__function12__alloc_funcIZN8facebook5react11TurboModule6createERNS2_3jsi7RuntimeERKNS5_10PropNameIDEEUlS7_RKNS5_5ValueEPSC_mE_NS_9allocatorISF_EEFSB_S7_SD_SE_mEEclB6v15006ES7_SD_OSE_Om + 72\n14  RNTester                            0x0000000102f19f60 _ZNSt3__110__function6__funcIZN8facebook5react11TurboModule6createERNS2_3jsi7RuntimeERKNS5_10PropNameIDEEUlS7_RKNS5_5ValueEPSC_mE_NS_9allocatorISF_EEFSB_S7_SD_SE_mEEclES7_SD_OSE_Om + 68\n15  RNTester                            0x00000001034df970 _ZNKSt3__110__function12__value_funcIFN8facebook3jsi5ValueERNS3_7RuntimeERKS4_PS7_mEEclB6v15006ES6_S8_OS9_Om + 112\n16  RNTester                            0x00000001034df374 _ZNKSt3__18functionIFN8facebook3jsi5ValueERNS2_7RuntimeERKS3_PS6_mEEclES5_S7_S8_m + 72\n17  RNTester                            0x00000001034deaac _ZZN8facebook3jsc10JSCRuntime30createFunctionFromHostFunctionERKNS_3jsi10PropNameIDEjNSt3__18functionIFNS2_5ValueERNS2_7RuntimeERKS8_PSB_mEEEEN20HostFunctionMetadata4callEPK15OpaqueJSContextP13OpaqueJSValueSL_mPKPKSK_PSN_ + 720\n18  JavaScriptCore                      0x000000010a56e754 _ZN3JSCL34callJSNonFinalObjectCallbackObjectEPNS_14JSGlobalObjectEPNS_9CallFrameE + 436\n19  JavaScriptCore                      0x000000010ad60b78 _ZN3JSC14handleHostCallEPNS_14JSGlobalObjectEPNS_9CallFrameENS_7JSValueEPNS_12CallLinkInfoE + 1016\n20  JavaScriptCore                      0x000000010ad169dc operationLinkCall + 156\n21  ???                                 0x0000000280004330 0x0 + 10737435440\n22  JavaScriptCore                      0x000000010a4bba08 llint_entry + 147988\n23  JavaScriptCore                      0x000000010a4bba08 llint_entry + 147988\n24  JavaScriptCore                      0x000000010a4bba08 llint_entry + 147988\n25  JavaScriptCore                      0x000000010a4bb978 llint_entry + 147844\n26  JavaScriptCore                      0x000000010a4bb978 llint_entry + 147844\n27  ???                                 0x0000000280325200 0x0 + 10740716032\n28  ???                                 0x000000028025f558 0x0 + 10739905880\n29  ???                                 0x000000028025ed34 0x0 + 10739903796\n30  ???                                 0x00000002803deac4 0x0 + 10741476036\n31  ???                                 0x00000002802b7d4c 0x0 + 10740268364\n32  ???                                 0x00000002801b2b40 0x0 + 10739198784\n33  ???                                 0x0000000280385c74 0x0 + 10741111924\n34  ???                                 0x0000000280384a7c 0x0 + 10741107324\n35  ???                                 0x0000000280255920 0x0 + 10739865888\n36  ???                                 0x00000002801a7dfc 0x0 + 10739154428\n37  ???                                 0x00000002802c6d00 0x0 + 10740329728\n38  JavaScriptCore                      0x000000010a497550 vmEntryToJavaScript + 256\n39  JavaScriptCore                      0x000000010ac69b2c _ZN3JSC11Interpreter11executeCallEPNS_14JSGlobalObjectEPNS_8JSObjectERKNS_8CallDataENS_7JSValueERKNS_7ArgListE + 496\n40  JavaScriptCore                      0x000000010a57fd6c JSObjectCallAsFunction + 612\n41  RNTester                            0x00000001034da610 _ZN8facebook3jsc10JSCRuntime4callERKNS_3jsi8FunctionERKNS2_5ValueEPS7_m + 268\n42  RNTester                            0x00000001034e69c4 _ZNK8facebook3jsi8Function4callERNS0_7RuntimeEPKNS0_5ValueEm + 100\n43  RNTester                            0x00000001034e6954 _ZNK8facebook3jsi8Function4callERNS0_7RuntimeESt16initializer_listINS0_5ValueEE + 112\n44  RNTester                            0x000000010323ea78 _ZNK8facebook5react16UIManagerBinding13dispatchEventERNS_3jsi7RuntimeEPKNS0_11EventTargetERKNSt3__112basic_stringIcNS8_11char_traitsIcEENS8_9allocatorIcEEEENS0_18ReactEventPriorityERKNS8_8functionIFNS2_5ValueES4_EEE + 656\n45  RNTester                            0x000000010318d5bc _ZZZN8facebook5react9SchedulerC1ERKNS0_16SchedulerToolboxEPNS0_26UIManagerAnimationDelegateEPNS0_17SchedulerDelegateEENK3$_0clERNS_3jsi7RuntimeEPKNS0_11EventTargetERKNSt3__112basic_stringIcNSG_11char_traitsIcEENSG_9allocatorIcEEEENS0_18ReactEventPriorityERKNSG_8functionIFNSA_5ValueESC_EEEENKUlRKNS0_16UIManagerBindingEE_clESY_ + 60\n46  RNTester                            0x000000010318d574 _ZNSt3__18__invokeB6v15006IRZZN8facebook5react9SchedulerC1ERKNS2_16SchedulerToolboxEPNS2_26UIManagerAnimationDelegateEPNS2_17SchedulerDelegateEENK3$_0clERNS1_3jsi7RuntimeEPKNS2_11EventTargetERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEENS2_18ReactEventPriorityERKNS_8functionIFNSC_5ValueESE_EEEEUlRKNS2_16UIManagerBindingEE_JSZ_EEEDTclclsr3stdE7declvalIT_EEspclsr3stdE7declvalIT0_EEEEOS12_DpOS13_ + 32\n47  RNTester                            0x000000010318d524 _ZNSt3__128__invoke_void_return_wrapperIvLb1EE6__callIJRZZN8facebook5react9SchedulerC1ERKNS4_16SchedulerToolboxEPNS4_26UIManagerAnimationDelegateEPNS4_17SchedulerDelegateEENK3$_0clERNS3_3jsi7RuntimeEPKNS4_11EventTargetERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEENS4_18ReactEventPriorityERKNS_8functionIFNSE_5ValueESG_EEEEUlRKNS4_16UIManagerBindingEE_S11_EEEvDpOT_ + 32\n48  RNTester                            0x000000010318d4f8 _ZNSt3__110__function12__alloc_funcIZZN8facebook5react9SchedulerC1ERKNS3_16SchedulerToolboxEPNS3_26UIManagerAnimationDelegateEPNS3_17SchedulerDelegateEENK3$_0clERNS2_3jsi7RuntimeEPKNS3_11EventTargetERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEENS3_18ReactEventPriorityERKNS_8functionIFNSD_5ValueESF_EEEEUlRKNS3_16UIManagerBindingEE_NSM_IS11_EEFvS10_EEclB6v15006ES10_ + 36\n49  RNTester                            0x000000010318c4d0 _ZNSt3__110__function6__funcIZZN8facebook5react9SchedulerC1ERKNS3_16SchedulerToolboxEPNS3_26UIManagerAnimationDelegateEPNS3_17SchedulerDelegateEENK3$_0clERNS2_3jsi7RuntimeEPKNS3_11EventTargetERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEENS3_18ReactEventPriorityERKNS_8functionIFNSD_5ValueESF_EEEEUlRKNS3_16UIManagerBindingEE_NSM_IS11_EEFvS10_EEclES10_ + 36\n50  RNTester                            0x000000010323add4 _ZNKSt3__110__function12__value_funcIFvRKN8facebook5react16UIManagerBindingEEEclB6v15006ES6_ + 76\n51  RNTester                            0x000000010321ee80 _ZNKSt3__18functionIFvRKN8facebook5react16UIManagerBindingEEEclES5_ + 32\n52  RNTester                            0x000000010321ee24 _ZNK8facebook5react9UIManager12visitBindingERKNSt3__18functionIFvRKNS0_16UIManagerBindingEEEERNS_3jsi7RuntimeE + 84\n53  RNTester                            0x000000010318ba9c _ZZN8facebook5react9SchedulerC1ERKNS0_16SchedulerToolboxEPNS0_26UIManagerAnimationDelegateEPNS0_17SchedulerDelegateEENK3$_0clERNS_3jsi7RuntimeEPKNS0_11EventTargetERKNSt3__112basic_stringIcNSG_11char_traitsIcEENSG_9allocatorIcEEEENS0_18ReactEventPriorityERKNSG_8functionIFNSA_5ValueESC_EEE + 156\n54  RNTester                            0x000000010318b9f4 _ZNSt3__18__invokeB6v15006IRZN8facebook5react9SchedulerC1ERKNS2_16SchedulerToolboxEPNS2_26UIManagerAnimationDelegateEPNS2_17SchedulerDelegateEE3$_0JRNS1_3jsi7RuntimeEPKNS2_11EventTargetERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEENS2_18ReactEventPriorityERKNS_8functionIFNSD_5ValueESF_EEEEEEDTclclsr3stdE7declvalIT_EEspclsr3stdE7declvalIT0_EEEEOSY_DpOSZ_ + 72\n55  RNTester                            0x000000010318b97c _ZNSt3__128__invoke_void_return_wrapperIvLb1EE6__callIJRZN8facebook5react9SchedulerC1ERKNS4_16SchedulerToolboxEPNS4_26UIManagerAnimationDelegateEPNS4_17SchedulerDelegateEE3$_0RNS3_3jsi7RuntimeEPKNS4_11EventTargetERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEENS4_18ReactEventPriorityERKNS_8functionIFNSF_5ValueESH_EEEEEEvDpOT_ + 64\n56  RNTester                            0x000000010318b930 _ZNSt3__110__function12__alloc_funcIZN8facebook5react9SchedulerC1ERKNS3_16SchedulerToolboxEPNS3_26UIManagerAnimationDelegateEPNS3_17SchedulerDelegateEE3$_0NS_9allocatorISC_EEFvRNS2_3jsi7RuntimeEPKNS3_11EventTargetERKNS_12basic_stringIcNS_11char_traitsIcEENSD_IcEEEENS3_18ReactEventPriorityERKNS_8functionIFNSF_5ValueESH_EEEEEclB6v15006ESH_OSK_SR_OSS_SY_ + 68\n57  RNTester                            0x000000010318a6b0 _ZNSt3__110__function6__funcIZN8facebook5react9SchedulerC1ERKNS3_16SchedulerToolboxEPNS3_26UIManagerAnimationDelegateEPNS3_17SchedulerDelegateEE3$_0NS_9allocatorISC_EEFvRNS2_3jsi7RuntimeEPKNS3_11EventTargetERKNS_12basic_stringIcNS_11char_traitsIcEENSD_IcEEEENS3_18ReactEventPriorityERKNS_8functionIFNSF_5ValueESH_EEEEEclESH_OSK_SR_OSS_SY_ + 68\n58  RNTester                            0x00000001030c2e60 _ZNKSt3__110__function12__value_funcIFvRN8facebook3jsi7RuntimeEPKNS2_5react11EventTargetERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEENS6_18ReactEventPriorityERKNS_8functionIFNS3_5ValueES5_EEEEEclB6v15006ES5_OS9_SH_OSI_SO_ + 108\n59  RNTester                            0x00000001030c28d4 _ZNKSt3__18functionIFvRN8facebook3jsi7RuntimeEPKNS1_5react11EventTargetERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEENS5_18ReactEventPriorityERKNS0_IFNS2_5ValueES4_EEEEEclES4_S8_SG_SH_SM_ + 72\n60  RNTester                            0x00000001030c26c4 _ZNK8facebook5react19EventQueueProcessor11flushEventsERNS_3jsi7RuntimeEONSt3__16vectorINS0_8RawEventENS5_9allocatorIS7_EEEE + 516\n61  RNTester                            0x00000001030bd58c _ZNK8facebook5react10EventQueue11flushEventsERNS_3jsi7RuntimeE + 196\n62  RNTester                            0x00000001030bd3d8 _ZNK8facebook5react10EventQueue6onBeatERNS_3jsi7RuntimeE + 44\n63  RNTester                            0x00000001030bf6b0 _ZZN8facebook5react10EventQueueC1ENS0_19EventQueueProcessorENSt3__110unique_ptrINS0_9EventBeatENS3_14default_deleteIS5_EEEEENK3$_0clERNS_3jsi7RuntimeE + 36\n64  RNTester                            0x00000001030bf680 _ZNSt3__18__invokeB6v15006IRZN8facebook5react10EventQueueC1ENS2_19EventQueueProcessorENS_10unique_ptrINS2_9EventBeatENS_14default_deleteIS6_EEEEE3$_0JRNS1_3jsi7RuntimeEEEEDTclclsr3stdE7declvalIT_EEspclsr3stdE7declvalIT0_EEEEOSF_DpOSG_ + 32\n65  RNTester                            0x00000001030bf630 _ZNSt3__128__invoke_void_return_wrapperIvLb1EE6__callIJRZN8facebook5react10EventQueueC1ENS4_19EventQueueProcessorENS_10unique_ptrINS4_9EventBeatENS_14default_deleteIS8_EEEEE3$_0RNS3_3jsi7RuntimeEEEEvDpOT_ + 32\n66  RNTester                            0x00000001030bf604 _ZNSt3__110__function12__alloc_funcIZN8facebook5react10EventQueueC1ENS3_19EventQueueProcessorENS_10unique_ptrINS3_9EventBeatENS_14default_deleteIS7_EEEEE3$_0NS_9allocatorISB_EEFvRNS2_3jsi7RuntimeEEEclB6v15006ESG_ + 36\n67  RNTester                            0x00000001030be470 _ZNSt3__110__function6__funcIZN8facebook5react10EventQueueC1ENS3_19EventQueueProcessorENS_10unique_ptrINS3_9EventBeatENS_14default_deleteIS7_EEEEE3$_0NS_9allocatorISB_EEFvRNS2_3jsi7RuntimeEEEclESG_ + 36\n68  RNTester                            0x0000000102c2f1cc _ZNKSt3__110__function12__value_funcIFvRN8facebook3jsi7RuntimeEEEclB6v15006ES5_ + 76\n69  RNTester                            0x0000000102c2f174 _ZNKSt3__18functionIFvRN8facebook3jsi7RuntimeEEEclES4_ + 32\n70  RNTester                            0x000000010306a0cc _ZZNK8facebook5react21AsynchronousEventBeat6induceEvENK3$_0clERNS_3jsi7RuntimeE + 136\n71  RNTester                            0x000000010306a038 _ZNSt3__18__invokeB6v15006IRZNK8facebook5react21AsynchronousEventBeat6induceEvE3$_0JRNS1_3jsi7RuntimeEEEEDTclclsr3stdE7declvalIT_EEspclsr3stdE7declvalIT0_EEEEOS9_DpOSA_ + 32\n72  RNTester                            0x0000000103069fe8 _ZNSt3__128__invoke_void_return_wrapperIvLb1EE6__callIJRZNK8facebook5react21AsynchronousEventBeat6induceEvE3$_0RNS3_3jsi7RuntimeEEEEvDpOT_ + 32\n73  RNTester                            0x0000000103069fbc _ZNSt3__110__function12__alloc_funcIZNK8facebook5react21AsynchronousEventBeat6induceEvE3$_0NS_9allocatorIS5_EEFvRNS2_3jsi7RuntimeEEEclB6v15006ESA_ + 36\n74  RNTester                            0x0000000103068cf8 _ZNSt3__110__function6__funcIZNK8facebook5react21AsynchronousEventBeat6induceEvE3$_0NS_9allocatorIS5_EEFvRNS2_3jsi7RuntimeEEEclESA_ + 36\n75  RNTester                            0x0000000102c2f1cc _ZNKSt3__110__function12__value_funcIFvRN8facebook3jsi7RuntimeEEEclB6v15006ES5_ + 76\n76  RNTester                            0x0000000102c2f174 _ZNKSt3__18functionIFvRN8facebook3jsi7RuntimeEEEclES4_ + 32\n77  RNTester                            0x0000000103169304 _ZZNK8facebook5react16RuntimeScheduler12scheduleWorkENSt3__18functionIFvRNS_3jsi7RuntimeEEEEENK3$_0clES6_ + 64\n78  RNTester                            0x00000001031692b8 _ZNSt3__18__invokeB6v15006IRZNK8facebook5react16RuntimeScheduler12scheduleWorkENS_8functionIFvRNS1_3jsi7RuntimeEEEEE3$_0JS7_EEEDTclclsr3stdE7declvalIT_EEspclsr3stdE7declvalIT0_EEEEOSC_DpOSD_ + 32\n79  RNTester                            0x0000000103169268 _ZNSt3__128__invoke_void_return_wrapperIvLb1EE6__callIJRZNK8facebook5react16RuntimeScheduler12scheduleWorkENS_8functionIFvRNS3_3jsi7RuntimeEEEEE3$_0S9_EEEvDpOT_ + 32\n80  RNTester                            0x000000010316923c _ZNSt3__110__function12__alloc_funcIZNK8facebook5react16RuntimeScheduler12scheduleWorkENS_8functionIFvRNS2_3jsi7RuntimeEEEEE3$_0NS_9allocatorISB_EES9_EclB6v15006ES8_ + 36\n81  RNTester                            0x0000000103167fe8 _ZNSt3__110__function6__funcIZNK8facebook5react16RuntimeScheduler12scheduleWorkENS_8functionIFvRNS2_3jsi7RuntimeEEEEE3$_0NS_9allocatorISB_EES9_EclES8_ + 36\n82  RNTester                            0x0000000102c2f1cc _ZNKSt3__110__function12__value_funcIFvRN8facebook3jsi7RuntimeEEEclB6v15006ES5_ + 76\n83  RNTester                            0x0000000102c2f174 _ZNKSt3__18functionIFvRN8facebook3jsi7RuntimeEEEclES4_ + 32\n84  RNTester                            0x00000001033d56e8 _ZZZ28RCTRuntimeExecutorFromBridgeP9RCTBridgeENK3$_0clEONSt3__18functionIFvRN8facebook3jsi7RuntimeEEEEENKUlvE_clEv + 724\n85  RNTester                            0x00000001033d5408 _ZNSt3__18__invokeB6v15006IRZZ28RCTRuntimeExecutorFromBridgeP9RCTBridgeENK3$_0clEONS_8functionIFvRN8facebook3jsi7RuntimeEEEEEUlvE_JEEEDTclclsr3stdE7declvalIT_EEspclsr3stdE7declvalIT0_EEEEOSE_DpOSF_ + 24\n86  RNTester                            0x00000001033d53c0 _ZNSt3__128__invoke_void_return_wrapperIvLb1EE6__callIJRZZ28RCTRuntimeExecutorFromBridgeP9RCTBridgeENK3$_0clEONS_8functionIFvRN8facebook3jsi7RuntimeEEEEEUlvE_EEEvDpOT_ + 24\n87  RNTester                            0x00000001033d539c _ZNSt3__110__function12__alloc_funcIZZ28RCTRuntimeExecutorFromBridgeP9RCTBridgeENK3$_0clEONS_8functionIFvRN8facebook3jsi7RuntimeEEEEEUlvE_NS_9allocatorISD_EEFvvEEclB6v15006Ev + 28\n88  RNTester                            0x00000001033d4128 _ZNSt3__110__function6__funcIZZ28RCTRuntimeExecutorFromBridgeP9RCTBridgeENK3$_0clEONS_8functionIFvRN8facebook3jsi7RuntimeEEEEEUlvE_NS_9allocatorISD_EEFvvEEclEv + 28\n89  RNTester                            0x0000000102e4ce8c _ZNKSt3__110__function12__value_funcIFvvEEclB6v15006Ev + 68\n90  RNTester                            0x0000000102e4ce3c _ZNKSt3__18functionIFvvEEclEv + 24\n91  RNTester                            0x000000010349d744 _ZZN8facebook5react8Instance13JSCallInvoker13scheduleAsyncEONSt3__18functionIFvvEEEENK3$_3clEPNS0_10JSExecutorE + 28\n92  RNTester                            0x000000010349d71c _ZNSt3__18__invokeB6v15006IRZN8facebook5react8Instance13JSCallInvoker13scheduleAsyncEONS_8functionIFvvEEEE3$_3JPNS2_10JSExecutorEEEEDTclclsr3stdE7declvalIT_EEspclsr3stdE7declvalIT0_EEEEOSD_DpOSE_ + 36\n93  RNTester                            0x000000010349d6c8 _ZNSt3__128__invoke_void_return_wrapperIvLb1EE6__callIJRZN8facebook5react8Instance13JSCallInvoker13scheduleAsyncEONS_8functionIFvvEEEE3$_3PNS4_10JSExecutorEEEEvDpOT_ + 32\n94  RNTester                            0x000000010349d69c _ZNSt3__110__function12__alloc_funcIZN8facebook5react8Instance13JSCallInvoker13scheduleAsyncEONS_8functionIFvvEEEE3$_3NS_9allocatorISA_EEFvPNS3_10JSExecutorEEEclB6v15006EOSE_ + 36\n95  RNTester                            0x000000010349c470 _ZNSt3__110__function6__funcIZN8facebook5react8Instance13JSCallInvoker13scheduleAsyncEONS_8functionIFvvEEEE3$_3NS_9allocatorISA_EEFvPNS3_10JSExecutorEEEclEOSE_ + 36\n96  RNTester                            0x00000001034c75dc _ZNKSt3__110__function12__value_funcIFvPN8facebook5react10JSExecutorEEEclB6v15006EOS5_ + 76\n97  RNTester                            0x00000001034c755c _ZNKSt3__18functionIFvPN8facebook5react10JSExecutorEEEclES4_ + 36\n98  RNTester                            0x00000001034c7528 _ZZN8facebook5react16NativeToJsBridge18runOnExecutorQueueENSt3__18functionIFvPNS0_10JSExecutorEEEEENK3$_8clEv + 92\n99  RNTester                            0x00000001034c74c0 _ZNSt3__18__invokeB6v15006IRZN8facebook5react16NativeToJsBridge18runOnExecutorQueueENS_8functionIFvPNS2_10JSExecutorEEEEE3$_8JEEEDTclclsr3stdE7declvalIT_EEspclsr3stdE7declvalIT0_EEEEOSB_DpOSC_ + 24\n100 RNTester                            0x00000001034c7478 _ZNSt3__128__invoke_void_return_wrapperIvLb1EE6__callIJRZN8facebook5react16NativeToJsBridge18runOnExecutorQueueENS_8functionIFvPNS4_10JSExecutorEEEEE3$_8EEEvDpOT_ + 24\n101 RNTester                            0x00000001034c7454 _ZNSt3__110__function12__alloc_funcIZN8facebook5react16NativeToJsBridge18runOnExecutorQueueENS_8functionIFvPNS3_10JSExecutorEEEEE3$_8NS_9allocatorISA_EEFvvEEclB6v15006Ev + 28\n102 RNTester                            0x00000001034c5fe8 _ZNSt3__110__function6__funcIZN8facebook5react16NativeToJsBridge18runOnExecutorQueueENS_8functionIFvPNS3_10JSExecutorEEEEE3$_8NS_9allocatorISA_EEFvvEEclEv + 28\n103 RNTester                            0x0000000102e4ce8c _ZNKSt3__110__function12__value_funcIFvvEEclB6v15006Ev + 68\n104 RNTester                            0x0000000102e4ce3c _ZNKSt3__18functionIFvvEEclEv + 24\n105 RNTester                            0x0000000102f68120 _ZN8facebook5react17tryAndReturnErrorERKNSt3__18functionIFvvEEE + 24\n106 RNTester                            0x0000000102f8b970 _ZN8facebook5react16RCTMessageThread7tryFuncERKNSt3__18functionIFvvEEE + 36\n107 RNTester                            0x0000000102f904b0 _ZZN8facebook5react16RCTMessageThread10runOnQueueEONSt3__18functionIFvvEEEENK3$_1clEv + 80\n108 RNTester                            0x0000000102f90454 _ZNSt3__18__invokeB6v15006IRZN8facebook5react16RCTMessageThread10runOnQueueEONS_8functionIFvvEEEE3$_1JEEEDTclclsr3stdE7declvalIT_EEspclsr3stdE7declvalIT0_EEEEOSA_DpOSB_ + 24\n109 RNTester                            0x0000000102f9040c _ZNSt3__128__invoke_void_return_wrapperIvLb1EE6__callIJRZN8facebook5react16RCTMessageThread10runOnQueueEONS_8functionIFvvEEEE3$_1EEEvDpOT_ + 24\n110 RNTester                            0x0000000102f903e8 _ZNSt3__110__function12__alloc_funcIZN8facebook5react16RCTMessageThread10runOnQueueEONS_8functionIFvvEEEE3$_1NS_9allocatorIS9_EES6_EclB6v15006Ev + 28\n111 RNTester                            0x0000000102f8f0f8 _ZNSt3__110__function6__funcIZN8facebook5react16RCTMessageThread10runOnQueueEONS_8functionIFvvEEEE3$_1NS_9allocatorIS9_EES6_EclEv + 28\n112 RNTester                            0x0000000102e4ce8c _ZNKSt3__110__function12__value_funcIFvvEEclB6v15006Ev + 68\n113 RNTester                            0x0000000102e4ce3c _ZNKSt3__18functionIFvvEEclEv + 24\n114 RNTester                            0x0000000102f8b740 ___ZN8facebook5react16RCTMessageThread8runAsyncENSt3__18functionIFvvEEE_block_invoke + 48\n115 CoreFoundation                      0x000000018039aa34 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 20\n116 CoreFoundation                      0x000000018039a17c __CFRunLoopDoBlocks + 360\n117 CoreFoundation                      0x0000000180394f8c __CFRunLoopRun + 2336\n118 CoreFoundation                      0x0000000180394254 CFRunLoopRunSpecific + 584\n119 RNTester                            0x0000000102f42588 +[RCTCxxBridge runRunLoop] + 736\n120 Foundation                          0x0000000180bbede0 __NSThread__start__ + 704\n121 libsystem_pthread.dylib             0x00000001b18384e4 _pthread_start + 116\n122 libsystem_pthread.dylib             0x00000001b18336cc thread_start + 8\n"
  }
}
```

How I logged out the Errors:

```js
console.log('Error in JS:', JSON.stringify({
  name: e.name,
  message: e.message,
  stack: e.stack,
  ...e,
}, null, 2));
```

For to me unknown reason the `name`, `message` and `stack` is not printed when I directly stringify `e`.

Reviewed By: rshest

Differential Revision: D45182122

Pulled By: javache

fbshipit-source-id: 63e71c054b70816e3c021d69437805a82a7ef64e
2023-04-24 05:54:32 -07:00
Blake Friedman 14b2b1ce50 investigating cause of ReactViewManager returning null
Summary:
Throws and captures the overloading class as well as the component name to help us track.

[Android][Changed] - Added an exception, which will be removed shortly.

Reviewed By: cortinico

Differential Revision: D45185598

fbshipit-source-id: 222a38be12c0a41774c83b657a4e4134ce9c197f
2023-04-24 04:47:03 -07:00
Pieter De Baets e133100721 Unmount React applications when re-creating context [RFC] (#37004)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37004

Currently in RN Android when re-creating the context we don't unmount the underlying React application. This violates ViewManager and React hooks contracts, who are no longer able to properly unmount views, and instead the view hierarchy is forcefully torn down by Android UI. This differs from iOS, where we do unmount the application on reloads.

This is a trade-off with performance, as we'll keep the JS thread alive slightly longer to complete shutdown, but it's the right call for correctness. It also only mainly affects development, as recreating the context is rare in production.

Repro steps:

```
  useEffect(() => {
    console.log('Playground useEffect invoked');
    return () => {
      console.log('Playground useEffect destructor invoked');
    };
  }, []);
```

Validate that when reloading the application, the second console.log is printed.

Changelog: [Android][Changed] React trees will be unmounted when the application is reloaded

Reviewed By: luluwu2032

Differential Revision: D45145520

fbshipit-source-id: a4dcd2ff4a8fc14cb0f276a5ef9afe21d1104735
2023-04-24 03:58:37 -07:00
Antoine Doubovetzky 4da201396c (jest/setup): Add missing methods to Image mock (#36996)
Summary:
Fixes https://github.com/facebook/react-native/issues/35518

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[INTERNAL] [FIXED] - Add missing methods to Image mock

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests

Pull Request resolved: https://github.com/facebook/react-native/pull/36996

Test Plan:
I used the example provided in the issue:

```javascript
import { useEffect } from "react"
import { Image } from "react-native"
import { render } from 'testing-library/react-native';

const MyComponent = () => {
    useEffect(() => {
        Image.getSize('uri', (width, height) => {
            console.log({width, height})
        })
    }, [])

    return null
}

describe('Foo', () => {
    it('something', () => {
        render(<MyComponent/>)
    })
})
```

Before the fix:
<img width="779" alt="Capture d’écran 2023-04-20 à 09 31 48" src="https://user-images.githubusercontent.com/17070498/233293066-e8673755-217f-48b4-a856-b9356ec3624e.png">

And after the fix:
<img width="346" alt="Capture d’écran 2023-04-20 à 09 32 40" src="https://user-images.githubusercontent.com/17070498/233293261-b6d02307-e67a-444f-a2de-e31eae32c0f1.png">

Reviewed By: cortinico

Differential Revision: D45179320

Pulled By: rshest

fbshipit-source-id: 323d04cdf720e23690e44f6c8621289e74b95c17
2023-04-24 03:17:25 -07:00
Moti Zilberman e66bdf0479 Enable lazy bundling in dev on iOS/Android (#37003)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37003

Changelog: [General][Added] [3/n] Support lazy bundling in development

Enables [lazy bundling](https://github.com/react-native-community/discussions-and-proposals/blob/main/proposals/0605-lazy-bundling.md) when requesting a development bundle from Metro.

NOTE: This depends on a Metro diff (https://github.com/facebook/metro/pull/971) that hasn't landed yet, but is a no-op until then.

Reviewed By: jacdebug

Differential Revision: D43600054

fbshipit-source-id: 515e2180a2130fd1a75e53677e789d31a367f7c2
2023-04-24 01:28:09 -07:00
David Vacca 28d5c15cb9 Remove lint warning on ReactInstance (#37038)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37038

ez diff to remove warning on ReactInstance

changelog: [internal] internal

Reviewed By: fkgozali

Differential Revision: D45198113

fbshipit-source-id: 936d5e5d159b0e7995d1048ba6f98a0608a1af7c
2023-04-22 14:39:51 -07:00
David Vacca 01d80c1285 Refactor ReactInstance to reduce visibility (#37039)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37039

ReactInstance is not meant to be used outside of bridgless package, this diff reduces its visibility.

changelog: [internal] internal

Reviewed By: fkgozali

Differential Revision: D45197462

fbshipit-source-id: e2fa8ed145a05882d8f5384d4e4e17a3d6d984ac
2023-04-22 10:14:55 -07:00
David Vacca 932150eb94 Refactor BridgelessReactStateTracker (#37040)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37040

Refactor BridgelessReactStateTracker to remove unused methods and reduce visibility

changelog: [internal] internal

Reviewed By: fkgozali

Differential Revision: D45192192

fbshipit-source-id: 34f523ac2f1e45ea2ab4acb94134cfd1879a01db
2023-04-22 10:14:55 -07:00
David Vacca f530c32a98 Reduce visibility of BridgelessReactStateTracker class (#37037)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37037

Reduce visibility of BridgelessReactStateTracker class to package only

changelog: [internal] internal

Reviewed By: fkgozali

Differential Revision: D45192194

fbshipit-source-id: 3bd57f0fa228af1ca997ed454b067e89ff89fc7b
2023-04-22 08:15:19 -07:00
David Vacca 20e1ecf282 Reduce visibility of BridgelessDevSupportManager class (#37036)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37036

This diff I'm reducing visibility of BridgelessDevSupportManager to package only

changelog: [internal] internal

Reviewed By: fkgozali

Differential Revision: D45192195

fbshipit-source-id: d1cfb31005f6181118928705c03c2536e448a02a
2023-04-22 08:15:19 -07:00
David Vacca 6542cf9ccc Reduce visibility of BridgelessAtomicRef to package (#37042)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37042

BridgelessAtomicRef is only used in com.facebook.react.bridgeless, we reduce visibility to package only

changelog: [internal] internal

Reviewed By: NickGerleman

Differential Revision: D45192193

fbshipit-source-id: 12253a2a8acd3c2edd550650f5f04a0346694b3e
2023-04-22 08:15:19 -07:00
Tim Yung cff4bc8eea RN: Silently Fail onRequestPermissionsResult for Invalid Activities (#37047)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37047

We're seeing scenarios where `onRequestPermissionsResult` is being invoked but the current activity does not implement `PermissionAwareActivity`. This should not crash the app.

Changelog:
[Android][Fixed] - Fix crash when Android requests permission with activity that does not implement `PermissionAwareActivity`

Reviewed By: mdvacca

Differential Revision: D45203319

fbshipit-source-id: 4a6eb67ad67ae5c731c27301967b837b1286ccbb
2023-04-21 22:31:00 -07:00
Ramanpreet Nara 555014a634 Emit logs in "module not found" scenarios
Summary:
In the TurboModule interop layer, several modules are appearing as null. It's unclear why. We landed a few module resolution simplification diffs, to *attempt* to mitigate the problem: D45131297. But we're not sure if those diffs will be 100% successful.

So, this diff inserts two logs into the TurboModule system, for scenarios we know could lead to TurboModules being null. The hope: this helps us understand the actual problem, in case our earlier fix attempt (i.e: D45131297) fails.

Notes:
- These logs are temporary.
- These logs will only run in the TurboModule interop's test group.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D45197703

fbshipit-source-id: 4401a6111492444cc4b405c52183d02df94c3828
2023-04-21 16:37:04 -07:00
Ramanpreet Nara af5c2d2c75 Only create TurboModules, if they're registered (#37032)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37032

Before, calling into global.turboModuleProxy would kickstart the  module creation algorithm, **even if the module wasn't registered.**

Now, if the module isn't registered, TurboModuleManager will just early return null.

NOTE: When an unregistered module is requested from Java via TurboModuleManager.getModule(moduleName), the module algorithm will **still** run.

This fixes a bug:
- global.**native**ModuleProxy will no longer kickstart **turbo** module creation.
- global.**turbo**ModuleProxy will no longer kickstart **legacy** module creation.

NOTE: This **might** improve fb4a performance **a bit**: The TurboModule creation algorithm is *probably* expensive to run. 44 NativeModules are loaded at startup by Fb4a; 8 of them aren't registered with the app: [pastry](https://www.internalfb.com/phabricator/paste/view/P701125588?lines=2%2C4%2C5%2C7%2C9%2C16%2C18%2C24). Those 8 NativeModule creates will now shortcircuit to null faster.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D45195578

fbshipit-source-id: cb09bdc059b3651b02447b7c2e37ef3f4ca2f92b
2023-04-21 16:37:04 -07:00
Ramanpreet Nara 215e574373 Switch to lambdas within ReactPackageTurboModuleManagerDelegate
Summary: Changelog: [Internal]

Reviewed By: cortinico, mdvacca

Differential Revision: D45158030

fbshipit-source-id: 4919d0d28874cf12acc3dc8baa2df752c5e2a3d5
2023-04-21 16:37:04 -07:00
Ramanpreet Nara 6f10110555 Remove Deprecated TurboModuleManagerDelegate APIs
Summary:
This deprecated API makes TurboModuleManager's module creation algorithm harder to follow. Let's remove it.

Changelog: [Android][Removed] - Remove TurboModuleManagerDelegate.getLegacyCxxModule

Reviewed By: mdvacca

Differential Revision: D45158031

fbshipit-source-id: f72af3d62e51a4c8427d41975f51d1c9dd31c6c8
2023-04-21 16:37:04 -07:00
Ramanpreet Nara ac2a4d8e6c Remove getNative* TurboModuleRegistry APIs
Summary:
These getNative* TurboModuleRegistry APIs make the TurboModuleManager harder to understand. They should have never been introduced.

Let's remove them for added clarity.

Changelog: [Android][Removed] - Remove TurboModuleManager.getNativeModule,getNativeModules,hasNativeModule

Reviewed By: mdvacca

Differential Revision: D45158032

fbshipit-source-id: 6f904dfe43fe7b2c215070a19f474acceddbf2f8
2023-04-21 16:37:04 -07:00
Nick Gerleman 1f1918e473 Remove C++ form of YGNodeSetChildren (#37013)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37013

X-link: https://github.com/facebook/yoga/pull/1254

Brings Yoga public interface back to a nice pure C ABI.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D45138827

fbshipit-source-id: 8df7e4fd03afcda9a714d193b0430c122a7a7574
2023-04-21 15:36:17 -07:00
David Vacca 43c202fa95 Fix lint warnings in Drawer classes (#37024)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37024

Fix lint warnings in Drawer classes

changelog: [internal] internal

Reviewed By: christophpurrer

Differential Revision: D45123914

fbshipit-source-id: 46d2f6326b4231dcefb42f286437daec53c51fae
2023-04-21 15:17:29 -07:00
Nick Gerleman f3abf4243c Remove YGNode "reserved_" field (#36991)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36991

D15296732 added a byte to each YGNode exposed via private API, to stash random junk in. At the time, not adding to node size because of how fields ended up aligning. I'm not sure if this is still the case, but this is subject to change (e.g. adding a single extra flag).

There is a per-node "context" already that can store arbitrary data, and this reserved space isn't public, so this API is already a bit suspect.

The only place it is used is in instrumentation in fbandroid, enabled only in benchmarks, to store an enum to forward to QPL for what framework it thinks created the Yoga Node.

This is already broken for React Native (worked for Paper only), and afaict isn't used anywhere. But it also has little reason to be caching more information on the node (beyond maybe saving a couple memory accesses) since it derives this information from the node config already.

This removes the field.

Changelog:
[Internal]

Reviewed By: rshest

Differential Revision: D45137133

fbshipit-source-id: 75755b21102f7928b3ad947051c35b1a6566ef40
2023-04-21 13:54:50 -07:00
Samuel Susla bd64699f0a Reset internal state of RCTScrollViewComponentView in scrollViewDidEndDragging
Summary:
changelog: [internal]

`_isUserTriggeredScrolling` must be NO when user interaction stops. This was not the case when user scrolled -> lifted finger but the scroll did not decelerate into position. The case with deceleration is handled in method `scrollViewDidEndDecelerating`.

Reviewed By: javache

Differential Revision: D45147325

fbshipit-source-id: 1b55dc708c4c7d6cffa917a822eb2b569b22dbb2
2023-04-21 10:43:17 -07:00
Samuel Susla 81d8992ceb Fix outdated viewport offset on Fabric surface (#37020)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37020

changelog: [internal]

if host view's position on screen changes, `RootShadowNode` has to be notified of this. Otherwise the state of UI is not correctly reflected in ShadowTree, leading to inconsistencies. For example, when trying to get views position in window, it won't be correct when hosting view isn't full screen.
Overriding `setFrame` only works for cases where it is hosting view's parent changing its position. But there are other cases where the position may change on the screen, like when hosting view's parent is moved by movable navigation bar. This does not affect frame of hosting view but it does change its position on the screen. To know about this event, we need to override `layoutSubviews`. `layoutSubviews` is called by UIKit whenever its internal flag `_needsLayout` is set to YES.

Reviewed By: javache

Differential Revision: D45122502

fbshipit-source-id: b7b1b08a8b3accffce7e3c71f7d19887caf6462f
2023-04-21 10:43:17 -07:00
Nick Gerleman 516642c101 Remove YGTraversePreOrder (#37014)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37014

X-link: https://github.com/facebook/yoga/pull/1253

This is unused, and kinda missed the intent of Yoga.h and YG* functions being a C ABI.

Reviewed By: rshest

Differential Revision: D45138646

fbshipit-source-id: 743e7d0f43c122932c3a6f43ce564c0f209b4771
2023-04-21 09:58:07 -07:00
Ruslan Shestopalyuk 2058da8f20 Unrevert "use stable sort for performance entries" (#37017)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37017

Changelog: [Internal]

Re-submitting https://github.com/facebook/react-native/pull/36998, which was reverted earlier due to the internal compatibility check issues.

Reviewed By: cipolleschi

Differential Revision: D45177862

fbshipit-source-id: f47ef496e3d7531b5e077310c72def80b024be6e
2023-04-21 05:14:11 -07:00
Ruslan Shestopalyuk 10aad32bef Re-submit Performance.mark/duration argument removal from the API (#37016)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37016

Changelog: [Internal]

Re-submitting https://github.com/facebook/react-native/pull/36997, which was reverted earlier due to the internal compatibility check issues.

Reviewed By: cipolleschi

Differential Revision: D45177697

fbshipit-source-id: 9a4a55e45d4530770b16247374d03bd4ccc7fa21
2023-04-21 05:14:11 -07:00
Nicola Corti 74f256b6f0 Gradle to 8.1 (#37018)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37018

Just bumping Gradle version to the latest stable.
This brings configuration caching as stable, which is quite of a big deal.

Changelog:
[Android] [Changed] - Gradle to 8.1

Reviewed By: yungsters

Differential Revision: D45177537

fbshipit-source-id: 6a47208b69d5591d299451e5a610cc3f5e9afe66
2023-04-21 04:52:54 -07:00
Christoph Purrer 57c36927f7 Fix jsErrorHandler/JsErrorHandler.h import error on Windows (#37012)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37012

Changelog: [Internal]

Our default clang compiler setting on Windows doesn't allow to mismatch folder and headername space naming conventions

Reviewed By: yungsters

Differential Revision: D45165950

fbshipit-source-id: 459848960513bd06ad0c2dbaef5d8c44305e4567
2023-04-21 01:33:20 -07:00
David Vacca 363224ea62 Deprecate EventBeatManager constructor (#36905)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36905

In this diff I'm deprecating EventBeatManager constructor that receives a Context as a parameter.

bypass-github-export-checks

changelog: [Android][Deprecated] deprecating EventBeatManager constructor that receives a Context as a parameter.

Reviewed By: fkgozali

Differential Revision: D44759827

fbshipit-source-id: cb117c26af0a43fe245f8778a55dfbea756b3ce6
2023-04-20 19:43:33 -07:00
Nick Gerleman 4ae77c0ad4 Remove BitUtils Usage in YGNode (#1250)
Summary:
X-link: https://github.com/facebook/yoga/pull/1250

Pull Request resolved: https://github.com/facebook/react-native/pull/36988

BitUtils functions in Yoga are like bit fields, with more steps, and more error prone (you need to work with explicit offsets which can be tricky for anything variable length). Replace usage with a bitfield struct. Eventually I'd like to remove the BitUtils functions in general.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D45133645

fbshipit-source-id: aa1430df5e2fb71ed9d2a5f5b1a35429b71c7069
2023-04-20 17:38:55 -07:00
David Vacca 4260494574 Refactor FabricUIManager (#37011)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37011

Refactor FabricUIManager to use labmda and remove lint warnings

changelog: [internal] internal

Reviewed By: RSNara

Differential Revision: D45164998

fbshipit-source-id: 56ee5b4d9d2c234c517757a8963f03443e5935d4
2023-04-20 17:18:51 -07:00
Phillip Pan 2fe14df09a properly format pragma marks
Summary:
Changelog: [Internal]

so ANNOYING

Reviewed By: christophpurrer, sammy-SC

Differential Revision: D45022199

fbshipit-source-id: 367a9b652987e1590a966928870de1ba61a4bad3
2023-04-20 16:26:38 -07:00
Phillip Pan 5a7799eead make getModuleInstanceFromClass: required
Summary:
Changelog: [iOS][Breaking]

continuing getting rid of optional methods, but this does have a behavioral change. if the delegate does not provide the module instance, then we lazily create it. before we were returning nil, idk why. this will be a breaking change if you have any classes that conform to `RCTTurboModuleManagerDelegate`

#saynotoruntimechecks

Reviewed By: cipolleschi

Differential Revision: D45022139

fbshipit-source-id: 9635332caf3db7bb9306f99ee5c0d577091d38ea
2023-04-20 16:26:38 -07:00
Phillip Pan fbf196dd05 make getModuleClassFromName: required (#36968)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36968

Changelog: [iOS][Breaking]

we should be using `optional` never. this will be a breaking change if you have any class that conform to `RCTTurboModuleManagerDelegate`

#saynotoruntimechecks

Reviewed By: cipolleschi

Differential Revision: D45022003

fbshipit-source-id: d1b3cf72bae82070704f20de4558949189da462a
2023-04-20 16:26:38 -07:00
David Vacca fce5aa7c5f Reduce Visibility of public API (#37008)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37008

Reduce Visibility of public methods that should be private

changelog: [Internal] internal

Reviewed By: luluwu2032

Differential Revision: D45153669

fbshipit-source-id: 2177a114eaa701d79a21d8a25bd299bf681dc4b8
2023-04-20 16:11:54 -07:00
Oleksandr Melnykov 9e0d198727 Back out "Clean up uneeded "duration" parameter from the Performance.mark API"
Summary:
Changelog: [Internal]

Original commit changeset: ce3d14940124

Original Phabricator Diff: D45141978

Reviewed By: GijsWeterings

Differential Revision: D45161958

fbshipit-source-id: 22d79e8e8d0670fd220391f7e5ea92ca257ff982
2023-04-20 15:36:16 -07:00
Oleksandr Melnykov d77798b270 Back out "Use stable sort for performance entries"
Summary:
Changelog: [Internal]

Original commit changeset: 77ff0093bead

Original Phabricator Diff: D45142500

Reviewed By: GijsWeterings

Differential Revision: D45161907

fbshipit-source-id: 546d36a8d1f2bf8c8e26279b172f62e303b51dc0
2023-04-20 15:36:16 -07:00
Christoph Purrer 65f5cd7995 Use C++17 namespace format everywhere (#36987)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36987

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D45130727

fbshipit-source-id: 66f9fbd2a3a5f4d637b59bee77d085a35117d69d
2023-04-20 14:19:50 -07:00
Nick Gerleman da71c40f81 Undeprecate Config setting APIs (#1251)
Summary:
X-link: https://github.com/facebook/yoga/pull/1251

Pull Request resolved: https://github.com/facebook/react-native/pull/36990

YGNode::setConfig was deprecated as part of D15416474 in an apparent goal to remove config pointers per-Node.

While I don't know the history of the motivation here, these config pointers were never removed, and we will be doubling down on per-node configs for StrictLayout, so we will want to undeprecate this.

This also exposes functions to the public C ABI, but I didn't spend the effort to create language projections for it.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D45133646

fbshipit-source-id: 2bb15c4825717793529cdad8542447d11e723e35
2023-04-20 14:01:14 -07:00
Tim Yung f84256a924 RN: Upgrade to deprecated-react-native-prop-types@4.1.0
Summary:
Upgrades React Native to `deprecated-react-native-prop-types@4.1.0`, which includes many of the new prop types in React Native v0.72.

See: https://github.com/facebook/react-native-deprecated-modules/blob/main/deprecated-react-native-prop-types/CHANGELOG.md

Changelog:
[General][Changed] - Upgrade to deprecated-react-native-prop-types@4.1.0

Reviewed By: rickhanlonii

Differential Revision: D45155955

fbshipit-source-id: 36e715c2338b667755bd1e522b7d5a2611103779
2023-04-20 13:19:41 -07:00
Ramanpreet Nara eab32f19af Report loaded modules when first module load fails (#36980)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36980

With the TurboModule interop layer, some modules aren't being loaded at all. This logging will help us root cause the problem: is the issue with the TurboModule system, or with instantiating a particular module.

Changelog: [Internal]

Reviewed By: cortinico, mdvacca

Differential Revision: D45102812

fbshipit-source-id: 5c5f55d5857c694270a83c38b68cae0fdb2c3b50
2023-04-20 11:58:26 -07:00
Ramanpreet Nara 963739047b Separate turbo and legacy module caches (#36986)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36986

global.nativeModuleProxy and global.__turboModuleProxy should not share the same cache.

Otherwise, global.nativeModuleProxy could return TurboModules, and global.__turboModuleProxy could return legacy native modules.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D45131296

fbshipit-source-id: 472059dc95d760a5eb8fc376606b30e614ee86c5
2023-04-20 11:42:21 -07:00
Ramanpreet Nara 0c1b7d374c Simplify the gating for the Fb4a TurboModule interop test (#36985)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36985

This diff simplifies TurboModuleManagerDelegate. Now, it doesn't do any filtering.

What TurboModuleManagerDelegate does:
- If the TurboModule interop layer is on, getLegacyModule(moduleName) starts returning legacy modules.
- If the TurboModule interop layer is off, getLegacyModule(moduleName) returns null.

This should help with T144183369. In that crash, some native modules are returned as null. And complicated filtering could be a contributor to that problem. So, simplifying filtering might mitigate that issue.

Even if it doesn't, this makes the TurboModuleManager easier to understand, which makes root causing/mitigating that problem easier.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D45131297

fbshipit-source-id: 9e37804e09c9f04ab0610f5b444574ae65c9d638
2023-04-20 11:42:21 -07:00
Oleksandr Melnykov 53d3629a65 Back out "Link to fbsource"
Summary: Changelog: [internal]

Reviewed By: sammy-SC

Differential Revision: D45149829

fbshipit-source-id: 915ddb7d3027cff822aff57a5b8abaca1d6cb12e
2023-04-20 11:15:51 -07:00
yaqi.liu 5059ddc5ce KeyboardAvoidingView: update bottom height when frame height is changed (#36970)
Summary:
Fix this issue: https://github.com/facebook/react-native/issues/29499

- We should change the bottom height if the frame height of KeyboardAvoidingView is changed

In some scenarios, the height of `KeyboardAvoidingView` would be changed because its container is re-layouted. So `onLayout` of `KeyboardAvoidingView` may be triggered more than once.

https://github.com/facebook/react-native/blob/bbc3657ff4efd0218e02ad9a3c73725a7f8a366c/packages/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js#L114-L125

But at line 122 above, `_updateBottomIfNecessary ` would be called only for the first trigger of `onLayout`. That means, if the height of `KeyboardAvoidingView` is changed, the bottom height can't be updated.

#### See the videos below:

##### before

In this video, `KeyboardAvoidingView ` is rendered twice, and the height is changed from 844 to 753, `bottomHeight ` is not updated when the height changed, so there is a white gap below the `continue` button. Once I re-open the keyboard, `_updateBottomIfNecessary` is called again, then the white gap disappeared.

https://user-images.githubusercontent.com/25719782/232962924-c69adc11-deb9-4426-9b5c-4e990a0470db.mp4

##### after

https://user-images.githubusercontent.com/25719782/232962956-a163020f-5f40-4d82-9f6c-5ee67416c489.mp4

## Changelog:

[GENERAL] [CHANGED] - change `_onLayout` to update bottom height when frame height is changed

Pull Request resolved: https://github.com/facebook/react-native/pull/36970

Reviewed By: rshest

Differential Revision: D45138176

Pulled By: NickGerleman

fbshipit-source-id: b7ce6d75622ed6e8f104ae0d8441e1cb97cfa15b
2023-04-20 10:46:54 -07:00
Nick Gerleman 290774fd80 Do not run OSS changelog validator on diffs exported from Phabricator (#36994)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36994

We already run changelog validation internally which has specific exemptions for codemods and dirsynced directories. Do not run twice, now that we need to export diffs.

An alternative solution would be to port the logic to the OSS changelog generator and stop running the internal one, but that would increase latency, and we have made fixes to the internal once as recent as two weeks ago in D44746795.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D45135111

fbshipit-source-id: e23c2613b183f75a148d1b38b31c259acc9c9fc5
2023-04-20 10:11:43 -07:00
Ruslan Shestopalyuk 8e046cbbd7 Use stable sort for performance entries (#36998)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36998

For performance entries that have the same start/end time it makes more sense to report them back to `PerformanceObserver` in the same order they were logged.

This kind of determinism is arguably better both in terms of API, and from the point of view of testing.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D45142500

fbshipit-source-id: 77ff0093bead45dc2f15efc4b903dc181927565a
2023-04-20 10:05:53 -07:00