Can't find variable: document ReactNative Js2019 Community Moderator ElectionReactNative: how to center text?Can't find variable: navigate - ReactNative navigationReact Native error: “Can't find variable: TouchableHighlight”How to use Expo.DocumentPicker.getDocumentAsync properly. [Expo] [ReactNative]Can't find variable: regeneratorRuntime (ReactNative)Reactnative Expo It is advisable for a StartUp?Can't find variable : Self / Can't install firebaseNPM Install Error in installing ReactNative CLIContacts Displaying in App using ReactnativeFacebook login error: can't find variable: Alert

Why is "la Gestapo" feminine?

Why doesn't the fusion process of the sun speed up?

PTIJ: Which Dr. Seuss books should one obtain?

How do researchers send unsolicited emails asking for feedback on their works?

Do I need an EFI partition for each 18.04 ubuntu I have on my HD?

The English Debate

10 year ban after applying for a UK student visa

Someone scrambled my calling sign- who am I?

What (if any) is the reason to buy in small local stores?

Does convergence of polynomials imply that of its coefficients?

Is VPN a layer 3 concept?

Isn't the word "experience" wrongly used in this context?

Knife as defense against stray dogs

Hot air balloons as primitive bombers

"Marked down as someone wanting to sell shares." What does that mean?

What will the Frenchman say?

Weird lines in Microsoft Word

Why I don't get the wanted width of tcbox?

Can other pieces capture a threatening piece and prevent a checkmate?

If I cast the Enlarge/Reduce spell on an arrow, what weapon could it count as?

Print last inputted byte

Why is participating in the European Parliamentary elections used as a threat?

How do you justify more code being written by following clean code practices?

What is the difference between something being completely legal and being completely decriminalized?



Can't find variable: document ReactNative Js



2019 Community Moderator ElectionReactNative: how to center text?Can't find variable: navigate - ReactNative navigationReact Native error: “Can't find variable: TouchableHighlight”How to use Expo.DocumentPicker.getDocumentAsync properly. [Expo] [ReactNative]Can't find variable: regeneratorRuntime (ReactNative)Reactnative Expo It is advisable for a StartUp?Can't find variable : Self / Can't install firebaseNPM Install Error in installing ReactNative CLIContacts Displaying in App using ReactnativeFacebook login error: can't find variable: Alert










0















I try to use Stripe API.
When i load : https://js.stripe.com/v3



and at the end of the Feed.js file



I got the error below:




Can't find variable: document




I don't understand what's the problem.



I'm using Expo and i tried import storybook but it didn't solve my problem. Below the index.html file And my Feed.js File



<!DOCTYPE html>
<html>

<head>
<title>demo | react-stripe-elements</title>
<script src="https://js.stripe.com/v3/"></script>
<style>
*
box-sizing: border-box;

body,
html
background-color: #f6f9fc;
font-size: 18px;
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;

h1
color: #32325d;
font-weight: 400;
line-height: 50px;
font-size: 40px;
margin: 20px 0;
padding: 0;

.Checkout
margin: 0 auto;
max-width: 800px;
box-sizing: border-box;
padding: 0 5px;

label
color: #6b7c93;
font-weight: 300;
letter-spacing: 0.025em;

button
white-space: nowrap;
border: 0;
outline: 0;
display: inline-block;
height: 40px;
line-height: 40px;
padding: 0 14px;
box-shadow: 0 4px 6px rgba(50, 50, 93, .11), 0 1px 3px rgba(0, 0, 0, .08);
color: #fff;
border-radius: 4px;
font-size: 15px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.025em;
background-color: #6772e5;
text-decoration: none;
-webkit-transition: all 150ms ease;
transition: all 150ms ease;
margin-top: 10px;

form
margin-bottom: 40px;
padding-bottom: 40px;
border-bottom: 3px solid #e6ebf1;

button:hover
color: #fff;
cursor: pointer;
background-color: #7795f8;
transform: translateY(-1px);
box-shadow: 0 7px 14px rgba(50, 50, 93, .10), 0 3px 6px rgba(0, 0, 0, .08);

input,
.StripeElement
display: block;
margin: 10px 0 20px 0;
max-width: 500px;
padding: 10px 14px;
font-size: 1em;
font-family: 'Source Code Pro', monospace;
box-shadow: rgba(50, 50, 93, 0.14902) 0px 1px 3px, rgba(0, 0, 0, 0.0196078) 0px 1px 0px;
border: 0;
outline: 0;
border-radius: 4px;
background: white;

input::placeholder
color: #aab7c4;

input:focus,
.StripeElement--focus
box-shadow: rgba(50, 50, 93, 0.109804) 0px 4px 6px, rgba(0, 0, 0, 0.0784314) 0px 1px 3px;
-webkit-transition: all 150ms ease;
transition: all 150ms ease;

.StripeElement.IdealBankElement,
.StripeElement.PaymentRequestButton
padding: 0;

</style>
</head>

<body>
<div class="App">
</div>
<script src="/Ecran/UtilisateurConnecte/BottomTab/Feed.js"></script>
</body>

</html>


feed.js



import React from 'react';
import render from 'react-dom';
import ReactDOM from 'react-dom';


import View, Text from 'react-native';

import type InjectedProps from '../../../src/components/inject';


import
CardElement,
CardNumberElement,
CardExpiryElement,
CardCVCElement,
PaymentRequestButtonElement,
IbanElement,
IdealBankElement,
StripeProvider,
Elements,
injectStripe,
from '../../../src/index';

