Shopify/react-native-performance

In React-Native 0.70.6, React-Native Performance cannot be imported

friyiajr opened this issue · 3 comments

Current behavior

The code I am running is pretty simple. I am just trying to import and run this line when the app starts. I've run yarn install and npx pod-install and I am still getting this error that ReactNativePerformance is an undeclared identifier.

Screen Shot 2022-11-28 at 11 28 30 AM

Expected behavior

I can run this code and the app works

To Reproduce

You can download this Bare React-Native project with only React-Native performance Installed:
https://github.com/friyiajr/ShopifyPerformance

Open the Xcode Project and try to run it. You'll see the error in the AppDelegate.mm

Platform:

  • iOS
  • Android

Packages

Which packages are affected by the issue?

  • @shopify/react-native-performance
  • @shopify/react-native-performance-lists-profiler
  • flipper-plugin-shopify-react-native-performance
  • @shopify/react-native-performance-navigation
  • @shopify/react-native-performance-navigation-bottom-tabs
  • @shopify/react-native-performance-navigation-drawer

Environment

  • I've removed the packages that I don't use
package version
@shopify/react-native-performance 4.1.2
react-native 0.70.6

@friyiajr Hey, same problem here, did you find a fix ?

@friyiajr @gauthierdc
Most likely you have an import inside the condition #if RCT_NEW_ARCH_ENABLED which is not executed.
Move the import #import <ReactNativePerformance/ReactNativePerformance.h> higher

Hey @friyiajr 👋

@white1984j is right, #import <ReactNativePerformance/ReactNativePerformance.h> happens inside the #if RCT_NEW_ARCH_ENABLED. I confirmed on your app that moving the import higher makes the app compile successfully. I'll update the documentation to bring attention to this 👍