react-native-navigation的迁移库

ReactViewHacks.java 790B

123456789101112131415161718192021222324252627
  1. package com.reactnativenavigation.react;
  2. import com.facebook.react.ReactRootView;
  3. import com.reactnativenavigation.utils.ReflectionUtils;
  4. public class ReactViewHacks {
  5. public static void preventUnmountOnDetachedFromWindow(ReactRootView view) {
  6. ReflectionUtils.setField(view, "mAttachScheduled", true);
  7. }
  8. /**
  9. * Side effect: prevents JS components constructor from being called
  10. */
  11. public static void ensureUnmountOnDetachedFromWindow(ReactRootView view) {
  12. ReflectionUtils.setField(view, "mAttachScheduled", false);
  13. }
  14. /**
  15. * Side effect: ensures unmount will be called
  16. */
  17. public static void preventMountAfterReattachedToWindow(ReactRootView view) {
  18. ReflectionUtils.setField(view, "mAttachScheduled", false);
  19. }
  20. }