const handleBlur = () =>
console.log('[blur]');
;
const handleChange = (change) =>
console.log('[change]', change);
;
const handleClick = () =>
console.log('[click]');
;
const handleFocus = () =>
console.log('[focus]');
;
const handleReady = () =>
console.log('[ready]');
;

const createOptions = (fontSize, padding) =>
return
style:
base:
fontSize,
color: '#424770',
letterSpacing: '0.025em',
fontFamily: 'Source Code Pro, monospace',
'::placeholder':
color: '#aab7c4',
,
padding,
,
invalid:
color: '#9e2146',
,
,
;
;

class _CardForm extends React.Component
handleSubmit = (ev) =>
ev.preventDefault();
if (this.props.stripe)
this.props.stripe
.createToken()
.then((payload) => console.log('[token]', payload));
else
console.log("Stripe.js hasn't loaded yet.");

;
render()
return (
<form onSubmit=this.handleSubmit>
<label>
Card details
<CardElement
onBlur=handleBlur
onChange=handleChange
onFocus=handleFocus
onReady=handleReady
...createOptions(this.props.fontSize)
/>
</label>
<button>Pay</button>
</form>
);


const CardForm = injectStripe(_CardForm);

class _SplitForm extends React.Component
handleSubmit = (ev) =>
ev.preventDefault();
if (this.props.stripe)
this.props.stripe
.createToken()
.then((payload) => console.log('[token]', payload));
else
console.log("Stripe.js hasn't loaded yet.");

;
render()
return (
<form onSubmit=this.handleSubmit>
<label>
Card number
<CardNumberElement
onBlur=handleBlur
onChange=handleChange
onFocus=handleFocus
onReady=handleReady
...createOptions(this.props.fontSize)
/>
</label>
<label>
Expiration date
<CardExpiryElement
onBlur=handleBlur
onChange=handleChange
onFocus=handleFocus
onReady=handleReady
...createOptions(this.props.fontSize)
/>
</label>
<label>
CVC
<CardCVCElement
onBlur=handleBlur
onChange=handleChange
onFocus=handleFocus
onReady=handleReady
...createOptions(this.props.fontSize)
/>
</label>
<label>
Postal code
<PostalCodeElement
onBlur=handleBlur
onChange=handleChange
onFocus=handleFocus
onReady=handleReady
...createOptions(this.props.fontSize)
/>
</label>
<button>Pay</button>
</form>
);


const SplitForm = injectStripe(_SplitForm);

class _PaymentRequestForm extends React.Component
constructor(props)
super(props);

const paymentRequest = props.stripe.paymentRequest(
country: 'US',
currency: 'usd',
total:
label: 'Demo total',
amount: 1000,
,
);

paymentRequest.on('token', (complete, token, ...data) =>
console.log('Received Stripe token: ', token);
console.log('Received customer information: ', data);
complete('success');
);

paymentRequest.canMakePayment().then((result) =>
this.setState(canMakePayment: !!result);
);

this.state =
canMakePayment: false,
paymentRequest,
;


render()
return this.state.canMakePayment ? (
<PaymentRequestButtonElement
className="PaymentRequestButton"
onBlur=handleBlur
onClick=handleClick
onFocus=handleFocus
onReady=handleReady
paymentRequest=this.state.paymentRequest
style=
paymentRequestButton:
theme: 'dark',
height: '64px',
type: 'donate',
,

/>
) : null;


const PaymentRequestForm = injectStripe(_PaymentRequestForm);

class _IbanForm extends React.Component
handleSubmit = (ev) =>
ev.preventDefault();
if (this.props.stripe)
this.props.stripe
.createSource(
type: 'sepa_debit',
currency: 'eur',
owner:
name: ev.target.name.value,
email: ev.target.email.value,
,
mandate:
notification_method: 'email',
,
)
.then((payload) => console.log('[source]', payload));
else
console.log("Stripe.js hasn't loaded yet.");

;
render()
return (
<form onSubmit=this.handleSubmit>
<label>
Name
<input name="name" type="text" placeholder="Jane Doe" required />
</label>
<label>
Email
<input
name="email"
type="email"
placeholder="jane.doe@example.com"
required
/>
</label>
<label>
IBAN
<IbanElement
supportedCountries=['SEPA']
onBlur=handleBlur
onChange=handleChange
onFocus=handleFocus
onReady=handleReady
...createOptions(this.props.fontSize)
/>
</label>
<button>Pay</button>
</form>
);


const IbanForm = injectStripe(_IbanForm);

class _IdealBankForm extends React.Component
handleSubmit = (ev) =>
ev.preventDefault();
if (this.props.stripe)
this.props.stripe
.createSource(
type: 'ideal',
amount: 1099,
currency: 'eur',
owner:
name: ev.target.name.value,
,
redirect:
return_url: 'https://example.com',
,
)
.then((payload) => console.log('[source]', payload));
else
console.log("Stripe.js hasn't loaded yet.");

;
render()
return (
<form onSubmit=this.handleSubmit>
<label>
Name
<input name="name" type="text" placeholder="Jane Doe" required />
</label>
<label>
iDEAL Bank
<IdealBankElement
className="IdealBankElement"
onBlur=handleBlur
onChange=handleChange
onFocus=handleFocus
onReady=handleReady
...createOptions(this.props.fontSize, '10px 14px')
/>
</label>
<button>Pay</button>
</form>
);


const IdealBankForm = injectStripe(_IdealBankForm);

