Skip to content

Commit

Permalink
Merge pull request #326 from reactioncommerce/fix-325-aldeed-stripe-f…
Browse files Browse the repository at this point in the history
…orm-error

Fix StripeForm error
  • Loading branch information
nnnnat authored Oct 11, 2018
2 parents ae4a341 + 876d6f9 commit a95899d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
8 changes: 5 additions & 3 deletions package/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
## Getting Started

```bash
npm install --save react@16.4.1 prop-types@15.6.2 styled-components@3.3.3 @reactioncommerce/components
npm install --save react@16.4.2 prop-types@15.6.2 styled-components@3.3.3 reacto-form@0.0.2 @reactioncommerce/components-context@1.0.0 @reactioncommerce/components
```

or

```bash
yarn add react@16.4.1 prop-types@15.6.2 styled-components@3.3.3 @reactioncommerce/components
yarn add react@16.4.2 prop-types@15.6.2 styled-components@3.3.3 reacto-form@0.0.2 @reactioncommerce/components-context@1.0.0 @reactioncommerce/components
```

Note that the minimum required React version is 16.4.1 because this package uses newer APIs like `createContext` and `forwardRef`. The `react`, `prop-types`, and `styled-components` packages are peer dependencies, which means that you must install the proper versions in your app. They are not included with this package.
Note that the minimum required React version is 16.4.1 because this package uses newer APIs like `createContext` and `forwardRef`. The `react`, `prop-types`, `@reactioncommerce/components-context`, `reacto-form`, and `styled-components` packages are peer dependencies, which means that you must install the proper versions in your app. They are not included with this package.

> If you use the `StripeForm` component, then you must also install `react-stripe-elements@2.0.1`. It is an optional peer dependency.
Then import a component:

Expand Down
8 changes: 6 additions & 2 deletions package/src/components/StripeForm/v1/StripeForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
PostalCodeElement,
injectStripe
} from "react-stripe-elements";
import styled, { withTheme } from "styled-components";
import styled from "styled-components";
import { withComponents } from "@reactioncommerce/components-context";
import { applyTheme, withStripeElements } from "../../../utils";

Expand Down Expand Up @@ -243,4 +243,8 @@ class StripeForm extends Component {
}
}

export default withTheme(withComponents(withStripeElements(injectStripe(StripeForm))));
// We should be using `withTheme` here, but it seems to cause serious errors in the
// deployed app, and does not work anyway. Need to investigate why `withComponents`
// works and does not cause errors but `withTheme` does not work. It is surely
// something related to the iframes that Stripe uses.
export default withComponents(withStripeElements(injectStripe(StripeForm)));
12 changes: 6 additions & 6 deletions styleguide/src/sections/InstallingandImporting.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#### Install

With NPM:

```bash
npm install --save react@16.4.1 prop-types@15.6.2 styled-components@3.3.3 @reactioncommerce/components
npm install --save react@16.4.2 prop-types@15.6.2 styled-components@3.3.3 reacto-form@0.0.2 @reactioncommerce/components-context@1.0.0 @reactioncommerce/components
```

With Yarn:
or

```bash
yarn add react@16.4.1 prop-types@15.6.2 styled-components@3.3.3 @reactioncommerce/components
yarn add react@16.4.2 prop-types@15.6.2 styled-components@3.3.3 reacto-form@0.0.2 @reactioncommerce/components-context@1.0.0 @reactioncommerce/components
```

Note that the minimum required React version is 16.4.1 because this package uses newer APIs like `createContext` and `forwardRef`. The `react`, `prop-types`, and `styled-components` packages are peer dependencies, which means that you must install the proper versions in your app. They are not included with this package.
Note that the minimum required React version is 16.4.1 because this package uses newer APIs like `createContext` and `forwardRef`. The `react`, `prop-types`, `@reactioncommerce/components-context`, `reacto-form`, and `styled-components` packages are peer dependencies, which means that you must install the proper versions in your app. They are not included with this package.

> If you use the `StripeForm` component, then you must also install `react-stripe-elements@2.0.1`. It is an optional peer dependency.
##### Verify Peer Dependencies

Expand Down

0 comments on commit a95899d

Please sign in to comment.