diff --git a/src/NavigationBar.js b/src/NavigationBar.js
index 7707107..1806c8d 100644
--- a/src/NavigationBar.js
+++ b/src/NavigationBar.js
@@ -11,7 +11,7 @@ export default ({ pages, position, ...props }) => {
props.render(pages) :
(
{
- pages.map((page, k) => {
+ Array.isArray(pages) && pages.map((page, k) => {
return (
-
{
diff --git a/src/PageManager.js b/src/PageManager.js
index 524e2ac..0f09a19 100644
--- a/src/PageManager.js
+++ b/src/PageManager.js
@@ -37,18 +37,12 @@ export class PageManager extends Component {
const { children, location } = this.props
const currentKey = location.pathname.split("/")[1] || "/";
const timeout = { enter: 500, exit: 500 };
- let pages = []
- const routes = children.filter( child => {
- if (child.type === Page) {
- pages.push({ name: child.props.name, path: child.props.path })
- return child
- } else {
- return null
- }
- })
- const navbars = children.filter(child => {
- return child.type === NavigationBar
- })
+ const routes = children.filter( c => c.type === Page )
+ const animatedPages = children.filter( r => !r.props.noAnim )
+ const notAnimatedPages = children.filter( r => r.props.noAnim )
+ const pages = routes.filter(r => !r.props.noNavbar).map(r => ({ name: r.props.name, path: r.props.path }))
+ const navbars = children.filter(child => child.type === NavigationBar)
+
return (
= 0 ? "right" : "left")}>
{
- React.Children.map(routes, route => {
- const { exact, path, ...props } = route.props
+ animatedPages.map(page => {
+ const { exact, path, ...props } = page.props
return (
- React.cloneElement(route, { ...props })} />
+ React.cloneElement(page, { ...props })} />
)
})
}
- { React.Children.map(navbars, (navbar) => {
+
+
+ {
+ notAnimatedPages.map(page => {
+ const { exact, path, ...props } = page.props
+ return (
+ React.cloneElement(page, { ...props })} />
+ )
+ })
+ }
+
+
+ { navbars.map((navbar) => {
return React.cloneElement(navbar, { pages })
}) }
@@ -80,8 +86,9 @@ export class PageManager extends Component {
const PageManagerWithRouter = withRouter(PageManager)
-export default props => (
+export default props => {
+ return (
-);
+)};
diff --git a/src/index.js b/src/index.js
index e0ab39d..fa8f5bc 100644
--- a/src/index.js
+++ b/src/index.js
@@ -9,10 +9,19 @@ import NavigationBar from './NavigationBar';
ReactDOM.render(
-
-
-
-
+
+
+ Splash
+
+
+ Home
+
+
+ page 2
+
+
+ Page 3
+