Skip to content

Commit

Permalink
fix: fixed routeConfigs that used {screen: Component} style config
Browse files Browse the repository at this point in the history
  • Loading branch information
IjzerenHein committed Aug 30, 2019
1 parent 918493c commit 00c74a5
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/createSharedElementStackNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,26 @@ function createSharedElementEnabledNavigator(
...routeConfigs,
};
for (const key in routeConfigs) {
const component = wrappedRouteConfigs[key];
if (component.name === 'Navigator') {
let routeConfig = wrappedRouteConfigs[key];
const component = ((typeof routeConfig === 'object') && routeConfig.screen) ? routeConfig.screen : routeConfig;
if (component.name !== 'Navigator') {
// console.log('Navigator detected, ignoring: ', component);
wrappedRouteConfigs[key] = component;
} else {
wrappedRouteConfigs[key] = createSharedElementScene(
const wrappedComponent = createSharedElementScene(
component,
rendererData
);
if (component === routeConfig) {
wrappedRouteConfigs[key] = wrappedComponent;
}
else {
wrappedRouteConfigs[key] = {
...routeConfig,
screen: wrappedComponent
};
}
}
}

return createNavigator(wrappedRouteConfigs, {
...navigatorConfig,
onTransitionStart: (transitionProps: any, prevTransitionProps: any) => {
Expand Down

0 comments on commit 00c74a5

Please sign in to comment.