Skip to content

Usage with RN Web #342

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gavrilikhin-d opened this issue Feb 8, 2024 · 8 comments
Closed

Usage with RN Web #342

gavrilikhin-d opened this issue Feb 8, 2024 · 8 comments

Comments

@gavrilikhin-d
Copy link

Is this possible to use this library with RN Web?

Currently, there is an error:

ERROR in ./node_modules/@invertase/react-native-apple-authentication/lib/index.js 24:0-55
Module not found: Error: Can't resolve './AppleButton' in 
'/Users/gavrilikhin_d/Code/chatroulette/app/mobile/node_modules/@invertase/react-native-apple-authentication/lib'
@mikehardy
Copy link
Collaborator

#335 needs testing. If working on the web is important please pull that PR (perhaps rebase it to current main...) and test it, report findings

@gavrilikhin-d
Copy link
Author

There is still no AppleButton.web.js in this PR

@mikehardy
Copy link
Collaborator

@gavrilikhin-d okay, then perhaps that PR needs additional work - if you have the PR pulled locally and web implementation is important, adding additional commits on the original PR and proposing a new + augmented PR could be the way forward

@gavrilikhin-d
Copy link
Author

gavrilikhin-d commented Feb 9, 2024 via email

@rwitchell
Copy link

@mikehardy: this is causing storybook to fail to build with the same error.

@mikehardy
Copy link
Collaborator

@rwitchell the path forward here is to get #335 patched up and working - I haven't had time personally, but fixing it up and pushing a new PR that works means I could merge it and this would be solved

@encloinc
Copy link

Heres how I fixed it with expo:

For expo create a polyfill for it like so:

https://gist.github.com/encloinc/91a5ca08d7be9e0ecdb5e208c3e5d9c5
(change it to use the scopes you need)

and then on metro make it resolve to the polyfill if platform is web (metro.config.js):

config.resolver.resolveRequest = (context, realModuleName, platform) => {
  if (
    realModuleName.includes("react-native-apple-authentication") &&
    platform === "web"
  ) {
    return {
      filePath: path.join(
        __dirname,
        "polyfills/react-native-apple-authentication.js"
      ),
      type: "sourceFile",
    };
  }
  return context.resolveRequest(context, realModuleName, platform);
};

@AkbarBakhshi
Copy link

Trying to implement Universal Links and need to build my app for web. npx expo export --platform web still throwing that error for the AppleButton.

Error: Unable to resolve module ./AppleButton.

Is there a workaround? like ignoring Apple Authentication for web build?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants