Нет описания

MainComponentsRegistry.java 1.1KB

123456789101112131415161718192021222324252627282930313233343536
  1. package com.censusproject.newarchitecture.components;
  2. import com.facebook.jni.HybridData;
  3. import com.facebook.proguard.annotations.DoNotStrip;
  4. import com.facebook.react.fabric.ComponentFactory;
  5. import com.facebook.soloader.SoLoader;
  6. /**
  7. * Class responsible to load the custom Fabric Components. This class has native methods and needs a
  8. * corresponding C++ implementation/header file to work correctly (already placed inside the jni/
  9. * folder for you).
  10. *
  11. * <p>Please note that this class is used ONLY if you opt-in for the New Architecture (see the
  12. * `newArchEnabled` property). Is ignored otherwise.
  13. */
  14. @DoNotStrip
  15. public class MainComponentsRegistry {
  16. static {
  17. SoLoader.loadLibrary("fabricjni");
  18. }
  19. @DoNotStrip private final HybridData mHybridData;
  20. @DoNotStrip
  21. private native HybridData initHybrid(ComponentFactory componentFactory);
  22. @DoNotStrip
  23. private MainComponentsRegistry(ComponentFactory componentFactory) {
  24. mHybridData = initHybrid(componentFactory);
  25. }
  26. @DoNotStrip
  27. public static MainComponentsRegistry register(ComponentFactory componentFactory) {
  28. return new MainComponentsRegistry(componentFactory);
  29. }
  30. }