Skip to content

Commit

Permalink
Pull out legacy browser support CSS (#470)
Browse files Browse the repository at this point in the history
  • Loading branch information
taion authored and oliviertassinari committed Sep 24, 2018
1 parent a41cfed commit 7666de1
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 29 deletions.
2 changes: 1 addition & 1 deletion docs/src/modules/components/AppDrawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function AppDrawer(props, context) {
<div className={classes.toolbar}>
<Link className={classes.title} href="/" onClick={onClose}>
<Typography variant="title" color="inherit">
Material-UI
react-swipeable-views
</Typography>
</Link>
{process.env.LIB_VERSION ? (
Expand Down
6 changes: 5 additions & 1 deletion docs/src/pages/getting-started/supported-platforms.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Supported platforms

<p class="description">Learn about the platforms, from modern to old, that are supported by Material-UI.</p>
<p class="description">Learn about the platforms, from modern to old, that are supported by react-swipeable-views.</p>

The API is as consistent as possible between the three platforms so
the same component can be used independently on where it's running.
Expand All @@ -11,6 +11,10 @@ the same component can be used independently on where it's running.
|:------|:-----|:--------------|:--------|:-------|:-------|
| >= 10 || x | >= 28 | >= 29 | >= 8 |

#### Legacy browser support

react-swipeable-views supports modern browsers out-of-the-box, but requires additional CSS to support legacy browsers. To support IE 10 and older versions of Mobile Safari, include `react-swipeable-views/dist/legacy-browser-support.css`.

![browser](/static/platformBrowser.gif)

### iOS
Expand Down
1 change: 1 addition & 0 deletions packages/react-swipeable-views/.npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
!/src/*.js
!/lib/*.js
!/dist/*
*.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.react-swipeable-view-container {
display: -webkit-box;
display: -ms-flexbox;
}

.react-swipeable-view-container > div {
-ms-flex-negative: 0;
}
27 changes: 0 additions & 27 deletions packages/react-swipeable-views/src/SwipeableViews.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,6 @@ function addEventListenerEnhanced(node, event, handler, options) {
};
}

let styleInjected = false;

// Support old version of iOS and IE 10.
// To be deleted in 2019.
function injectStyle() {
// Inject once for all the instances
if (!styleInjected) {
const style = document.createElement('style');
style.innerHTML = `
.react-swipeable-view-container {
display: -webkit-box;
display: -ms-flexbox;
}
.react-swipeable-view-container > div {
-ms-flex-negative: 0;
}
`;

if (document.body) {
document.body.appendChild(style);
}
styleInjected = true;
}
}

const styles = {
container: {
direction: 'ltr',
Expand Down Expand Up @@ -325,8 +300,6 @@ class SwipeableViews extends React.Component {
}, 0);
}

injectStyle();

// Send all functions in an object if action param is set.
if (this.props.action) {
this.props.action({
Expand Down

0 comments on commit 7666de1

Please sign in to comment.