heap / react-native-heap

A React Native integration for Heap
MIT License
82 stars 36 forks source link

[HEAP-30323] Add support for expo managed workflow #319

Closed semmerich-heap closed 2 years ago

semmerich-heap commented 2 years ago

Description

What does this PR add/fix/change? Adds support for expo managed workflow

Test Plan

How were these changes tested? Were additional test cases added? Was there manual testing? Yes, download and install it locally to test

Checklist

bnickel commented 2 years ago

@semmerich-heap

This is looking better, and I'm seeing strings.xml generate correctly but I'm running into an issue trying to test.

First I added the following to app.json:

    "plugins": [
      "@heap/react-native-heap"
    ],

Then I ran the following sequence of commands:

cd /PATH/TO/react-native-heap
npm install
npm pack
yarn link
cd /PATH/TO/my-project
yarn link @heap/react-native-heap
expo install @heap/react-native-heap
expo eject
yarn android

As soon as the app launches, I get this error:

Android Bundling failed 429ms
Unable to resolve module @heap/react-native-heap from /Users/bnickel/Documents/GitHub/react-native-demo-apps/ExpoManagedApp/App.tsx: @heap/react-native-heap could not be found within the project or in these directories:
  node_modules

If you are sure the module exists, try these steps:
 1. Clear watchman watches: watchman watch-del-all
 2. Delete node_modules and run yarn install
 3. Reset Metro's cache: yarn start --reset-cache
 4. Remove the cache: rm -rf /tmp/metro-*
  12 |  import {createStackNavigator} from '@react-navigation/stack';
  13 |  
> 14 |  import Heap from '@heap/react-native-heap';
     |                    ^
  15 |  
  16 |  import {HomeScreen} from './screens/HomeScreen';
  17 |  import {NavigationStackScreen} from './screens/NavigationScreen';

This is happening with the ExpoManagedApp demo app. I've tried resetting caches, and I renamed the unimodule from @heaplocal to @heap but not had any luck. I was also initially using npm instead of yarn but Expo started switching to yarn on eject as soon as I had installed it.