class Checkout extends React.Component
constructor()
super();
this.state =
elementFontSize: window.innerWidth < 450 ? '14px' : '18px',
;
window.addEventListener('resize', () =>
if (window.innerWidth < 450 && this.state.elementFontSize !== '14px')
this.setState(elementFontSize: '14px');
else if (
window.innerWidth >= 450 &&
this.state.elementFontSize !== '18px'
)
this.setState(elementFontSize: '18px');

);


render()
const elementFontSize = this.state;
return (
<div className="Checkout">
<h1>Available Elements</h1>
<Elements>
<CardForm fontSize=elementFontSize />
</Elements>
<Elements>
<SplitForm fontSize=elementFontSize />
</Elements>
<Elements>
<PaymentRequestForm />
</Elements>
<Elements>
<IbanForm fontSize=elementFontSize />
</Elements>
<Elements>
<IdealBankForm fontSize=elementFontSize />
</Elements>
</div>
);


const App = () =>
return (
<StripeProvider apiKey="pk_test_6pRNASCoBOKtIshFeQd4XMUh">
<Checkout />
</StripeProvider>
);
;
ReactDOM.render(<App />, document.querySelector('.App'));









share|improve this question



















  • 1





    Are you usen Text and View from react native in html ? ... that's not gonna work. You cannot use html as your core in react native

    – ValdaXD
    Mar 7 at 19:51











  • Even if i delete my index.html i got the error Can't find variable: document @ValdaXD

    – Dorian
    Mar 7 at 21:11















0















I try to use Stripe API.
When i load : https://js.stripe.com/v3



and at the end of the Feed.js file



I got the error below:




Can't find variable: document




I don't understand what's the problem.



I'm using Expo and i tried import storybook but it didn't solve my problem. Below the index.html file And my Feed.js File



<!DOCTYPE html>
<html>

<head>
<title>demo | react-stripe-elements</title>
<script src="https://js.stripe.com/v3/"></script>
<style>
*
box-sizing: border-box;

body,
html
background-color: #f6f9fc;
font-size: 18px;
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;

h1
color: #32325d;
font-weight: 400;
line-height: 50px;
font-size: 40px;
margin: 20px 0;
padding: 0;

.Checkout
margin: 0 auto;
max-width: 800px;
box-sizing: border-box;
padding: 0 5px;

label
color: #6b7c93;
font-weight: 300;
letter-spacing: 0.025em;

button
white-space: nowrap;
border: 0;
outline: 0;
display: inline-block;
height: 40px;
line-height: 40px;
padding: 0 14px;
box-shadow: 0 4px 6px rgba(50, 50, 93, .11), 0 1px 3px rgba(0, 0, 0, .08);
color: #fff;
border-radius: 4px;
font-size: 15px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.025em;
background-color: #6772e5;
text-decoration: none;
-webkit-transition: all 150ms ease;
transition: all 150ms ease;
margin-top: 10px;

form
margin-bottom: 40px;
padding-bottom: 40px;
border-bottom: 3px solid #e6ebf1;

button:hover
color: #fff;
cursor: pointer;
background-color: #7795f8;
transform: translateY(-1px);
box-shadow: 0 7px 14px rgba(50, 50, 93, .10), 0 3px 6px rgba(0, 0, 0, .08);

input,
.StripeElement
display: block;
margin: 10px 0 20px 0;
max-width: 500px;
padding: 10px 14px;
font-size: 1em;
font-family: 'Source Code Pro', monospace;
box-shadow: rgba(50, 50, 93, 0.14902) 0px 1px 3px, rgba(0, 0, 0, 0.0196078) 0px 1px 0px;
border: 0;
outline: 0;
border-radius: 4px;
background: white;

input::placeholder
color: #aab7c4;

input:focus,
.StripeElement--focus
box-shadow: rgba(50, 50, 93, 0.109804) 0px 4px 6px, rgba(0, 0, 0, 0.0784314) 0px 1px 3px;
-webkit-transition: all 150ms ease;
transition: all 150ms ease;

.StripeElement.IdealBankElement,
.StripeElement.PaymentRequestButton
padding: 0;

</style>
</head>

<body>
<div class="App">
</div>
<script src="/Ecran/UtilisateurConnecte/BottomTab/Feed.js"></script>
</body>

</html>


feed.js



import React from 'react';
import render from 'react-dom';
import ReactDOM from 'react-dom';


import View, Text from 'react-native';

import type InjectedProps from '../../../src/components/inject';


import
CardElement,
CardNumberElement,
CardExpiryElement,
CardCVCElement,
PaymentRequestButtonElement,
IbanElement,
IdealBankElement,
StripeProvider,
Elements,
injectStripe,
from '../../../src/index';

const handleBlur = () =>
console.log('[blur]');
;
const handleChange = (change) =>
console.log('[change]', change);
;
const handleClick = () =>
console.log('[click]');
;
const handleFocus = () =>
console.log('[focus]');
;
const handleReady = () =>
console.log('[ready]');
;

const createOptions = (fontSize, padding) =>
return
style:
base:
fontSize,
color: '#424770',
letterSpacing: '0.025em',
fontFamily: 'Source Code Pro, monospace',
'::placeholder':
color: '#aab7c4',
,
padding,
,
invalid:
color: '#9e2146',
,
,
;
;

class _CardForm extends React.Component
handleSubmit = (ev) =>
ev.preventDefault();
if (this.props.stripe)
this.props.stripe
.createToken()
.then((payload) => console.log('[token]', payload));
else
console.log("Stripe.js hasn't loaded yet.");

