react-native-share-menu icon indicating copy to clipboard operation
react-native-share-menu copied to clipboard

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

Open m-zaink opened this issue 4 years ago • 10 comments

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.

m-zaink avatar Jun 22 '21 06:06 m-zaink

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.

foxy17 avatar Jun 22 '21 06:06 foxy17

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

MykolJames avatar Aug 24 '21 07:08 MykolJames

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

metaufiq avatar Sep 14 '21 05:09 metaufiq

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 :)

kubik369 avatar Oct 11 '21 09:10 kubik369

@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?

metaufiq avatar Nov 04 '21 10:11 metaufiq

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?

kubik369 avatar Nov 04 '21 13:11 kubik369

Any update of this issue?

Buwaneka-Sumanasekara avatar Mar 25 '22 10:03 Buwaneka-Sumanasekara

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

mircovippinn avatar Mar 25 '22 16:03 mircovippinn

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

Buwaneka-Sumanasekara avatar Mar 28 '22 03:03 Buwaneka-Sumanasekara

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 :)

kubik369 avatar Mar 28 '22 15:03 kubik369