react-native-navigation 7.35.1 → 7.36.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
4
+ ruby '>= 2.6.10'
5
+
6
+ gem 'cocoapods', '>= 1.11.3'
@@ -2,6 +2,8 @@ require 'json'
2
2
 
3
3
  package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4
4
 
5
+ fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
6
+
5
7
  Pod::Spec.new do |s|
6
8
  s.name = "ReactNativeNavigation"
7
9
  s.version = package['version']
@@ -17,19 +19,34 @@ Pod::Spec.new do |s|
17
19
 
18
20
  s.subspec 'Core' do |ss|
19
21
  s.source = { :git => "https://github.com/wix/react-native-navigation.git", :tag => "#{s.version}" }
20
- s.source_files = "lib/ios/**/*.{h,m,mm}"
22
+ s.source_files = 'lib/ios/**/*.{h,m,mm,cpp}'
21
23
  s.exclude_files = "lib/ios/ReactNativeNavigationTests/**/*.*", "lib/ios/OCMock/**/*.*"
22
24
  end
23
-
24
- # s.subspec 'Fabric' do |ss|
25
- # ss.xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/RCT-Folly\"",
26
- # "OTHER_CFLAGS" => "$(inherited) -DRN_FABRIC_ENABLED -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1" }
27
- # ss.dependency 'React-RCTFabric'
28
- # ss.dependency 'React-Fabric'
29
- # ss.dependency 'RCT-Folly/Fabric'
30
- # end
31
25
 
26
+ if fabric_enabled
27
+ folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
28
+ fabric_flags = fabric_enabled ? '-DRCT_NEW_ARCH_ENABLED' : ''
29
+ s.pod_target_xcconfig = {
30
+ 'HEADER_SEARCH_PATHS' => '"$(PODS_ROOT)/boost" "$(PODS_ROOT)/boost-for-react-native" "$(PODS_ROOT)/RCT-Folly" "$(PODS_ROOT)/Headers/Private/React-Core"',
31
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
32
+ }
33
+ s.compiler_flags = folly_compiler_flags + ' ' + '-DRCT_NEW_ARCH_ENABLED'
34
+ s.requires_arc = true
35
+
36
+ s.dependency "React"
37
+ s.dependency "React-RCTFabric"
38
+ s.dependency "React-cxxreact"
39
+ s.dependency "React-Fabric"
40
+ s.dependency "React-Codegen"
41
+ s.dependency "RCT-Folly"
42
+ s.dependency "RCTRequired"
43
+ s.dependency "RCTTypeSafety"
44
+ s.dependency "ReactCommon/turbomodule/core"
45
+ s.dependency "React-runtimeexecutor"
46
+ s.dependency "React-rncore"
47
+ end
32
48
  s.dependency 'React-Core'
49
+ s.dependency 'React-CoreModules'
33
50
  s.dependency 'React-RCTImage'
34
51
  s.dependency 'React-RCTText'
35
52
  s.dependency 'HMSegmentedControl'