;
render()
return (
<form onSubmit=this.handleSubmit>
<label>
Card details
<CardElement
onBlur=handleBlur
onChange=handleChange
onFocus=handleFocus
onReady=handleReady
...createOptions(this.props.fontSize)
/>
</label>
<button>Pay</button>
</form>
);


const CardForm = injectStripe(_CardForm);

class _SplitForm extends React.Component
handleSubmit = (ev) =>
ev.preventDefault();
if (this.props.stripe)
this.props.stripe
.createToken()
.then((payload) => console.log('[token]', payload));
else
console.log("Stripe.js hasn't loaded yet.");

;
render()
return (
<form onSubmit=this.handleSubmit>
<label>
Card number
<CardNumberElement
onBlur=handleBlur
onChange=handleChange
onFocus=handleFocus
onReady=handleReady
...createOptions(this.props.fontSize)
/>
</label>
<label>
Expiration date
<CardExpiryElement
onBlur=handleBlur
onChange=handleChange
onFocus=handleFocus
onReady=handleReady
...createOptions(this.props.fontSize)
/>
</label>
<label>
CVC
<CardCVCElement
onBlur=handleBlur
onChange=handleChange
onFocus=handleFocus
onReady=handleReady
...createOptions(this.props.fontSize)
/>
</label>
<label>
Postal code
<PostalCodeElement
onBlur=handleBlur
onChange=handleChange
onFocus=handleFocus
onReady=handleReady
...createOptions(this.props.fontSize)
/>
</label>
<button>Pay</button>
</form>
);


const SplitForm = injectStripe(_SplitForm);

class _PaymentRequestForm extends React.Component
constructor(props)
super(props);

const paymentRequest = props.stripe.paymentRequest(
country: 'US',
currency: 'usd',
total:
label: 'Demo total',
amount: 1000,
,
);

paymentRequest.on('token', (complete, token, ...data) =>
console.log('Received Stripe token: ', token);
console.log('Received customer information: ', data);
complete('success');
);

paymentRequest.canMakePayment().then((result) =>
this.setState(canMakePayment: !!result);
);

this.state =
canMakePayment: false,
paymentRequest,
;


render()
return this.state.canMakePayment ? (
<PaymentRequestButtonElement
className="PaymentRequestButton"
onBlur=handleBlur
onClick=handleClick
onFocus=handleFocus
onReady=handleReady
paymentRequest=this.state.paymentRequest
style=
paymentRequestButton:
theme: 'dark',
height: '64px',
type: 'donate',
,

/>
) : null;


const PaymentRequestForm = injectStripe(_PaymentRequestForm);

class _IbanForm extends React.Component
handleSubmit = (ev) =>
ev.preventDefault();
if (this.props.stripe)
this.props.stripe
.createSource(
type: 'sepa_debit',
currency: 'eur',
owner:
name: ev.target.name.value,
email: ev.target.email.value,
,
mandate:
notification_method: 'email',
,
)
.then((payload) => console.log('[source]', payload));
else
console.log("Stripe.js hasn't loaded yet.");

;
render()
return (
<form onSubmit=this.handleSubmit>
<label>
Name
<input name="name" type="text" placeholder="Jane Doe" required />
</label>
<label>
Email
<input
name="email"
type="email"
placeholder="jane.doe@example.com"
required
/>
</label>
<label>
IBAN
<IbanElement
supportedCountries=['SEPA']
onBlur=handleBlur
onChange=handleChange
onFocus=handleFocus
onReady=handleReady
...createOptions(this.props.fontSize)
/>
</label>
<button>Pay</button>
</form>
);


const IbanForm = injectStripe(_IbanForm);

class _IdealBankForm extends React.Component
handleSubmit = (ev) =>
ev.preventDefault();
if (this.props.stripe)
this.props.stripe
.createSource(
type: 'ideal',
amount: 1099,
currency: 'eur',
owner:
name: ev.target.name.value,
,
redirect:
return_url: 'https://example.com',
,
)
.then((payload) => console.log('[source]', payload));
else
console.log("Stripe.js hasn't loaded yet.");

;
render()
return (
<form onSubmit=this.handleSubmit>
<label>
Name
<input name="name" type="text" placeholder="Jane Doe" required />
</label>
<label>
iDEAL Bank
<IdealBankElement
className="IdealBankElement"
onBlur=handleBlur
onChange=handleChange
onFocus=handleFocus
onReady=handleReady
...createOptions(this.props.fontSize, '10px 14px')
/>
</label>
<button>Pay</button>
</form>
);


const IdealBankForm = injectStripe(_IdealBankForm);

class Checkout extends React.Component
constructor()
super();
this.state =
elementFontSize: window.innerWidth < 450 ? '14px' : '18px',
;
window.addEventListener('resize', () =>
if (window.innerWidth < 450 && this.state.elementFontSize !== '14px')
this.setState(elementFontSize: '14px');
else if (
window.innerWidth >= 450 &&
this.state.elementFontSize !== '18px'
)
this.setState(elementFontSize: '18px');

);


render()
const elementFontSize = this.state;
return (
<div className="Checkout">
<h1>Available Elements</h1>
<Elements>
<CardForm fontSize=elementFontSize />
</Elements>
<Elements>
<SplitForm fontSize=elementFontSize />
</Elements>
<Elements>
<PaymentRequestForm />
</Elements>
<Elements>
<IbanForm fontSize=elementFontSize />
</Elements>
<Elements>
<IdealBankForm fontSize=elementFontSize />
</Elements>
</div>
);


