Skip to content

Commit c6fe8d0

Browse files
committed
Update demo files for ghpages
1 parent 14ec235 commit c6fe8d0

File tree

2 files changed

+31
-16
lines changed

2 files changed

+31
-16
lines changed

docs/demo.js

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -371,13 +371,18 @@ __webpack_require__.r(__webpack_exports__);
371371
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js");
372372
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);
373373
/* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./api */ "./src/api.js");
374+
/* harmony import */ var _context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./context */ "./src/context.js");
375+
374376

375377

376378

377379
class Braintree extends react__WEBPACK_IMPORTED_MODULE_0__.Component {
378380
constructor(props) {
379381
super(props);
380382
this.api = new _api__WEBPACK_IMPORTED_MODULE_2__.default(props);
383+
this.contextValue = {
384+
braintreeApi: this.api
385+
};
381386
}
382387

383388
componentDidMount() {
@@ -400,12 +405,6 @@ class Braintree extends react__WEBPACK_IMPORTED_MODULE_0__.Component {
400405
return this.api.tokenize(options);
401406
}
402407

403-
getChildContext() {
404-
return {
405-
braintreeApi: this.api
406-
};
407-
}
408-
409408
render() {
410409
var {
411410
className: providedClass,
@@ -417,9 +416,11 @@ class Braintree extends react__WEBPACK_IMPORTED_MODULE_0__.Component {
417416
className += " ".concat(providedClass);
418417
}
419418

420-
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Tag, {
419+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_context__WEBPACK_IMPORTED_MODULE_3__.Context.Provider, {
420+
value: this.contextValue
421+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Tag, {
421422
className: className
422-
}, this.props.children);
423+
}, this.props.children));
423424
}
424425

425426
}
@@ -438,9 +439,25 @@ Braintree.propTypes = {
438439
Braintree.defaultProps = {
439440
tagName: 'div'
440441
};
441-
Braintree.childContextTypes = {
442-
braintreeApi: prop_types__WEBPACK_IMPORTED_MODULE_1___default().instanceOf(_api__WEBPACK_IMPORTED_MODULE_2__.default)
443-
};
442+
443+
/***/ }),
444+
445+
/***/ "./src/context.js":
446+
/*!************************!*\
447+
!*** ./src/context.js ***!
448+
\************************/
449+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
450+
451+
"use strict";
452+
__webpack_require__.r(__webpack_exports__);
453+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
454+
/* harmony export */ "Context": () => (/* binding */ Context)
455+
/* harmony export */ });
456+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js");
457+
458+
var Context = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createContext({
459+
braintreeApi: null
460+
});
444461

445462
/***/ }),
446463

@@ -458,7 +475,7 @@ __webpack_require__.r(__webpack_exports__);
458475
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js");
459476
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js");
460477
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);
461-
/* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./api */ "./src/api.js");
478+
/* harmony import */ var _context__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./context */ "./src/context.js");
462479

463480

464481

@@ -526,9 +543,7 @@ BraintreeHostedField.propTypes = {
526543
onBlur: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func),
527544
prefill: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string)
528545
};
529-
BraintreeHostedField.contextTypes = {
530-
braintreeApi: prop_types__WEBPACK_IMPORTED_MODULE_1___default().instanceOf(_api__WEBPACK_IMPORTED_MODULE_2__.default)
531-
};
546+
BraintreeHostedField.contextType = _context__WEBPACK_IMPORTED_MODULE_2__.Context;
532547

533548
/***/ }),
534549

docs/demo.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)