@@ -43,9 +43,6 @@ android {
43
43
  unitTests.includeAndroidResources = true
44
44
  unitTests.all { t ->
45
45
  maxHeapSize = "4g"
46
- reports {
47
- html.enabled true
48
- }
49
46
  testLogging {
50
47
  events "PASSED", "SKIPPED", "FAILED"
51
48
  exceptionFormat TestExceptionFormat.FULL
@@ -8,6 +8,7 @@ import android.view.MotionEvent;
8
8
  import com.facebook.react.ReactInstanceManager;
9
9
  import com.facebook.react.ReactRootView;
10
10
  import com.facebook.react.bridge.ReactContext;
11
+ import com.facebook.react.config.ReactFeatureFlags;
11
12
  import com.facebook.react.uimanager.JSTouchDispatcher;
12
13
  import com.facebook.react.uimanager.UIManagerModule;
13
14
  import com.facebook.react.uimanager.events.EventDispatcher;
@@ -34,6 +35,7 @@ public class ReactView extends ReactRootView implements IReactView, Renderable {
34
35
  this.componentId = componentId;
35
36
  this.componentName = componentName;
36
37
  jsTouchDispatcher = new JSTouchDispatcher(this);
38
+ setIsFabric(ReactFeatureFlags.enableFabricRenderer);
37
39
  }
38
40
 
39
41
  @Override
@@ -14,14 +14,9 @@ fun MotionEvent.coordinatesInsideView(view: View?): Boolean {
14
14
  view.getHitRect(hitRect)
15
15
  return hitRect.contains(x.toInt(), y.toInt())
16
16
  } else {
17
- val viewGroup = (view as? ViewGroup)?.getChildAt(0) as? ViewGroup ?: return false
17
+ val viewGroup = (view as? ViewGroup)?.getChildAt(0) as? ViewGroup ?: view
18
18
 
19
- return if (viewGroup.childCount > 0) {
20
- val content = viewGroup.getChildAt(0)
21
- content.getHitRect(hitRect)
22
- hitRect.contains(x.toInt(), y.toInt())
23
- } else {
24
- false
25
- }
19
+ viewGroup?.getHitRect(hitRect)
20
+ return hitRect.contains(x.toInt(), y.toInt())
26
21
  }
27
22
  }
@@ -6,13 +6,14 @@ import com.facebook.react.ReactInstanceManagerBuilder;
6
6
  import com.facebook.react.ReactNativeHost;
7
7
  import com.facebook.react.ReactPackage;
8
8
  import com.facebook.react.common.LifecycleState;
9
+ import com.facebook.react.defaults.DefaultReactNativeHost;
9
10
  import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener;
10
11
  import com.reactnativenavigation.NavigationApplication;
11
12
 
12
13
  import androidx.annotation.NonNull;
13
14
  import androidx.annotation.Nullable;
14
15
 
15
- public abstract class NavigationReactNativeHost extends ReactNativeHost implements BundleDownloadListenerProvider {
16
+ public abstract class NavigationReactNativeHost extends DefaultReactNativeHost implements BundleDownloadListenerProvider {
16
17
 
17
18
  private @Nullable NavigationDevBundleDownloadListener bundleListener;
18
19
  private final DevBundleDownloadListener bundleListenerMediator = new DevBundleDownloadListenerAdapter() {
@@ -33,30 +34,6 @@ public abstract class NavigationReactNativeHost extends ReactNativeHost implemen
33
34
  bundleListener = listener;
34
35
  }
35
36
 
36
- protected ReactInstanceManager createReactInstanceManager() {
37
- ReactInstanceManagerBuilder builder = ReactInstanceManager.builder()
38
- .setApplication(getApplication())
39
- .setJSMainModulePath(getJSMainModuleName())
40
- .setUseDeveloperSupport(getUseDeveloperSupport())
41
- .setRedBoxHandler(getRedBoxHandler())
42
- .setJavaScriptExecutorFactory(getJavaScriptExecutorFactory())
43
- .setInitialLifecycleState(LifecycleState.BEFORE_CREATE)
44
- .setJSIModulesPackage(getJSIModulePackage())
45
- .setDevBundleDownloadListener(getDevBundleDownloadListener());
46
-
47
- for (ReactPackage reactPackage : getPackages()) {
48
- builder.addPackage(reactPackage);
49
- }
50
-
51
- String jsBundleFile = getJSBundleFile();
52
- if (jsBundleFile != null) {
53
- builder.setJSBundleFile(jsBundleFile);
54
- } else {
55
- builder.setBundleAssetName(Assertions.assertNotNull(getBundleAssetName()));
56
- }
57
- return builder.build();
58
- }
59
-
60
37
  @SuppressWarnings("WeakerAccess")
61
38
  @NonNull
62
39
  protected DevBundleDownloadListener getDevBundleDownloadListener() {
@@ -5,8 +5,6 @@ const react_native_1 = require("react-native");
5
5
  class NativeEventsReceiver {
6
6
  emitter;
7
7
  constructor() {
8
- // NOTE: This try catch is workaround for integration tests
9
- // TODO: mock NativeEventEmitter in integration tests rather done adding try catch in source code
10
8
  try {
11
9
  this.emitter = new react_native_1.NativeEventEmitter(react_native_1.NativeModules.RNNEventEmitter);
12
10
  }
@@ -0,0 +1,20 @@
1
+ #import <Foundation/Foundation.h>
2
+ #import <React/RCTBridge.h>
3
+ #import <React/RCTBridgeDelegate.h>
4
+
5
+ @class RCTSurfacePresenterBridgeAdapter;
6
+ @class RCTTurboModuleManager;
7
+
8
+ @interface RNNAppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate>
9
+
10
+ @property(nonatomic, strong) UIWindow *window;
11
+
12
+ #if RCT_NEW_ARCH_ENABLED
13
+
14
+ /// The TurboModule manager
15
+ @property(nonatomic, strong) RCTTurboModuleManager *turboModuleManager;
16
+ @property(nonatomic, strong) RCTSurfacePresenterBridgeAdapter *bridgeAdapter;
17
+
18
+ #endif
19
+
20
+ @end
@@ -0,0 +1,135 @@
1
+ #import "RNNAppDelegate.h"
2
+ #import <ReactNativeNavigation/ReactNativeNavigation.h>
3
+
4
+ #if RCT_NEW_ARCH_ENABLED
5
+ #import "RCTAppSetupUtils.h"
6
+ #import "RCTLegacyInteropComponents.h"
7
+ #import <React/CoreModulesPlugins.h>
8
+ #import <React/RCTCxxBridgeDelegate.h>
9
+ #import <React/RCTFabricSurfaceHostingProxyRootView.h>
10
+ #import <React/RCTLegacyViewManagerInteropComponentView.h>
11
+ #import <React/RCTRuntimeExecutorFromBridge.h>
12
+ #import <React/RCTSurfacePresenter.h>
13
+ #import <React/RCTSurfacePresenterBridgeAdapter.h>
14
+ #import <ReactCommon/RCTTurboModuleManager.h>
15
+ #import <react/config/ReactNativeConfig.h>
16
+ #import <react/renderer/runtimescheduler/RuntimeScheduler.h>
17
+ #import <react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.h>
18
+
19
+ static NSString *const kRNConcurrentRoot = @"concurrentRoot";
20
+
21
+ @interface RNNAppDelegate () <RCTTurboModuleManagerDelegate, RCTCxxBridgeDelegate> {
22
+ std::shared_ptr<const facebook::react::ReactNativeConfig> _reactNativeConfig;
23
+ facebook::react::ContextContainer::Shared _contextContainer;
24
+ std::shared_ptr<facebook::react::RuntimeScheduler> _runtimeScheduler;
25
+ }
26
+ @end
27
+
28
+ #endif
29
+
30
+ @implementation RNNAppDelegate
31
+
32
+ #if RCT_NEW_ARCH_ENABLED
33
+ - (instancetype)init {
34
+ if (self = [super init]) {
35
+ _contextContainer = std::make_shared<facebook::react::ContextContainer const>();
36
+ _reactNativeConfig = std::make_shared<facebook::react::EmptyReactNativeConfig const>();
37
+ _contextContainer->insert("ReactNativeConfig", _reactNativeConfig);
38
+ }
39
+ return self;
40
+ }
41
+ #endif
42
+
43
+ - (BOOL)application:(UIApplication *)application
44
+ didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
45
+ #if RCT_NEW_ARCH_ENABLED
46
+ RCTEnableTurboModule(true);
47
+ #endif
48
+ RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
49
+ #if RCT_NEW_ARCH_ENABLED
50
+ self.bridgeAdapter =
51
+ [[RCTSurfacePresenterBridgeAdapter alloc] initWithBridge:bridge
52
+ contextContainer:_contextContainer];
53
+ bridge.surfacePresenter = self.bridgeAdapter.surfacePresenter;
54
+
55
+ [self unstable_registerLegacyComponents];
56
+ #endif
57
+
58
+ [ReactNativeNavigation bootstrapWithBridge:bridge];
59
+
60
+ return YES;
61
+ }
62
+
63
+ - (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge {
64
+ return [ReactNativeNavigation extraModulesForBridge:bridge];
65
+ }
66
+
67
+ #if RCT_NEW_ARCH_ENABLED
68
+ #pragma mark - RCTCxxBridgeDelegate
69
+ - (std::unique_ptr<facebook::react::JSExecutorFactory>)jsExecutorFactoryForBridge:
70
+ (RCTBridge *)bridge {
71
+ _runtimeScheduler = _runtimeScheduler =
72
+ std::make_shared<facebook::react::RuntimeScheduler>(RCTRuntimeExecutorFromBridge(bridge));
73
+ std::shared_ptr<facebook::react::CallInvoker> callInvoker =
74
+ std::make_shared<facebook::react::RuntimeSchedulerCallInvoker>(_runtimeScheduler);
75
+ self.turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge
76
+ delegate:self
77
+ jsInvoker:callInvoker];
78
+ _contextContainer->erase("RuntimeScheduler");
79
+ _contextContainer->insert("RuntimeScheduler", _runtimeScheduler);
80
+ return RCTAppSetupDefaultJsExecutorFactory(bridge, _turboModuleManager, _runtimeScheduler);
81
+ }
82
+
83
+ #pragma mark RCTTurboModuleManagerDelegate
84
+
85
+ - (Class)getModuleClassFromName:(const char *)name {
86
+ return RCTCoreModulesClassProvider(name);
87
+ }
88
+
89
+ - (std::shared_ptr<facebook::react::TurboModule>)
90
+ getTurboModule:(const std::string &)name
91
+ jsInvoker:(std::shared_ptr<facebook::react::CallInvoker>)jsInvoker {
92
+ return nullptr;
93
+ }
94
+
95
+ - (std::shared_ptr<facebook::react::TurboModule>)
96
+ getTurboModule:(const std::string &)name
97
+ initParams:(const facebook::react::ObjCTurboModule::InitParams &)params {
98
+ return nullptr;
99
+ }
100
+
101
+ - (id<RCTTurboModule>)getModuleInstanceFromClass:(Class)moduleClass {
102
+ return RCTAppSetupDefaultModuleFromClass(moduleClass);
103
+ }
104
+
105
+ #pragma mark - New Arch Enabled settings
106
+
107
+ - (BOOL)turboModuleEnabled {
108
+ return YES;
109
+ }
110
+
111
+ - (BOOL)fabricEnabled {
112
+ return YES;
113
+ }
114
+
115
+ #pragma mark - New Arch Utilities
116
+
117
+ - (void)unstable_registerLegacyComponents {
118
+ for (NSString *legacyComponent in [RCTLegacyInteropComponents legacyInteropComponents]) {
119
+ [RCTLegacyViewManagerInteropComponentView supportLegacyViewManagerWithName:legacyComponent];
120
+ }
121
+ }
122
+
123
+ #endif
124
+
125
+ - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
126
+ [NSException raise:@"RCTBridgeDelegate::sourceURLForBridge not implemented"
127
+ format:@"Subclasses must implement a valid sourceURLForBridge method"];
128
+ return nil;
129
+ }
130
+
131
+ - (BOOL)concurrentRootEnabled {
132
+ return true;
133
+ }
134
+
135
+ @end
@@ -2,19 +2,11 @@
2
2
 
3
3
  @implementation RNNComponentRootView
4
4
 
5
- - (instancetype)initWithBridge:(RCTBridge *)bridge
6
- moduleName:(NSString *)moduleName
7
- initialProperties:(NSDictionary *)initialProperties
8
- eventEmitter:(RNNEventEmitter *)eventEmitter
9
- reactViewReadyBlock:(RNNReactViewReadyCompletionBlock)reactViewReadyBlock {
10
- self = [super initWithBridge:bridge
11
- moduleName:moduleName
12
- initialProperties:initialProperties
13
- eventEmitter:eventEmitter
14
- reactViewReadyBlock:reactViewReadyBlock];
5
+ - (instancetype)init {
6
+ self = [super init];
7
+ self.sizeFlexibility = RCTRootViewSizeFlexibilityWidthAndHeight;
15
8
  return self;
16
9
  }
17
-
18
10
  - (NSString *)componentType {
19
11
  return ComponentTypeScreen;
20
12
  }
@@ -94,7 +94,8 @@
94
94
  }];
95
95
  }];
96
96
  self.reactView.backgroundColor = UIColor.clearColor;
97
- self.reactView.translatesAutoresizingMaskIntoConstraints = NO;
97
+ self.reactView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
98
+ [self.reactView setFrame:self.view.frame];
98
99
  [self.view addSubview:self.reactView];
99
100
  [self updateReactViewConstraints];
100
101
  } else {
@@ -114,24 +115,15 @@
114
115
  - (void)viewDidLayoutSubviews {
115
116
  [super viewDidLayoutSubviews];
116
117
  [self.presenter applyOptionsOnViewDidLayoutSubviews:self.resolveOptions];
118
+ [self updateReactViewConstraints];
117
119
  }
118
120
 
119
121
  - (void)updateReactViewConstraints {
120
122
  if (self.isViewLoaded && self.reactView) {
121
- [NSLayoutConstraint deactivateConstraints:_reactViewConstraints];
122
- _reactViewConstraints = @[
123
- [self.reactView.topAnchor
124
- constraintEqualToAnchor:self.shouldDrawBehindTopBar
125
- ? self.view.topAnchor
126
- : self.view.safeAreaLayoutGuide.topAnchor],
127
- [self.reactView.bottomAnchor
128
- constraintEqualToAnchor:self.shouldDrawBehindBottomTabs
129
- ? self.view.bottomAnchor
130
- : self.view.safeAreaLayoutGuide.bottomAnchor],
131
- [self.reactView.leftAnchor constraintEqualToAnchor:self.view.leftAnchor],
132
- [self.reactView.rightAnchor constraintEqualToAnchor:self.view.rightAnchor]
133
- ];
134
- [NSLayoutConstraint activateConstraints:_reactViewConstraints];
123
+ CGFloat bottomInset = self.shouldDrawBehindBottomTabs ? 0 : self.view.safeAreaInsets.bottom;
124
+ CGFloat topInset = self.shouldDrawBehindTopBar ? 0 : self.view.safeAreaInsets.top;
125
+ [self.reactView setFrame:CGRectMake(0, topInset, self.view.frame.size.width,
126
+ self.view.frame.size.height - topInset - bottomInset)];
135
127
  }
136
128
  }
137
129
 
@@ -9,7 +9,8 @@
9
9
 
10
10
  if ([hitTestResult isKindOfClass:[UIWindow class]] ||
11
11
  [hitTestResult.subviews.firstObject isKindOfClass:RNNReactView.class] ||
12
- [hitTestResult isKindOfClass:[RCTModalHostView class]]) {
12
+ [hitTestResult isKindOfClass:[RCTModalHostView class]] ||
13
+ [hitTestResult isKindOfClass:NSClassFromString(@"RCTRootComponentView")]) {
13
14
  return nil;
14
15
  }
15
16
 
@@ -1,6 +1,38 @@
1
1
  #import "RNNReactButtonView.h"
2
2
 
3
3
  @implementation RNNReactButtonView
4
+ #ifdef RCT_NEW_ARCH_ENABLED
5
+ - (instancetype)initWithBridge:(RCTBridge *)bridge
6
+ moduleName:(NSString *)moduleName
7
+ initialProperties:(NSDictionary *)initialProperties
8
+ eventEmitter:(RNNEventEmitter *)eventEmitter
9
+ sizeMeasureMode:(RCTSurfaceSizeMeasureMode)sizeMeasureMode
10
+ reactViewReadyBlock:(RNNReactViewReadyCompletionBlock)reactViewReadyBlock {
11
+ self = [super initWithBridge:bridge
12
+ moduleName:moduleName
13
+ initialProperties:initialProperties
14
+ eventEmitter:eventEmitter
15
+ sizeMeasureMode:RCTSurfaceSizeMeasureModeWidthUndefined |
16
+ RCTSurfaceSizeMeasureModeHeightUndefined
17
+ reactViewReadyBlock:reactViewReadyBlock];
18
+
19
+ return self;
20
+ }
21
+ #else
22
+ - (instancetype)initWithBridge:(RCTBridge *)bridge
23
+ moduleName:(NSString *)moduleName
24
+ initialProperties:(NSDictionary *)initialProperties
25
+ eventEmitter:(RNNEventEmitter *)eventEmitter
26
+ reactViewReadyBlock:(RNNReactViewReadyCompletionBlock)reactViewReadyBlock {
27
+ self = [super initWithBridge:bridge
28
+ moduleName:moduleName
29
+ initialProperties:initialProperties
30
+ eventEmitter:eventEmitter
31
+ reactViewReadyBlock:reactViewReadyBlock];
32
+
33
+ return self;
34
+ }
35
+ #endif
4
36
 
5
37
  - (NSString *)componentType {
6
38
  return ComponentTypeButton;
@@ -53,7 +53,7 @@
53
53
 
54
54
  - (NSMapTable *)componentsForParentId:(NSString *)parentComponentId {
55
55
  if (![_componentStore objectForKey:parentComponentId]) {
56
- [_componentStore setObject:[NSMapTable weakToStrongObjectsMapTable]
56
+ [_componentStore setObject:[NSMapTable strongToWeakObjectsMapTable]
57
57
  forKey:parentComponentId];
58
58
  ;
59
59
  }
@@ -64,7 +64,6 @@
64
64
 
65
65
  - (void)clearComponentsForParentId:(NSString *)parentComponentId {
66
66
  [_componentStore removeObjectForKey:parentComponentId];
67
- ;
68
67
  }
69
68
 
70
69
  - (void)removeComponent:(NSString *)componentId {
@@ -21,12 +21,23 @@
21
21
  ofType:(RNNComponentType)componentType
22
22
  reactViewReadyBlock:(RNNReactViewReadyCompletionBlock)reactViewReadyBlock {
23
23
  [self verifyRootViewId:rootViewId];
24
+ #ifdef RCT_NEW_ARCH_ENABLED
24
25
  return [[[self resolveComponentViewClass:componentType] alloc]
25
26
  initWithBridge:_bridge
26
27
  moduleName:name
27
28
  initialProperties:@{@"componentId" : rootViewId}
28
29
  eventEmitter:_eventEmitter
30
+ sizeMeasureMode:RCTSurfaceSizeMeasureModeWidthExact |
31
+ RCTSurfaceSizeMeasureModeHeightExact
29
32
  reactViewReadyBlock:reactViewReadyBlock];
33
+ #else
34
+ return [[[self resolveComponentViewClass:componentType] alloc]
35
+ initWithBridge:_bridge
36
+ moduleName:name
37
+ initialProperties:@{@"componentId" : rootViewId}
38
+ eventEmitter:_eventEmitter
39
+ reactViewReadyBlock:reactViewReadyBlock];
40
+ #endif
30
41
  }
31
42
 
32
43
  - (Class)resolveComponentViewClass:(RNNComponentType)componentType {
@@ -1,4 +1,4 @@
1
- #ifdef RN_FABRIC_ENABLED
1
+ #ifdef RCT_NEW_ARCH_ENABLED
2
2
  #import <React/RCTFabricSurfaceHostingProxyRootView.h>
3
3
  #else
4
4
  #import <React/RCTRootView.h>
@@ -30,18 +30,27 @@ typedef void (^RNNReactViewReadyCompletionBlock)(void);
30
30
 
31
31
  @end
32
32
 
33
- #ifdef RN_FABRIC_ENABLED
33
+ #ifdef RCT_NEW_ARCH_ENABLED
34
34
  @interface RNNReactView
35
35
  : RCTFabricSurfaceHostingProxyRootView <RCTRootViewDelegate, RNNComponentProtocol>
36
36
  #else
37
37
  @interface RNNReactView : RCTRootView <RCTRootViewDelegate, RNNComponentProtocol>
38
38
  #endif
39
39
 
40
+ #ifdef RCT_NEW_ARCH_ENABLED
40
41
  - (instancetype)initWithBridge:(RCTBridge *)bridge
41
42
  moduleName:(NSString *)moduleName
42
43
  initialProperties:(NSDictionary *)initialProperties
43
44
  eventEmitter:(RNNEventEmitter *)eventEmitter
45
+ sizeMeasureMode:(RCTSurfaceSizeMeasureMode)sizeMeasureMode
44
46
  reactViewReadyBlock:(RNNReactViewReadyCompletionBlock)reactViewReadyBlock;
47
+ #else
48
+ - (instancetype)initWithBridge:(RCTBridge *)bridge
49
+ moduleName:(NSString *)moduleName
50
+ initialProperties:(NSDictionary *)initialProperties
51
+ eventEmitter:(RNNEventEmitter *)eventEmitter
52
+ reactViewReadyBlock:(RNNReactViewReadyCompletionBlock)reactViewReadyBlock;
53
+ #endif
45
54
 
46
55
  @property(nonatomic, copy) RNNReactViewReadyCompletionBlock reactViewReadyBlock;
47
56
  @property(nonatomic, strong) RNNEventEmitter *eventEmitter;
@@ -4,13 +4,26 @@
4
4
  @implementation RNNReactView {
5
5
  BOOL _isAppeared;
6
6
  }
7
-
7
+ #ifdef RCT_NEW_ARCH_ENABLED
8
+ - (instancetype)initWithBridge:(RCTBridge *)bridge
9
+ moduleName:(NSString *)moduleName
10
+ initialProperties:(NSDictionary *)initialProperties
11
+ eventEmitter:(RNNEventEmitter *)eventEmitter
12
+ sizeMeasureMode:(RCTSurfaceSizeMeasureMode)sizeMeasureMode
13
+ reactViewReadyBlock:(RNNReactViewReadyCompletionBlock)reactViewReadyBlock {
14
+ self = [super initWithBridge:bridge
15
+ moduleName:moduleName
16
+ initialProperties:initialProperties
17
+ sizeMeasureMode:sizeMeasureMode];
18
+ #else
8
19
  - (instancetype)initWithBridge:(RCTBridge *)bridge
9
20
  moduleName:(NSString *)moduleName
10
21
  initialProperties:(NSDictionary *)initialProperties
11
22
  eventEmitter:(RNNEventEmitter *)eventEmitter
12
23
  reactViewReadyBlock:(RNNReactViewReadyCompletionBlock)reactViewReadyBlock {
13
24
  self = [super initWithBridge:bridge moduleName:moduleName initialProperties:initialProperties];
25
+ #endif
26
+
14
27
  [[NSNotificationCenter defaultCenter] addObserver:self
15
28
  selector:@selector(contentDidAppear:)
16
29
  name:RCTContentDidAppearNotification
@@ -34,17 +34,10 @@
34
34
 
35
35
  [self addChildViewController:self.child];
36
36
  [self.child.view setFrame:self.view.bounds];
37
+ self.child.view.autoresizingMask =
38
+ UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
37
39
  [self.view addSubview:self.child.view];
38
40
  [self.view bringSubviewToFront:self.child.view];
39
- self.child.view.translatesAutoresizingMaskIntoConstraints = NO;
40
-
41
- [NSLayoutConstraint activateConstraints:@[
42
- [self.child.view.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor],
43
- [self.child.view.trailingAnchor constraintEqualToAnchor:self.view.trailingAnchor],
44
- [self.child.view.topAnchor constraintEqualToAnchor:self.view.topAnchor],
45
- [self.child.view.bottomAnchor constraintEqualToAnchor:self.view.bottomAnchor]
46
- ]];
47
-
48
41
  [self.child didMoveToParentViewController:self];
49
42
  }
50
43
 
@@ -87,31 +87,13 @@
87
87
  buttonOptions:(RNNButtonOptions *)buttonOptions
88
88
  onPress:(RNNButtonPressCallback)onPress {
89
89
  self = [super initWithCustomView:reactView];
90
+ [reactView setFrame:CGRectMake(0, 0, 50, 50)];
90
91
  [self applyOptions:buttonOptions];
91
92
 
92
- reactView.sizeFlexibility = RCTRootViewSizeFlexibilityWidthAndHeight;
93
93
  reactView.delegate = self;
94
+
94
95
  reactView.backgroundColor = [UIColor clearColor];
95
- reactView.hidden = CGRectEqualToRect(reactView.frame, CGRectZero);
96
-
97
- [NSLayoutConstraint deactivateConstraints:reactView.constraints];
98
- self.widthConstraint =
99
- [NSLayoutConstraint constraintWithItem:reactView
100
- attribute:NSLayoutAttributeWidth
101
- relatedBy:NSLayoutRelationEqual
102
- toItem:nil
103
- attribute:NSLayoutAttributeNotAnAttribute
104
- multiplier:1.0
105
- constant:reactView.intrinsicContentSize.width];
106
- self.heightConstraint =
107
- [NSLayoutConstraint constraintWithItem:reactView
108
- attribute:NSLayoutAttributeHeight
109
- relatedBy:NSLayoutRelationEqual
110
- toItem:nil
111
- attribute:NSLayoutAttributeNotAnAttribute
112
- multiplier:1.0
113
- constant:reactView.intrinsicContentSize.height];
114
- [NSLayoutConstraint activateConstraints:@[ self.widthConstraint, self.heightConstraint ]];
96
+
115
97
  self.onPress = onPress;
116
98
  return self;
117
99
  }
@@ -255,6 +255,8 @@
255
255
  507ACB1223F44D1E00829911 /* RNNComponentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 507ACB1023F44D1E00829911 /* RNNComponentView.m */; };
256
256
  507ACB1523F44E5200829911 /* RNNComponentRootView.h in Headers */ = {isa = PBXBuildFile; fileRef = 507ACB1323F44E5200829911 /* RNNComponentRootView.h */; };
257
257
  507ACB1623F44E5200829911 /* RNNComponentRootView.m in Sources */ = {isa = PBXBuildFile; fileRef = 507ACB1423F44E5200829911 /* RNNComponentRootView.m */; };
258
+ 507DBBDB2A31DE8400F1FC74 /* RNNAppDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 507DBBD92A31DE8400F1FC74 /* RNNAppDelegate.h */; };
259
+ 507DBBDC2A31DE8400F1FC74 /* RNNAppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 507DBBDA2A31DE8400F1FC74 /* RNNAppDelegate.mm */; };
258
260
  507E7D57201DDD3000444E6C /* RNNSharedElementAnimationOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 507E7D55201DDD3000444E6C /* RNNSharedElementAnimationOptions.h */; };
259
261
  507E7D58201DDD3000444E6C /* RNNSharedElementAnimationOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 507E7D56201DDD3000444E6C /* RNNSharedElementAnimationOptions.m */; };
260
262
  507F43C51FF4F17C00D9425B /* RNNTopTabsViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 507F43C31FF4F17C00D9425B /* RNNTopTabsViewController.h */; };
@@ -792,6 +794,8 @@
792
794
  507ACB1023F44D1E00829911 /* RNNComponentView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNComponentView.m; sourceTree = "<group>"; };
793
795
  507ACB1323F44E5200829911 /* RNNComponentRootView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNComponentRootView.h; sourceTree = "<group>"; };
794
796
  507ACB1423F44E5200829911 /* RNNComponentRootView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNComponentRootView.m; sourceTree = "<group>"; };
797
+ 507DBBD92A31DE8400F1FC74 /* RNNAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNAppDelegate.h; sourceTree = "<group>"; };
798
+ 507DBBDA2A31DE8400F1FC74 /* RNNAppDelegate.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = RNNAppDelegate.mm; sourceTree = "<group>"; };
795
799
  507E7D55201DDD3000444E6C /* RNNSharedElementAnimationOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNSharedElementAnimationOptions.h; sourceTree = "<group>"; };
796
800
  507E7D56201DDD3000444E6C /* RNNSharedElementAnimationOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNSharedElementAnimationOptions.m; sourceTree = "<group>"; };
797
801
  507F43C31FF4F17C00D9425B /* RNNTopTabsViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNTopTabsViewController.h; sourceTree = "<group>"; };
@@ -1728,6 +1732,8 @@
1728
1732
  50588B8723AA87E3001F6A5E /* Animations */,
1729
1733
  7BA500731E2544B9001B9E1B /* ReactNativeNavigation.h */,
1730
1734
  7BA500741E2544B9001B9E1B /* ReactNativeNavigation.m */,
1735
+ 507DBBD92A31DE8400F1FC74 /* RNNAppDelegate.h */,
1736
+ 507DBBDA2A31DE8400F1FC74 /* RNNAppDelegate.mm */,
1731
1737
  5030B62023D5B4CA008F1642 /* Color+Interpolation.h */,
1732
1738
  5030B61F23D5B4CA008F1642 /* Color+Interpolation.m */,
1733
1739
  5030B62623D5B54D008F1642 /* LNInterpolable.h */,
@@ -2010,6 +2016,7 @@
2010
2016
  50395593217485B000B0A663 /* Double.h in Headers */,
2011
2017
  5050465421F8F4490035497A /* RNNReactComponentRegistry.h in Headers */,
2012
2018
  506BF65C2600AE4200A22755 /* CenterTransition.h in Headers */,
2019
+ 507DBBDB2A31DE8400F1FC74 /* RNNAppDelegate.h in Headers */,
2013
2020
  504AFE741FFFF0540076E904 /* RNNTopTabsOptions.h in Headers */,
2014
2021
  50E38DD723A7A2BE009817F6 /* AnimatedViewFactory.h in Headers */,
2015
2022
  E8E5182E1F83A48B000467AC /* RNNTransitionStateHolder.h in Headers */,
@@ -2354,6 +2361,7 @@
2354
2361
  50BCB29223F2C7CD00D6C8E5 /* AnchorTransition.m in Sources */,
2355
2362
  50344D2923A03DB4004B6A7C /* BottomTabsAttachMode.m in Sources */,
2356
2363
  501224072173592D000F5F98 /* RNNBottomTabsPresenter.m in Sources */,
2364
+ 507DBBDC2A31DE8400F1FC74 /* RNNAppDelegate.mm in Sources */,
2357
2365
  50A00C38200F84D6000F01A6 /* RNNOverlayOptions.m in Sources */,
2358
2366
  50A5628B23DDAB5A0027C219 /* ScreenAnimationController.m in Sources */,
2359
2367
  5039559C2174867000B0A663 /* DoubleParser.m in Sources */,
@@ -1,4 +1,4 @@
1
- import { NativeModules, NativeEventEmitter, EventEmitter, EmitterSubscription } from 'react-native';
1
+ import { NativeModules, NativeEventEmitter, EmitterSubscription } from 'react-native';
2
2
  import {
3
3
  ComponentWillAppearEvent,
4
4
  ComponentDidAppearEvent,
@@ -19,10 +19,8 @@ import {
19
19
  } from '../interfaces/Events';
20
20
 
21
21
  export class NativeEventsReceiver {
22
- private emitter: EventEmitter;
22
+ private emitter: NativeEventEmitter;
23
23
  constructor() {
24
- // NOTE: This try catch is workaround for integration tests
25
- // TODO: mock NativeEventEmitter in integration tests rather done adding try catch in source code
26
24
  try {
27
25
  this.emitter = new NativeEventEmitter(NativeModules.RNNEventEmitter);
28
26
  } catch (e) {
@@ -32,7 +30,7 @@ export class NativeEventsReceiver {
32
30
  remove: () => undefined,
33
31
  };
34
32
  },
35
- } as any) as EventEmitter;
33
+ } as any) as NativeEventEmitter;
36
34
  }
37
35
  }