const App = () =>
return (
<StripeProvider apiKey="pk_test_6pRNASCoBOKtIshFeQd4XMUh">
<Checkout />
</StripeProvider>
);
;
ReactDOM.render(<App />, document.querySelector('.App'));









share|improve this question



















  • 1





    Are you usen Text and View from react native in html ? ... that's not gonna work. You cannot use html as your core in react native

    – ValdaXD
    Mar 7 at 19:51











  • Even if i delete my index.html i got the error Can't find variable: document @ValdaXD

    – Dorian
    Mar 7 at 21:11













0












0








0


1






I try to use Stripe API.
When i load : https://js.stripe.com/v3



and at the end of the Feed.js file



I got the error below:




Can't find variable: document




I don't understand what's the problem.



I'm using Expo and i tried import storybook but it didn't solve my problem. Below the index.html file And my Feed.js File



<!DOCTYPE html>
<html>

<head>
<title>demo | react-stripe-elements</title>
<script src="https://js.stripe.com/v3/"></script>
<style>
*
box-sizing: border-box;

body,
html
background-color: #f6f9fc;
font-size: 18px;
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;

h1
color: #32325d;
font-weight: 400;
line-height: 50px;
font-size: 40px;
margin: 20px 0;
padding: 0;

.Checkout
margin: 0 auto;
max-width: 800px;
box-sizing: border-box;
padding: 0 5px;

label
color: #6b7c93;
font-weight: 300;
letter-spacing: 0.025em;

button
white-space: nowrap;
border: 0;
outline: 0;
display: inline-block;
height: 40px;
line-height: 40px;
padding: 0 14px;
box-shadow: 0 4px 6px rgba(50, 50, 93, .11), 0 1px 3px rgba(0, 0, 0, .08);
color: #fff;
border-radius: 4px;
font-size: 15px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.025em;
background-color: #6772e5;
text-decoration: none;
-webkit-transition: all 150ms ease;
transition: all 150ms ease;
margin-top: 10px;

form
margin-bottom: 40px;
padding-bottom: 40px;
border-bottom: 3px solid #e6ebf1;

button:hover
color: #fff;
cursor: pointer;
background-color: #7795f8;
transform: translateY(-1px);
box-shadow: 0 7px 14px rgba(50, 50, 93, .10), 0 3px 6px rgba(0, 0, 0, .08);

input,
.StripeElement
display: block;
margin: 10px 0 20px 0;
max-width: 500px;
padding: 10px 14px;
font-size: 1em;
font-family: 'Source Code Pro', monospace;
box-shadow: rgba(50, 50, 93, 0.14902) 0px 1px 3px, rgba(0, 0, 0, 0.0196078) 0px 1px 0px;
border: 0;
outline: 0;
border-radius: 4px;
background: white;

input::placeholder
color: #aab7c4;

input:focus,
.StripeElement--focus
box-shadow: rgba(50, 50, 93, 0.109804) 0px 4px 6px, rgba(0, 0, 0, 0.0784314) 0px 1px 3px;
-webkit-transition: all 150ms ease;
transition: all 150ms ease;

.StripeElement.IdealBankElement,
.StripeElement.PaymentRequestButton
padding: 0;

</style>
</head>

<body>
<div class="App">
</div>
<script src="/Ecran/UtilisateurConnecte/BottomTab/Feed.js"></script>
</body>

</html>


feed.js



import React from 'react';
import render from 'react-dom';
import ReactDOM from 'react-dom';


import View, Text from 'react-native';

import type InjectedProps from '../../../src/components/inject';


import
CardElement,
CardNumberElement,
CardExpiryElement,
CardCVCElement,
PaymentRequestButtonElement,
IbanElement,
IdealBankElement,
StripeProvider,
Elements,
injectStripe,
from '../../../src/index';

const handleBlur = () =>
console.log('[blur]');
;
const handleChange = (change) =>
console.log('[change]', change);
;
const handleClick = () =>
console.log('[click]');
;
const handleFocus = () =>
console.log('[focus]');
;
const handleReady = () =>
console.log('[ready]');
;

const createOptions = (fontSize, padding) =>
return
style:
base:
fontSize,
color: '#424770',
letterSpacing: '0.025em',
fontFamily: 'Source Code Pro, monospace',
'::placeholder':
color: '#aab7c4',
,
padding,
,
invalid:
color: '#9e2146',
,
,
;
;

class _CardForm extends React.Component
handleSubmit = (ev) =>
ev.preventDefault();
if (this.props.stripe)
this.props.stripe
.createToken()
.then((payload) => console.log('[token]', payload));
else
console.log("Stripe.js hasn't loaded yet.");

;
render()
return (
<form onSubmit=this.handleSubmit>
<label>
Card details
<CardElement
onBlur=handleBlur
onChange=handleChange
onFocus=handleFocus
onReady=handleReady
...createOptions(this.props.fontSize)
/>
</label>
<button>Pay</button>
</form>
);


const CardForm = injectStripe(_CardForm);

class _SplitForm extends React.Component
handleSubmit = (ev) =>
ev.preventDefault();
if (this.props.stripe)
this.props.stripe
.createToken()
.then((payload) => console.log('[token]', payload));
else
console.log("Stripe.js hasn't loaded yet.");

