This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const ForceCaseSensitivityPlugin = require("force-case-sensitivity-webpack-plugin"); | |
| const ManifestPlugin = require("webpack-manifest-plugin"); | |
| module.exports = { | |
| entry: { | |
| app: ["./app.js"] | |
| }, | |
| output: "./public", | |
| module: { | |
| rules: [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const ForceCaseSensitivityPlugin = require("force-case-sensitivity-webpack-plugin"); | |
| const ManifestPlugin = require("webpack-manifest-plugin"); | |
| const SpeedMeasurePlugin = require("speed-measure-webpack-plugin"); | |
| const smp = new SpeedMeasurePlugin(); | |
| module.exports = smp.wrap({ | |
| entry: { | |
| app: ["./app.js"] | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from "react"; | |
| import { animateSwitch } from "./animateSwitch"; | |
| import { SlideOut } from "./SlideOut"; | |
| const SwitchWithSlide = animateSwitch(Switch, SlideOut); | |
| export default () => ( | |
| <SwitchWithSlide> | |
| <Route path="/a" component={PageA} /> | |
| <Route path="/b" component={PageB} /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| render() { | |
| const { | |
| prevChild, | |
| curChild, | |
| childPosition, | |
| animationCallback, | |
| } = this.state; | |
| return ( | |
| <Slider |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| componentDidUpdate(prevProps, prevState) { | |
| const prevUniqId = prevProps.uniqKey || prevProps.children.type; | |
| const uniqId = this.props.uniqKey || this.props.children.type; | |
| if (prevUniqId !== uniqId) { | |
| this.setState({ | |
| childPosition: Slider.TO_LEFT, | |
| curChild: this.props.children, | |
| curUniqId: uniqId, | |
| prevChild: prevProps.children, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| swapChildren = () => { | |
| this.setState({ | |
| childPosition: Slider.FROM_RIGHT, | |
| prevChild: null, | |
| prevUniqId: null, | |
| animationCallback: null | |
| }); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| render() { | |
| return ( | |
| <Route | |
| render={({ location }) => ( | |
| <SlideOut uniqKey={location.pathname}> | |
| <Switch location={location}> | |
| <Route path="/a" component={PathA} /> | |
| <Route path="/b" component={PathB} /> | |
| </Switch> | |
| </SlideOut> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const animateSwitch = (CustomSwitch, AnimatorComponent) => ({ | |
| children, | |
| }) => ( | |
| <Route | |
| render={({ location }) => ( | |
| <AnimatorComponent uniqKey={location.pathname}> | |
| <CustomSwitch location={location}>{children}</CustomSwitch> | |
| </AnimatorComponent> | |
| )} | |
| /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const App = () => ( | |
| <Switch> | |
| <Route path="/a" component={PathA} /> | |
| <Route path="/b" component={PathB} /> | |
| </Switch> | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const SwitchWithSlide = animateSwitch(Switch, SlideOut); | |
| const App = () => ( | |
| <SwitchWithSlide> | |
| <Route path="/a" component={PathA} /> | |
| <Route path="/b" component={PathB} /> | |
| </SwitchWithSlide> | |
| ); |
OlderNewer