Skip to content

Commit

Permalink
Merge branch 'master' into aws-m2-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
igorgn authored May 1, 2024
2 parents 13fd612 + 44b3442 commit 67ab81e
Show file tree
Hide file tree
Showing 25 changed files with 190 additions and 163 deletions.
61 changes: 0 additions & 61 deletions .buildkite/pipeline.yml

This file was deleted.

10 changes: 8 additions & 2 deletions ReactNativeNavigation.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,25 @@ Pod::Spec.new do |s|

s.module_name = 'ReactNativeNavigation'
s.default_subspec = 'Core'

s.subspec 'Core' do |ss|
s.source = { :git => "https://github.com/wix/react-native-navigation.git", :tag => "#{s.version}" }
s.source_files = 'lib/ios/**/*.{h,m,mm,cpp}'
s.exclude_files = "lib/ios/ReactNativeNavigationTests/**/*.*", "lib/ios/OCMock/**/*.*"
end

if fabric_enabled
install_modules_dependencies(s)

folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
fabric_flags = fabric_enabled ? '-DRCT_NEW_ARCH_ENABLED' : ''

s.pod_target_xcconfig = {
'HEADER_SEARCH_PATHS' => '"$(PODS_ROOT)/boost" "$(PODS_ROOT)/boost-for-react-native" "$(PODS_ROOT)/RCT-Folly" "$(PODS_ROOT)/Headers/Private/React-Core"',
'HEADER_SEARCH_PATHS' => '"$(PODS_ROOT)/boost" "$(PODS_ROOT)/boost-for-react-native" "$(PODS_ROOT)/RCT-Folly" "$(PODS_ROOT)/Headers/Private/React-Core" "$(PODS_ROOT)/Headers/Private/Yoga"',
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
}

s.compiler_flags = folly_compiler_flags + ' ' + '-DRCT_NEW_ARCH_ENABLED'
s.requires_arc = true

Expand All @@ -45,6 +50,7 @@ Pod::Spec.new do |s|
s.dependency "React-runtimeexecutor"
s.dependency "React-rncore"
end

s.dependency 'React-Core'
s.dependency 'React-CoreModules'
s.dependency 'React-RCTImage'
Expand Down
15 changes: 12 additions & 3 deletions lib/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def kotlinStdlib = safeExtGet('RNNKotlinStdlib',DEFAULT_KOTLIN_STDLIB )
def kotlinCoroutinesCore = safeExtGet('RNNKotlinCoroutinesCore', '1.5.2')
android {
compileSdkVersion safeExtGetFallbackLowerBound('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
buildToolsVersion = "33.0.0"
buildToolsVersion = "34.0.0"
defaultConfig {
minSdkVersion safeExtGetFallbackLowerBound('minSdkVersion', DEFAULT_MIN_SDK_VERSION)
targetSdkVersion safeExtGetFallbackLowerBound('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
Expand Down Expand Up @@ -56,7 +56,7 @@ android {
def repeatLength = output.length()
println '\n\n' + ('-' * repeatLength) + '\n' + output + '\n' + ('-' * repeatLength) + '\n'

println "see report at file://${t.reports.html.destination}/index.html"
println "see report at file://${t.reports.html.outputLocation}/index.html"
}
}
}
Expand All @@ -66,7 +66,11 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
if (reactNativeMinorVersion() >= 73) {
jvmTarget = JavaVersion.VERSION_17
} else {
jvmTarget = JavaVersion.VERSION_11
}
}

flavorDimensions "RNN.reactNativeVersion"
Expand Down Expand Up @@ -122,6 +126,11 @@ android {
}
}

int reactNativeMinorVersion() {
List reactNativeVersionComponents = reactNativeVersionComponents(findReactNativePackageJson())
reactNativeVersionComponents[1].toInteger()
}