;
render()
return (
<form onSubmit=this.handleSubmit>
<label>
Card number
<CardNumberElement
onBlur=handleBlur
onChange=handleChange
onFocus=handleFocus
onReady=handleReady
...createOptions(this.props.fontSize)
/>
</label>
<label>
Expiration date
<CardExpiryElement
onBlur=handleBlur
onChange=handleChange
onFocus=handleFocus
onReady=handleReady
...createOptions(this.props.fontSize)
/>
</label>
<label>
CVC
<CardCVCElement
onBlur=handleBlur
onChange=handleChange
onFocus=handleFocus
onReady=handleReady
...createOptions(this.props.fontSize)
/>
</label>
<label>
Postal code
<PostalCodeElement
onBlur=handleBlur
onChange=handleChange
onFocus=handleFocus
onReady=handleReady
...createOptions(this.props.fontSize)
/>
</label>
<button>Pay</button>
</form>
);


const SplitForm = injectStripe(_SplitForm);

class _PaymentRequestForm extends React.Component
constructor(props)
super(props);

const paymentRequest = props.stripe.paymentRequest(
country: 'US',
currency: 'usd',
total:
label: 'Demo total',
amount: 1000,
,
);

paymentRequest.on('token', (complete, token, ...data) =>
console.log('Received Stripe token: ', token);
console.log('Received customer information: ', data);
complete('success');
);

paymentRequest.canMakePayment().then((result) =>
this.setState(canMakePayment: !!result);
);

this.state =
canMakePayment: false,
paymentRequest,
;


render()
return this.state.canMakePayment ? (
<PaymentRequestButtonElement
className="PaymentRequestButton"
onBlur=handleBlur
onClick=handleClick
onFocus=handleFocus
onReady=handleReady
paymentRequest=this.state.paymentRequest
style=
paymentRequestButton:
theme: 'dark',
height: '64px',
type: 'donate',
,

/>
) : null;


const PaymentRequestForm = injectStripe(_PaymentRequestForm);

class _IbanForm extends React.Component
handleSubmit = (ev) =>
ev.preventDefault();
if (this.props.stripe)
this.props.stripe
.createSource(
type: 'sepa_debit',
currency: 'eur',
owner:
name: ev.target.name.value,
email: ev.target.email.value,
,
mandate:
notification_method: 'email',
,
)
.then((payload) => console.log('[source]', payload));
else
console.log("Stripe.js hasn't loaded yet.");

;
render()
return (
<form onSubmit=this.handleSubmit>
<label>
Name
<input name="name" type="text" placeholder="Jane Doe" required />
</label>
<label>
Email
<input
name="email"
type="email"
placeholder="jane.doe@example.com"
required
/>
</label>
<label>
IBAN
<IbanElement
supportedCountries=['SEPA']
onBlur=handleBlur
onChange=handleChange
onFocus=handleFocus
onReady=handleReady
...createOptions(this.props.fontSize)
/>
</label>
<button>Pay</button>
</form>
);


const IbanForm = injectStripe(_IbanForm);

class _IdealBankForm extends React.Component
handleSubmit = (ev) =>
ev.preventDefault();
if (this.props.stripe)
this.props.stripe
.createSource(
type: 'ideal',
amount: 1099,
currency: 'eur',
owner:
name: ev.target.name.value,
,
redirect:
return_url: 'https://example.com',
,
)
.then((payload) => console.log('[source]', payload));
else
console.log("Stripe.js hasn't loaded yet.");

;
render()
return (
<form onSubmit=this.handleSubmit>
<label>
Name
<input name="name" type="text" placeholder="Jane Doe" required />
</label>
<label>
iDEAL Bank
<IdealBankElement
className="IdealBankElement"
onBlur=handleBlur
onChange=handleChange
onFocus=handleFocus
onReady=handleReady
...createOptions(this.props.fontSize, '10px 14px')
/>
</label>
<button>Pay</button>
</form>
);


const IdealBankForm = injectStripe(_IdealBankForm);

class Checkout extends React.Component
constructor()
super();
this.state =
elementFontSize: window.innerWidth < 450 ? '14px' : '18px',
;
window.addEventListener('resize', () =>
if (window.innerWidth < 450 && this.state.elementFontSize !== '14px')
this.setState(elementFontSize: '14px');
else if (
window.innerWidth >= 450 &&
this.state.elementFontSize !== '18px'
)
this.setState(elementFontSize: '18px');

);


render()
const elementFontSize = this.state;
return (
<div className="Checkout">
<h1>Available Elements</h1>
<Elements>
<CardForm fontSize=elementFontSize />
</Elements>
<Elements>
<SplitForm fontSize=elementFontSize />
</Elements>
<Elements>
<PaymentRequestForm />
</Elements>
<Elements>
<IbanForm fontSize=elementFontSize />
</Elements>
<Elements>
<IdealBankForm fontSize=elementFontSize />
</Elements>
</div>
);


const App = () =>
return (
<StripeProvider apiKey="pk_test_6pRNASCoBOKtIshFeQd4XMUh">
<Checkout />
</StripeProvider>
);
;
ReactDOM.render(<App />, document.querySelector('.App'));









share|improve this question
















I try to use Stripe API.
When i load : https://js.stripe.com/v3



and at the end of the Feed.js file



I got the error below:




Can't find variable: document




I don't understand what's the problem.



I'm using Expo and i tried import storybook but it didn't solve my problem. Below the index.html file And my Feed.js File



<!DOCTYPE html>
<html>