38
36
 
package/metro.config.js CHANGED
@@ -1,4 +1,8 @@
1
- module.exports = {
1
+ const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
2
+
3
+ const config = {
2
4
  projectRoot: `${__dirname}`,
3
5
  watchFolders: [__dirname],
4
6
  };
7
+
8
+ module.exports = mergeConfig(getDefaultConfig(__dirname), config);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-navigation",
3
- "version": "7.35.1",
3
+ "version": "7.36.0-rc.1",
4
4
  "description": "React Native Navigation - truly native navigation for iOS and Android",
5
5
  "license": "MIT",
6
6
  "nativePackage": true,
@@ -33,7 +33,8 @@
33
33
  "start": "node ./scripts/start",
34
34
  "pretest-js": "npm run build",
35
35
  "test-js": "node ./scripts/test-js",
36
- "pod-install": "pod install --project-directory=playground/ios",
36
+ "pod-install-new-arch": "cd playground/ios && BUNDLE_GEMFILE=../../Gemfile BUNDLE_PATH=~/gems/ bundle install && RCT_NEW_ARCH_ENABLED=1 bundle exec pod install",
37
+ "pod-install": "cd playground/ios && pod install",
37
38
  "test-unit-ios": "node ./scripts/test-unit --ios",
38
39
  "test-snapshot-ios": "node ./scripts/test-snapshot --ios",
39
40
  "test-unit-android": "node ./scripts/test-unit --android",
@@ -71,7 +72,8 @@
71
72
  "@babel/plugin-proposal-export-default-from": "7.10.1",
72
73
  "@babel/plugin-proposal-export-namespace-from": "7.10.1",
73
74
  "@babel/runtime": "^7.20.0",
74
- "@babel/types": "7.15.6",
75
+ "@babel/types": "7.22.5",
76
+ "@react-native/metro-config": "^0.73.0",
75
77
  "@react-native-community/blur": "^3.6.0",
76
78
  "@react-native-community/datetimepicker": "^3.4.7",
77
79
  "@react-native-community/eslint-config": "2.0.0",
@@ -100,15 +102,15 @@
100
102
  "identity-obj-proxy": "3.0.0",
101
103
  "jest": "^27.5.1",
102
104
  "lint-staged": "10.2.11",
103
- "metro-react-native-babel-preset": "^0.70.3",
105
+ "metro-react-native-babel-preset": "^0.76.2",
104
106
  "pixelmatch": "^5.2.1",
105
107
  "pngjs": "^6.0.0",
106
108
  "prettier": "2.1.2",
107
109
  "react": "18.2.0",
108
- "react-native": "0.71.8",
110
+ "react-native": "0.72.3",
109
111
  "react-native-fast-image": "^8.6.3",
110
112
  "react-native-gesture-handler": "^2.10.1",
111
- "react-native-reanimated": "2.14.1",
113
+ "react-native-reanimated": "3.4.1",
112
114
  "react-native-ui-lib": "7.3.6",
113
115
  "react-redux": "5.x.x",
114
116
  "react-test-renderer": "18.2.0",