Skip to content
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

Simply including react-native-web breaks web #1825

Open
ollyde opened this issue Jan 29, 2025 · 0 comments
Open

Simply including react-native-web breaks web #1825

ollyde opened this issue Jan 29, 2025 · 0 comments

Comments

@ollyde
Copy link

ollyde commented Jan 29, 2025

I have the following for web and native support

// app/stripe/stripe.tsx

import { Platform } from 'react-native';

export const { StripeProvider, useStripe, initStripe } = Platform.select({
  web: () => require('./stripe.web'),
  native: () => require('./stripe.native'),
  default: () => require('./stripe.native'),
})();

When including

// app/stripe/stripe.native.tsx
import * as Stripe from '@stripe/stripe-react-native';
export { useStripe, initStripe } from '@stripe/stripe-react-native';

export const StripeProvider: React.FC<{
  publishableKey: string;
  children: JSX.Element | JSX.Element[];
}> = ({ publishableKey, children }) => {
  return <Stripe.StripeProvider publishableKey={publishableKey}>{children}</Stripe.StripeProvider>;
};

It breaks.

Commenting this out works, so including from '@stripe/stripe-react-native' breaks something.

I tried many ways to fix this, with no luck.

Anyone know how I can ignore @stripe/stripe-react-native on web builds?

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

1 participant