Skip to content

Commit 94cd720

Browse files
authored
Merge pull request #98 from bootstrap-styled/dev
Dev
2 parents f96cde5 + 8ac6d6d commit 94cd720

File tree

3 files changed

+39
-43
lines changed

3 files changed

+39
-43
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
organization: $(echo $TRAVIS_REPO_SLUG | awk -F '/' '{print $1}')
5454
script:
5555
- npm run test
56-
- if [[ "$TRAVIS_BRANCH" != greenkeeper* ]]; then sonar-scanner -Dsonar.projectVersion=${SONAR_VERSION}; fi
56+
- if [[ "$TRAVIS_BRANCH" != greenkeeper* && -z "$SONAR_TOKEN" ]]; then sonar-scanner -Dsonar.projectVersion=${SONAR_VERSION}; fi
5757

5858
# Job: Release
5959
- stage: release

package.json

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"jsdoc": "jsdoc-documentation --file",
3737
"prestyleguide": "npm run jsdoc",
3838
"styleguide": "styleguidist server",
39-
"prestyleguide:build": "npm run jsdoc",
39+
"prestyleguide:build": "npm run jsdoc && ./styleguide/prepare.sh",
4040
"styleguide:build": "styleguidist build"
4141
},
4242
"repository": {
@@ -63,29 +63,29 @@
6363
"license": "MIT",
6464
"devDependencies": {
6565
"@babel/cli": "^7.2.3",
66-
"@babel/core": "^7.2.2",
66+
"@babel/core": "^7.3.4",
6767
"@babel/plugin-external-helpers": "^7.2.0",
68-
"@babel/plugin-proposal-class-properties": "^7.3.0",
68+
"@babel/plugin-proposal-class-properties": "^7.3.4",
6969
"@babel/plugin-proposal-decorators": "^7.3.0",
7070
"@babel/plugin-proposal-json-strings": "^7.2.0",
71-
"@babel/plugin-proposal-object-rest-spread": "^7.3.2",
71+
"@babel/plugin-proposal-object-rest-spread": "^7.3.4",
7272
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
7373
"@babel/plugin-syntax-import-meta": "^7.2.0",
7474
"@babel/plugin-transform-modules-commonjs": "^7.2.0",
7575
"@babel/plugin-transform-react-constant-elements": "^7.2.0",
7676
"@babel/plugin-transform-react-inline-elements": "^7.2.0",
77-
"@babel/preset-env": "^7.3.1",
77+
"@babel/preset-env": "^7.3.4",
7878
"@babel/preset-react": "^7.0.0",
7979
"@bootstrap-styled/documentation": "^1.2.4",
8080
"@bootstrap-styled/provider": "^1.4.2",
81-
"@rollup-umd/documentation": "^1.3.13",
82-
"@rollup-umd/rollup": "^1.0.1",
81+
"@rollup-umd/documentation": "^1.3.20",
82+
"@rollup-umd/rollup": "^1.0.7",
8383
"@semantic-release/changelog": "^3.0.2",
8484
"@semantic-release/git": "^7.0.8",
8585
"@semantic-release/github": "^5.2.10",
8686
"@semantic-release/npm": "^5.1.4",
8787
"babel-eslint": "^10.0.1",
88-
"babel-jest": "^24.1.0",
88+
"babel-jest": "^24.3.1",
8989
"babel-loader": "^8.0.5",
9090
"babel-plugin-add-module-exports": "^1.0.0",
9191
"babel-plugin-array-includes": "^2.0.3",
@@ -96,34 +96,34 @@
9696
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
9797
"babel-preset-react-hmre": "^1.1.1",
9898
"cz-conventional-changelog": "^2.1.0",
99-
"enzyme": "^3.8.0",
100-
"enzyme-adapter-react-16": "^1.9.1",
101-
"eslint": "^5.13.0",
99+
"enzyme": "^3.9.0",
100+
"enzyme-adapter-react-16": "^1.10.0",
101+
"eslint": "^5.15.1",
102102
"eslint-config-airbnb": "^17.1.0",
103103
"eslint-plugin-import": "^2.16.0",
104104
"eslint-plugin-jsx-a11y": "^6.2.1",
105105
"eslint-plugin-react": "^7.12.4",
106106
"immutable": "^4.0.0-rc.12",
107-
"jest-cli": "^24.1.0",
107+
"jest-cli": "^24.3.1",
108108
"jest-sonar-reporter": "^2.0.0",
109-
"lint-staged": "^8.1.3",
109+
"lint-staged": "^8.1.5",
110110
"mini-html-webpack-plugin": "^0.2.3",
111111
"pre-commit": "^1.2.2",
112112
"raf": "^3.4.1",
113-
"react": "^16.8.0",
114-
"react-dom": "^16.8.0",
113+
"react": "^16.8.4",
114+
"react-dom": "^16.8.4",
115115
"react-styleguidist": "^8.0.6",
116-
"react-test-renderer": "^16.8.0",
116+
"react-test-renderer": "^16.8.4",
117117
"rimraf": "^2.6.3",
118-
"rollup": "^1.1.2",
118+
"rollup": "^1.6.0",
119119
"semantic-release": "^15.13.3",
120120
"styled-components": "^4.1.3",
121121
"stylelint": "^9.10.1",
122122
"stylelint-config-recommended": "^2.1.0",
123123
"stylelint-config-styled-components": "^0.1.1",
124124
"stylelint-processor-styled-components": "^1.5.2",
125125
"toctoc": "^0.3.2",
126-
"webpack": "^4.29.2"
126+
"webpack": "^4.29.6"
127127
},
128128
"jest": {
129129
"roots": [
@@ -182,20 +182,20 @@
182182
"@bootstrap-styled/css-mixins": "^2.0.6",
183183
"@bootstrap-styled/css-utils": "^1.2.6",
184184
"@bootstrap-styled/utils": "^1.7.1",
185-
"@rollup-umd/documentation-cli": "^1.1.1",
185+
"@rollup-umd/documentation-cli": "^1.1.3",
186186
"basic-math-utils": "^0.3.4",
187-
"bootstrap-styled": "^2.4.10",
187+
"bootstrap-styled": "^2.4.12",
188188
"classnames": "^2.2.6",
189189
"lodash.omit": "^4.5.0",
190190
"map-to-css-modules": "^1.0.6",
191-
"prop-types": "^15.6.2",
191+
"prop-types": "^15.7.2",
192192
"react-portal": "^4.2.0",
193-
"react-transition-group": "^2.5.3",
193+
"react-transition-group": "^2.6.0",
194194
"tether-fix": "^1.4.0-fix-es"
195195
},
196196
"peerDependencies": {
197-
"react": "^16.8.0",
198-
"react-dom": "^16.8.0",
197+
"react": "^16.8.4",
198+
"react-dom": "^16.8.4",
199199
"styled-components": "^4.1.3"
200200
},
201201
"publishConfig": {

src/TetherContent/index.js

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,19 @@ class TetherContent extends React.Component {// eslint-disable-line react/prefer
3737

3838
static defaultProps = defaultProps;
3939

40+
constructor(props) {
41+
super(props);
42+
43+
this.element = document.createElement('div');
44+
}
45+
4046
componentDidMount = () => {
4147
this.handleProps();
4248
}
4349

4450
componentDidUpdate = (prevProps) => {
4551
if (this.props.isOpen !== prevProps.isOpen) {
4652
this.handleProps();
47-
} else if (this.element) {
48-
// rerender
49-
this.renderIntoSubtree();
5053
}
5154
}
5255

@@ -92,10 +95,8 @@ class TetherContent extends React.Component {// eslint-disable-line react/prefer
9295
hide = () => {
9396
document.removeEventListener('click', this.handleDocumentClick, true);
9497

95-
if (this.element) {
98+
if (this.element.parentElement === document.body) {
9699
document.body.removeChild(this.element);
97-
ReactDOM.unmountComponentAtNode(this.element);
98-
this.element = null;
99100
}
100101

101102
if (this.tether) {
@@ -110,10 +111,8 @@ class TetherContent extends React.Component {// eslint-disable-line react/prefer
110111
show = () => {
111112
document.addEventListener('click', this.handleDocumentClick, true);
112113

113-
this.element = document.createElement('div');
114114
this.element.className = this.props.className;
115115
document.body.appendChild(this.element);
116-
this.renderIntoSubtree();
117116
this.tether = new Tether(this.getTetherConfig());
118117
if (this.props.tetherRef) {
119118
this.props.tetherRef(this.tether);
@@ -129,14 +128,6 @@ class TetherContent extends React.Component {// eslint-disable-line react/prefer
129128
return this.props.toggle();
130129
}
131130

132-
renderIntoSubtree = () => {
133-
ReactDOM.unstable_renderSubtreeIntoContainer(
134-
this,
135-
this.renderChildren(),
136-
this.element
137-
);
138-
}
139-
140131
renderChildren = () => {
141132
const { children, style } = this.props;
142133
return React.cloneElement(
@@ -146,8 +137,13 @@ class TetherContent extends React.Component {// eslint-disable-line react/prefer
146137
}
147138

148139
render() {
149-
return (
150-
null
140+
if (!this.props.isOpen) {
141+
return null;
142+
}
143+
144+
return ReactDOM.createPortal(
145+
this.renderChildren(),
146+
this.element
151147
);
152148
}
153149
}

0 commit comments

Comments
 (0)