Agontuk / react-native-geolocation-service

React native geolocation service for iOS and android
https://www.npmjs.com/package/react-native-geolocation-service
MIT License
1.61k stars 291 forks source link

Can not run example app #362

Open da1z opened 2 years ago

da1z commented 2 years ago

Environment

Run npx react-native info in your terminal and copy the results here.

Platforms

Ios

Versions

Latest

Description

npm run ios or yarn run ios in demo dir result in: error: Error: Unable to resolve module AccessibilityInfo from /react-native-geolocation-service/example/node_modules/react-native-geolocation-service/node_modules/react-native/Libraries/react-native/react-native-implementation.js: AccessibilityInfo could not be found within the project or in these directories: node_modules/react-native-geolocation-service/node_modules/react-native/node_modules node_modules/react-native-geolocation-service/node_modules node_modules ../node_modules

Reproducible Demo

Provide a detailed list of steps that reproduce the issue.

  1. i did yarn install in root and in example
  2. i did pod install

Expected Results

App runs

Lavhe commented 2 years ago

Hi @da1z

I managed to fix this issue, Just add this to your metro.config.js, I will open a PR for this

/**
 * Metro configuration for React Native
 * https://github.com/facebook/react-native
 *
 * @format
 */
const packagePath = '../';

module.exports = {
  resolver: {
    nodeModulesPaths: [packagePath],
  },
  watchFolders: [packagePath],
  transformer: {
    getTransformOptions: async () => ({
      transform: {
        experimentalImportSupport: false,
        inlineRequires: true,
      },
    }),
  },
};
Agontuk commented 2 years ago

Remove node_modules from both root & example folder. Then only run yarn install inside example folder.