react-native-navigation的迁移库

Layouts.js 506B

1234567891011121314151617
  1. const isString = require('lodash/isString');
  2. const isArray = require('lodash/isArray');
  3. const stack = (rawChildren, id) => {
  4. const childrenArray = isArray(rawChildren) ? rawChildren : [rawChildren];
  5. const children = childrenArray.map(child => component(child));
  6. return { stack: { children, id } };
  7. }
  8. const component = (component, options, passProps) => {
  9. return isString(component) ? { component: { name: component, options, passProps } } : component;
  10. }
  11. module.exports = {
  12. stack,
  13. component
  14. }