react-native-navigation的迁移库

Options.js 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. const { Navigation } = require('react-native-navigation');
  2. const Colors = require('./Colors');
  3. const { Dimensions, PixelRatio } = require('react-native');
  4. const height = PixelRatio.getPixelSizeForLayoutSize(Dimensions.get('window').height) * 0.7;
  5. const { useSlowOpenScreenAnimations } = require('../flags');
  6. const SHOW_DURATION = 230 * 8;
  7. const setDefaultOptions = () => Navigation.setDefaultOptions({
  8. layout: {
  9. componentBackgroundColor: Colors.background,
  10. orientation: ['portrait'],
  11. direction: 'locale'
  12. },
  13. bottomTabs: {
  14. titleDisplayMode: 'alwaysShow'
  15. },
  16. bottomTab: {
  17. selectedIconColor: Colors.primary,
  18. selectedTextColor: Colors.primary
  19. },
  20. animations: {
  21. ...useSlowOpenScreenAnimations ? slowOpenScreenAnimations : {}
  22. },
  23. modalPresentationStyle: 'fullScreen'
  24. });
  25. const slowOpenScreenAnimations = {
  26. showModal: {
  27. waitForRender: true,
  28. y: {
  29. from: height,
  30. to: 0,
  31. duration: SHOW_DURATION,
  32. interpolation: 'accelerateDecelerate'
  33. },
  34. alpha: {
  35. from: 0.7,
  36. to: 1,
  37. duration: SHOW_DURATION,
  38. interpolation: 'accelerate'
  39. }
  40. },
  41. push: {
  42. waitForRender: true,
  43. content: {
  44. alpha: {
  45. from: 0.6,
  46. to: 1,
  47. duration: SHOW_DURATION,
  48. },
  49. y: {
  50. from: height,
  51. to: 0,
  52. duration: SHOW_DURATION,
  53. }
  54. }
  55. }
  56. }
  57. module.exports = {
  58. setDefaultOptions
  59. }