react-navigation-shared-element
Version:
react-native-shared-element bindings for React Navigation
34 lines • 1.02 kB
JavaScript
export function normalizeSharedElementConfig(sharedElementConfig) {
if (typeof sharedElementConfig === "string") {
return {
id: sharedElementConfig,
otherId: sharedElementConfig,
animation: "move"
};
}
else {
const { id, otherId, animation, ...other } = sharedElementConfig;
return {
id,
otherId: otherId || id,
animation: animation || "move",
...other
};
}
}
export function normalizeSharedElementsConfig(sharedElementsConfig) {
if (!sharedElementsConfig || !sharedElementsConfig.length)
return null;
return sharedElementsConfig.map(normalizeSharedElementConfig);
}
export function getActiveRouteState(route) {
if (!route.routes ||
route.routes.length === 0 ||
route.index >= route.routes.length) {
return route;
}
else {
return getActiveRouteState(route.routes[route.index]);
}
}
//# sourceMappingURL=utils.js.map