<head>
<title>demo | react-stripe-elements</title>
<script src="https://js.stripe.com/v3/"></script>
<style>
*
box-sizing: border-box;

body,
html
background-color: #f6f9fc;
font-size: 18px;
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;

h1
color: #32325d;
font-weight: 400;
line-height: 50px;
font-size: 40px;
margin: 20px 0;
padding: 0;

.Checkout
margin: 0 auto;
max-width: 800px;
box-sizing: border-box;
padding: 0 5px;

label
color: #6b7c93;
font-weight: 300;
letter-spacing: 0.025em;

button
white-space: nowrap;
border: 0;
outline: 0;
display: inline-block;
height: 40px;
line-height: 40px;
padding: 0 14px;
box-shadow: 0 4px 6px rgba(50, 50, 93, .11), 0 1px 3px rgba(0, 0, 0, .08);
color: #fff;
border-radius: 4px;
font-size: 15px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.025em;
background-color: #6772e5;
text-decoration: none;
-webkit-transition: all 150ms ease;
transition: all 150ms ease;
margin-top: 10px;

form
margin-bottom: 40px;
padding-bottom: 40px;
border-bottom: 3px solid #e6ebf1;

button:hover
color: #fff;
cursor: pointer;
background-color: #7795f8;
transform: translateY(-1px);
box-shadow: 0 7px 14px rgba(50, 50, 93, .10), 0 3px 6px rgba(0, 0, 0, .08);

input,
.StripeElement
display: block;
margin: 10px 0 20px 0;
max-width: 500px;
padding: 10px 14px;
font-size: 1em;
font-family: 'Source Code Pro', monospace;
box-shadow: rgba(50, 50, 93, 0.14902) 0px 1px 3px, rgba(0, 0, 0, 0.0196078) 0px 1px 0px;
border: 0;
outline: 0;
border-radius: 4px;
background: white;

input::placeholder
color: #aab7c4;

input:focus,
.StripeElement--focus
box-shadow: rgba(50, 50, 93, 0.109804) 0px 4px 6px, rgba(0, 0, 0, 0.0784314) 0px 1px 3px;
-webkit-transition: all 150ms ease;
transition: all 150ms ease;

.StripeElement.IdealBankElement,
.StripeElement.PaymentRequestButton
padding: 0;

</style>
</head>

<body>
<div class="App">
</div>
<script src="/Ecran/UtilisateurConnecte/BottomTab/Feed.js"></script>
</body>

</html>


feed.js



import React from 'react';
import render from 'react-dom';
import ReactDOM from 'react-dom';


import View, Text from 'react-native';

import type InjectedProps from '../../../src/components/inject';


import
CardElement,
CardNumberElement,
CardExpiryElement,
CardCVCElement,
PaymentRequestButtonElement,
IbanElement,
IdealBankElement,
StripeProvider,
Elements,
injectStripe,
from '../../../src/index';

const handleBlur = () =>
console.log('[blur]');
;
const handleChange = (change) =>
console.log('[change]', change);
;
const handleClick = () =>
console.log('[click]');
;
const handleFocus = () =>
console.log('[focus]');
;
const handleReady = () =>
console.log('[ready]');
;

const createOptions = (fontSize, padding) =>
return
style:
base:
fontSize,
color: '#424770',
letterSpacing: '0.025em',
fontFamily: 'Source Code Pro, monospace',
'::placeholder':
color: '#aab7c4',
,
padding,
,
invalid:
color: '#9e2146',
,
,
;
;

class _CardForm extends React.Component
handleSubmit = (ev) =>
ev.preventDefault();
if (this.props.stripe)
this.props.stripe
.createToken()
.then((payload) => console.log('[token]', payload));
else
console.log("Stripe.js hasn't loaded yet.");

;
render()
return (
<form onSubmit=this.handleSubmit>
<label>
Card details
<CardElement
onBlur=handleBlur
onChange=handleChange
onFocus=handleFocus
onReady=handleReady
...createOptions(this.props.fontSize)
/>
</label>
<button>Pay</button>
</form>
);


const CardForm = injectStripe(_CardForm);

class _SplitForm extends React.Component
handleSubmit = (ev) =>
ev.preventDefault();
if (this.props.stripe)
this.props.stripe
.createToken()
.then((payload) => console.log('[token]', payload));
else
console.log("Stripe.js hasn't loaded yet.");

;
render()
return (
<form onSubmit=this.handleSubmit>
<label>
Card number
<CardNumberElement
onBlur=handleBlur
onChange=handleChange
onFocus=handleFocus
onReady=handleReady
...createOptions(this.props.fontSize)
/>
</label>
<label>
Expiration date
<CardExpiryElement
onBlur=handleBlur
onChange=handleChange
onFocus=handleFocus
onReady=handleReady
...createOptions(this.props.fontSize)
/>
</label>
<label>
CVC
<CardCVCElement
onBlur=handleBlur
onChange=handleChange
onFocus=handleFocus
onReady=handleReady
...createOptions(this.props.fontSize)
/>
</label>
<label>
Postal code
<PostalCodeElement
onBlur=handleBlur
onChange=handleChange
onFocus=handleFocus
onReady=handleReady
...createOptions(this.props.fontSize)
/>
</label>
<button>Pay</button>
</form>
);


const SplitForm = injectStripe(_SplitForm);

class _PaymentRequestForm extends React.Component
constructor(props)
super(props);

