Expensify / react-native-share-menu

A module for React Native that adds your app to the share menu of the device
MIT License
654 stars 239 forks source link

Error: couldn't find provider | M1 Macbook | iOS #136

Open m-zaink opened 3 years ago

m-zaink commented 3 years ago

I keep getting Error: couldn't find provider | M1 Macbook every time I call ShareMenuReactView.data() or ShareMenuReactView.continueInApp().

It occurs under index.share.js file.

Code is as follows:


/**
 * @format
 */

import {AppRegistry} from 'react-native';
import React, {useEffect} from 'react';
import {View} from 'react-native';
import {ShareMenuReactView} from 'react-native-share-menu';

const Share = () => {
  useEffect(() => {
    ShareMenuReactView.data().then(({mimeType, data}) => {
      ShareMenuReactView.continueInApp({data, mimeType});
    });
  }, []);

  return <View />;
};

AppRegistry.registerComponent('ShareMenuModuleComponent', () => Share);

It only occurs on iOS builds generated using M1 Macbooks. Works fine on Intel Macbooks.

PS: Use of useEffect doesn't influence the outcome. Even if I run the exact same index.share.js file as in the example, it gives me the same issue.

foxy17 commented 3 years ago

Hey, I also have the same issue and just as @m-zaink has state it only occurs in IOS builds which is being generated in M1 Pro macbook.

MykolJames commented 3 years ago

Also encountered this issue when building in M1 Mac Mini. Is there any updates or more details on what caused the error?

metaufiq commented 3 years ago

is there any update for this problem right now? I still got the issue with my M1 Mac Mini.

kubik369 commented 3 years ago

I have an app building just fine on an M1 Macbook Air. The only thing that I remember being M1 specific was needing to create an empty bridging swift header file (https://medium.com/@davidjasonharding/developing-a-react-native-app-on-an-m1-mac-without-rosetta-29fcc7314d70#4085) and possibly forcing a newer version of Flipper/other libraries, but that shouldn't be a problem at this point, as I was doing this 4 months back. Looking at the package.json of the project, we have this line "react-native-share-menu": "^5.0.3" and it is 9 months old, so it seems that it has worked fine since then. I was supposedly the first one with an M1 Macbook, so you can try the things I mentioned :)

metaufiq commented 2 years ago

@kubik369 Hi Kubik, thanks for the alternative solution. I think I use "react-native-share-menu": "^5.0.4" and it was working fine on the device but not on the emulator (Error: couldn't find provider | M1 Macbook still exists). how about you?

kubik369 commented 2 years ago

Hm, that's interesting. For me, it works on both the emulator and on real devices. Have you tried selecting/downloading a clean simulator device? Are you running it through rosetta or natively?

Buwaneka-Sumanasekara commented 2 years ago

Any update of this issue?

mircovippinn commented 2 years ago

I also the same issue, any solution for this? I'm using macbook air M1 @m-zaink

Buwaneka-Sumanasekara commented 2 years ago

confirm it's working on ios actual device, and not working on the simulator and gets Error: couldn't find provider. I'm using M1 macbook

kubik369 commented 2 years ago

I will reiterate that it is working for me on M1 Macbook Air, so you most probably have to change something in your config, either you are running xcode or some other part of the toolchain through rosetta or (I am not sure whether this is still required) you don't have the swift bridging file, or something else :)