String resolveFlavor() {
List reactNativeVersionComponents = reactNativeVersionComponents(findReactNativePackageJson())
Integer reactNativeMinorComponent = reactNativeVersionComponents[1].toInteger()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ public void requestPermissions(String[] permissions, int requestCode, Permission

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
NavigationApplication.instance.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (mPermissionListener != null && mPermissionListener.onRequestPermissionsResult(requestCode, permissions, grantResults)) {
mPermissionListener = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ open class ButtonPresenter(private val context: Context, private val button: But

class WixAccessibilityDelegateCompat: AccessibilityDelegateCompat(){
override fun onInitializeAccessibilityNodeInfo(
host: View?,
info: AccessibilityNodeInfoCompat?
host: View,
info: AccessibilityNodeInfoCompat
) {
super.onInitializeAccessibilityNodeInfo(host, info)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

import static org.assertj.core.api.Java6Assertions.*;

import com.reactnativenavigation.R;

public class EnvironmentTest extends BaseTest {
@Test
public void assertJ() {
Expand All @@ -33,7 +35,7 @@ public void supportDesign() {

@Test
public void androidR() {
assertThat(R.string.bottom_sheet_behavior).isNotZero();
assertThat(com.google.android.material.R.string.bottom_sheet_behavior).isNotZero();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.util.Collections;
import java.util.List;


public class TestApplication extends Application implements ReactApplication {
private final ReactNativeHost host = new ReactNativeHost(this) {
@Override
Expand All @@ -25,7 +26,7 @@ protected List<ReactPackage> getPackages() {
@Override
public void onCreate() {
super.onCreate();
setTheme(R.style.Theme_AppCompat);
setTheme(androidx.appcompat.R.style.Theme_AppCompat);
}

@Override
Expand Down
14 changes: 14 additions & 0 deletions lib/ios/ElementAnimator.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
#import "ElementHorizontalTransition.h"
#import "ElementVerticalTransition.h"
#import "HorizontalTranslationTransition.h"
#import "HorizontalScaleTransition.h"
#import "RNNElementFinder.h"
#import "Transition.h"
#import "VerticalRotationTransition.h"
#import "VerticalTranslationTransition.h"
#import "VerticalScaleTransition.h"

@implementation ElementAnimator {
UIView *_containerView;
Expand Down Expand Up @@ -60,6 +62,18 @@ - (instancetype)initWithTransitionOptions:(TransitionOptions *)transitionOptions
transitionDetails:transitionOptions.rotationY]];
}

if (transitionOptions.scaleX.hasAnimation) {
[animations addObject:[[HorizontalScaleTransition alloc]
initWithView:self.view
transitionDetails:transitionOptions.scaleX]];
}

if (transitionOptions.scaleY.hasAnimation) {
[animations addObject:[[VerticalScaleTransition alloc]
initWithView:self.view
transitionDetails:transitionOptions.scaleY]];
}

return animations;
}

Expand Down
6 changes: 6 additions & 0 deletions lib/ios/HorizontalScaleTransition.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#import "FloatTransition.h"
#import <Foundation/Foundation.h>

@interface HorizontalScaleTransition : FloatTransition

@end
21 changes: 21 additions & 0 deletions lib/ios/HorizontalScaleTransition.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#import "HorizontalScaleTransition.h"

@implementation HorizontalScaleTransition

- (CATransform3D)animateWithProgress:(CGFloat)p {
CGFloat scaleX = [RNNInterpolator fromFloat:self.from
toFloat:self.to
precent:p
interpolator:self.interpolator];
return CATransform3DMakeScale(scaleX, 1, 1);
}

- (CGFloat)calculateFrom:(Double *)from {
return from.hasValue ? from.get : 1;
}

- (CGFloat)calculateTo:(Double *)to {
return to.hasValue ? to.get : 1;
}

@end
3 changes: 1 addition & 2 deletions lib/ios/RNNAppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
#import "RCTLegacyInteropComponents.h"
#import <React/CoreModulesPlugins.h>
#import <React/RCTCxxBridgeDelegate.h>
#import <React/RCTFabricSurfaceHostingProxyRootView.h>
#import <React/RCTLegacyViewManagerInteropComponentView.h>
#import <React/RCTRuntimeExecutorFromBridge.h>
#import <React/RCTSurfacePresenter.h>
#import <React/RCTSurfacePresenterStub.h>
#import <React/RCTSurfacePresenterBridgeAdapter.h>
#import <ReactCommon/RCTTurboModuleManager.h>
#import <react/config/ReactNativeConfig.h>
Expand Down
4 changes: 2 additions & 2 deletions lib/ios/RNNReactView.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifdef RCT_NEW_ARCH_ENABLED
#import <React/RCTFabricSurfaceHostingProxyRootView.h>
#import <React/RCTSurfaceHostingProxyRootView.h>
#else
#import <React/RCTRootView.h>
#endif
Expand Down Expand Up @@ -32,7 +32,7 @@ typedef void (^RNNReactViewReadyCompletionBlock)(void);

#ifdef RCT_NEW_ARCH_ENABLED
@interface RNNReactView
: RCTFabricSurfaceHostingProxyRootView <RCTRootViewDelegate, RNNComponentProtocol>
: RCTSurfaceHostingProxyRootView <RCTRootViewDelegate, RNNComponentProtocol>
#else
@interface RNNReactView : RCTRootView <RCTRootViewDelegate, RNNComponentProtocol>
#endif
Expand Down
11 changes: 7 additions & 4 deletions lib/ios/RNNReactView.m → lib/ios/RNNReactView.mm
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#import "RNNReactView.h"
#import <React/RCTRootContentView.h>

#ifdef RCT_NEW_ARCH_ENABLED
#import <React/RCTFabricSurface.h>
#endif

@implementation RNNReactView {
BOOL _isAppeared;
}
Expand All @@ -11,10 +15,9 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge
eventEmitter:(RNNEventEmitter *)eventEmitter
sizeMeasureMode:(RCTSurfaceSizeMeasureMode)sizeMeasureMode
reactViewReadyBlock:(RNNReactViewReadyCompletionBlock)reactViewReadyBlock {
self = [super initWithBridge:bridge
moduleName:moduleName
initialProperties:initialProperties
sizeMeasureMode:sizeMeasureMode];
RCTFabricSurface *surface = [[RCTFabricSurface alloc] initWithBridge:bridge moduleName:moduleName initialProperties:initialProperties];
self = [super initWithSurface:surface sizeMeasureMode:sizeMeasureMode];
[surface start];
#else
- (instancetype)initWithBridge:(RCTBridge *)bridge
moduleName:(NSString *)moduleName
Expand Down
14 changes: 14 additions & 0 deletions lib/ios/TransitionOptions.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ - (instancetype)initWithDict:(NSDictionary *)dict {
self.alpha = [[TransitionDetailsOptions alloc] initWithDict:dict[@"alpha"]];
self.x = [[TransitionDetailsOptions alloc] initWithDict:dict[@"x"]];
self.y = [[TransitionDetailsOptions alloc] initWithDict:dict[@"y"]];
self.scaleX = [[TransitionDetailsOptions alloc] initWithDict:dict[@"scaleX"]];
self.scaleY = [[TransitionDetailsOptions alloc] initWithDict:dict[@"scaleY"]];
self.translationX = [[TransitionDetailsOptions alloc] initWithDict:dict[@"translationX"]];
self.translationY = [[TransitionDetailsOptions alloc] initWithDict:dict[@"translationY"]];
self.rotationX = [[TransitionDetailsOptions alloc] initWithDict:dict[@"rotationX"]];
Expand All @@ -23,6 +25,8 @@ - (void)mergeOptions:(TransitionOptions *)options {
[self.alpha mergeOptions:options.alpha];
[self.x mergeOptions:options.x];
[self.y mergeOptions:options.y];
[self.scaleX mergeOptions:options.scaleX];
[self.scaleY mergeOptions:options.scaleY];
[self.translationX mergeOptions:options.translationX];
[self.translationY mergeOptions:options.translationY];
[self.rotationX mergeOptions:options.rotationX];
Expand All @@ -36,12 +40,14 @@ - (void)mergeOptions:(TransitionOptions *)options {

- (BOOL)hasAnimation {
return self.x.hasAnimation || self.y.hasAnimation || self.alpha.hasAnimation ||
self.scaleX.hasAnimation || self.scaleY.hasAnimation ||
self.translationX.hasAnimation || self.translationY.hasAnimation ||
self.rotationX.hasAnimation || self.rotationY.hasAnimation;
}

- (BOOL)hasValue {
return self.x.hasAnimation || self.y.hasAnimation || self.alpha.hasAnimation ||
self.scaleX.hasAnimation || self.scaleY.hasAnimation ||
self.translationX.hasAnimation || self.translationY.hasAnimation ||
self.rotationX.hasAnimation || self.rotationY.hasAnimation ||
self.waitForRender.hasValue || self.enable.hasValue;
Expand All @@ -61,6 +67,14 @@ - (NSTimeInterval)maxDuration {
maxDuration = [_y.duration withDefault:0];
}

if ([_scaleX.duration withDefault:0] > maxDuration) {
maxDuration = [_scaleX.duration withDefault:0];
}

if ([_scaleY.duration withDefault:0] > maxDuration) {
maxDuration = [_scaleY.duration withDefault:0];
}

if ([_translationX.duration withDefault:0] > maxDuration) {
maxDuration = [_translationX.duration withDefault:0];
}
Expand Down
6 changes: 6 additions & 0 deletions lib/ios/VerticalScaleTransition.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#import "FloatTransition.h"
#import <Foundation/Foundation.h>

@interface VerticalScaleTransition : FloatTransition

@end
21 changes: 21 additions & 0 deletions lib/ios/VerticalScaleTransition.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#import "VerticalScaleTransition.h"

@implementation VerticalScaleTransition

- (CATransform3D)animateWithProgress:(CGFloat)p {
CGFloat scaleY = [RNNInterpolator fromFloat:self.from
toFloat:self.to
precent:p
interpolator:self.interpolator];
return CATransform3DMakeScale(1, scaleY, 1);
}

- (CGFloat)calculateFrom:(Double *)from {
return from.hasValue ? from.get : 1;
}

- (CGFloat)calculateTo:(Double *)to {
return to.hasValue ? to.get : 1;
}

@end
4 changes: 4 additions & 0 deletions metro.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
const path = require('node:path');
const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');

const config = {
projectRoot: `${__dirname}`,
resolver: {
enableGlobalPackages: true,
},
watchFolders: [__dirname],
};

Expand Down
Loading

0 comments on commit 67ab81e

Please sign in to comment.