const paymentRequest = props.stripe.paymentRequest(
country: 'US',
currency: 'usd',
total:
label: 'Demo total',
amount: 1000,
,
);

paymentRequest.on('token', (complete, token, ...data) =>
console.log('Received Stripe token: ', token);
console.log('Received customer information: ', data);
complete('success');
);

paymentRequest.canMakePayment().then((result) =>
this.setState(canMakePayment: !!result);
);

this.state =
canMakePayment: false,
paymentRequest,
;


render()
return this.state.canMakePayment ? (
<PaymentRequestButtonElement
className="PaymentRequestButton"
onBlur=handleBlur
onClick=handleClick
onFocus=handleFocus
onReady=handleReady
paymentRequest=this.state.paymentRequest
style=
paymentRequestButton:
theme: 'dark',
height: '64px',
type: 'donate',
,

/>
) : null;


const PaymentRequestForm = injectStripe(_PaymentRequestForm);

class _IbanForm extends React.Component
handleSubmit = (ev) =>
ev.preventDefault();
if (this.props.stripe)
this.props.stripe
.createSource(
type: 'sepa_debit',
currency: 'eur',
owner:
name: ev.target.name.value,
email: ev.target.email.value,
,
mandate:
notification_method: 'email',
,
)
.then((payload) => console.log('[source]', payload));
else
console.log("Stripe.js hasn't loaded yet.");

;
render()
return (
<form onSubmit=this.handleSubmit>
<label>
Name
<input name="name" type="text" placeholder="Jane Doe" required />
</label>
<label>
Email
<input
name="email"
type="email"
placeholder="jane.doe@example.com"
required
/>
</label>
<label>
IBAN
<IbanElement
supportedCountries=['SEPA']
onBlur=handleBlur
onChange=handleChange
onFocus=handleFocus
onReady=handleReady
...createOptions(this.props.fontSize)
/>
</label>
<button>Pay</button>
</form>
);


const IbanForm = injectStripe(_IbanForm);

class _IdealBankForm extends React.Component
handleSubmit = (ev) =>
ev.preventDefault();
if (this.props.stripe)
this.props.stripe
.createSource(
type: 'ideal',
amount: 1099,
currency: 'eur',
owner:
name: ev.target.name.value,
,
redirect:
return_url: 'https://example.com',
,
)
.then((payload) => console.log('[source]', payload));
else
console.log("Stripe.js hasn't loaded yet.");

;
render()
return (
<form onSubmit=this.handleSubmit>
<label>
Name
<input name="name" type="text" placeholder="Jane Doe" required />
</label>
<label>
iDEAL Bank
<IdealBankElement
className="IdealBankElement"
onBlur=handleBlur
onChange=handleChange
onFocus=handleFocus
onReady=handleReady
...createOptions(this.props.fontSize, '10px 14px')
/>
</label>
<button>Pay</button>
</form>
);


const IdealBankForm = injectStripe(_IdealBankForm);

class Checkout extends React.Component
constructor()
super();
this.state =
elementFontSize: window.innerWidth < 450 ? '14px' : '18px',
;
window.addEventListener('resize', () =>
if (window.innerWidth < 450 && this.state.elementFontSize !== '14px')
this.setState(elementFontSize: '14px');
else if (
window.innerWidth >= 450 &&
this.state.elementFontSize !== '18px'
)
this.setState(elementFontSize: '18px');

);


render()
const elementFontSize = this.state;
return (
<div className="Checkout">
<h1>Available Elements</h1>
<Elements>
<CardForm fontSize=elementFontSize />
</Elements>
<Elements>
<SplitForm fontSize=elementFontSize />
</Elements>
<Elements>
<PaymentRequestForm />
</Elements>
<Elements>
<IbanForm fontSize=elementFontSize />
</Elements>
<Elements>
<IdealBankForm fontSize=elementFontSize />
</Elements>
</div>
);


const App = () =>
return (
<StripeProvider apiKey="pk_test_6pRNASCoBOKtIshFeQd4XMUh">
<Checkout />
</StripeProvider>
);
;
ReactDOM.render(<App />, document.querySelector('.App'));






react-native expo






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 7 at 19:35









James Z

11.2k71936




11.2k71936










asked Mar 7 at 18:43









DorianDorian

86




86







  • 1





    Are you usen Text and View from react native in html ? ... that's not gonna work. You cannot use html as your core in react native

    – ValdaXD
    Mar 7 at 19:51











  • Even if i delete my index.html i got the error Can't find variable: document @ValdaXD

    – Dorian
    Mar 7 at 21:11












  • 1





    Are you usen Text and View from react native in html ? ... that's not gonna work. You cannot use html as your core in react native

    – ValdaXD
    Mar 7 at 19:51











  • Even if i delete my index.html i got the error Can't find variable: document @ValdaXD

    – Dorian
    Mar 7 at 21:11







1




1





Are you usen Text and View from react native in html ? ... that's not gonna work. You cannot use html as your core in react native

– ValdaXD
Mar 7 at 19:51





Are you usen Text and View from react native in html ? ... that's not gonna work. You cannot use html as your core in react native

– ValdaXD
Mar 7 at 19:51













Even if i delete my index.html i got the error Can't find variable: document @ValdaXD

– Dorian
Mar 7 at 21:11





Even if i delete my index.html i got the error Can't find variable: document @ValdaXD

– Dorian
Mar 7 at 21:11












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55050761%2fcant-find-variable-document-reactnative-js%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55050761%2fcant-find-variable-document-reactnative-js%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived