Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .buildkite/jobs/pipeline.android_rn_77.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
- label: ":android: Android (RN 0.77.3)"
env:
JAVA_HOME: /opt/openjdk/jdk-17.0.9.jdk/Contents/Home/
REACT_NATIVE_VERSION: 0.77.3
command:
- "nvm install"
- "./scripts/ci.android.sh"
key: "android_rn_77"
timeout_in_minutes: 90
artifact_paths: "/Users/builder/uibuilder/work/artifacts/**/*"


12 changes: 12 additions & 0 deletions .buildkite/jobs/pipeline.android_rn_78.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
- label: ":android: Android (RN 0.78.3)"
env:
JAVA_HOME: /opt/openjdk/jdk-17.0.9.jdk/Contents/Home/
REACT_NATIVE_VERSION: 0.78.3
command:
- "nvm install"
- "./scripts/ci.android.sh"
key: "android"
timeout_in_minutes: 90
artifact_paths: "/Users/builder/uibuilder/work/artifacts/**/*"


11 changes: 11 additions & 0 deletions .buildkite/jobs/pipeline.ios_rn_77.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- label: ":ios: iOS (RN 0.77.3)"
env:
REACT_NATIVE_VERSION: 0.77.3
command:
- "nvm install"
- "./scripts/ci.ios.sh"
key: "ios_rn_77"
timeout_in_minutes: 90
artifact_paths: "/Users/builder/uibuilder/work/artifacts/**/*"


11 changes: 11 additions & 0 deletions .buildkite/jobs/pipeline.ios_rn_78.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- label: ":ios: iOS (RN 0.78.3)"
env:
REACT_NATIVE_VERSION: 0.78.3
command:
- "nvm install"
- "./scripts/ci.ios.sh"
key: "ios"
timeout_in_minutes: 90
artifact_paths: "/Users/builder/uibuilder/work/artifacts/**/*"


15 changes: 15 additions & 0 deletions .buildkite/jobs/pipeline.publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
- wait
- label: ":package: Publish"
env:
JAVA_HOME: /opt/openjdk/jdk-17.0.9.jdk/Contents/Home/
if: "build.pull_request.id == null"
command:
- "nvm install"
- "npm install"
- "npm run release"
depends_on:
- ios
- android
timeout_in_minutes: 90


20 changes: 20 additions & 0 deletions .buildkite/jobs/pipeline.release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
- block: ":rocket: Release!"
prompt: "Fill out the details for release"
if: 'build.message =~ /^release\$/i'
fields:
- text: "VERSION"
key: "version"
- text: "NPM_TAG"
key: "npm-tag"
default: 'null'
required: false
- text: "BUILD_DOCUMENTATION_VERSION"
key: "build-documentation-version"
default: 'null'
hint: 'Leave NULL if no version is specified'
- text: "REMOVE_DOCUMENTATION_VERSION"
key: "remove-documentation-version"
default: 'null'
hint: 'Leave NULL if no version is specified'


12 changes: 12 additions & 0 deletions .buildkite/pipeline.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash -e

echo "steps:"

cat .buildkite/jobs/pipeline.release.yml
cat .buildkite/jobs/pipeline.android_rn_77.yml
cat .buildkite/jobs/pipeline.android_rn_78.yml
cat .buildkite/jobs/pipeline.ios_rn_77.yml
cat .buildkite/jobs/pipeline.ios_rn_78.yml
cat .buildkite/jobs/pipeline.publish.yml


37 changes: 26 additions & 11 deletions integration/redux/Redux.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const React = require('react');
require('react-native');
const renderer = require('react-test-renderer');
const { render } = require('@testing-library/react-native');
const { Provider } = require('react-redux');
const { Navigation } = require('../../lib/src/index');

Expand Down Expand Up @@ -30,8 +30,8 @@ describe('redux support', () => {
store.reduxStore
);

const tree = renderer.create(<HOC />);
expect(tree.toJSON().children).toEqual(['no name']);
const { getByText } = render(<HOC />);
expect(getByText('no name')).toBeTruthy();
});

it('passes props into wrapped components', () => {
Expand All @@ -50,45 +50,60 @@ describe('redux support', () => {
<HOC {...props} />
))();

const tree = renderer.create(
const { getByText } = render(
<CompFromNavigation componentId="componentId" renderCountIncrement={renderCountIncrement} />
);
expect(tree.toJSON().children).toEqual(['no name']);
expect(getByText('no name')).toBeTruthy();
expect(renderCountIncrement).toHaveBeenCalledTimes(1);
});

it('rerenders as a result of an underlying state change (by selector)', () => {
const renderCountIncrement = jest.fn();
const tree = renderer.create(
const { getByText, rerender } = render(
<Provider store={store.reduxStore}>
<MyConnectedComponent renderCountIncrement={renderCountIncrement} />
</Provider>
);

expect(tree.toJSON().children).toEqual(['no name']);
expect(getByText('no name')).toBeTruthy();
expect(renderCountIncrement).toHaveBeenCalledTimes(1);

store.reduxStore.dispatch({ type: 'redux.MyStore.setName', name: 'Bob' });
expect(store.selectors.getName(store.reduxStore.getState())).toEqual('Bob');
expect(tree.toJSON().children).toEqual(['Bob']);

// Re-render to see the updated state
rerender(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revisit whether this is indeed necessary

<Provider store={store.reduxStore}>
<MyConnectedComponent renderCountIncrement={renderCountIncrement} />
</Provider>
);
expect(getByText('Bob')).toBeTruthy();

expect(renderCountIncrement).toHaveBeenCalledTimes(2);
});

it('rerenders as a result of an underlying state change with a new key', () => {
const renderCountIncrement = jest.fn();
const tree = renderer.create(
const { queryByText, rerender } = render(
<Provider store={store.reduxStore}>
<MyConnectedComponent printAge={true} renderCountIncrement={renderCountIncrement} />
</Provider>
);

expect(tree.toJSON().children).toEqual(null);
// Initially should show nothing (null children means no text)
expect(queryByText('30')).toBeNull();
expect(renderCountIncrement).toHaveBeenCalledTimes(1);

store.reduxStore.dispatch({ type: 'redux.MyStore.setAge', age: 30 });
expect(store.selectors.getAge(store.reduxStore.getState())).toEqual(30);
expect(tree.toJSON().children).toEqual(['30']);

// Re-render to see the updated state
rerender(
<Provider store={store.reduxStore}>
<MyConnectedComponent printAge={true} renderCountIncrement={renderCountIncrement} />
</Provider>
);
expect(queryByText('30')).toBeTruthy();

expect(renderCountIncrement).toHaveBeenCalledTimes(2);
});
Expand Down
28 changes: 18 additions & 10 deletions integration/remx/remx.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const React = require('react');
require('react-native');
const renderer = require('react-test-renderer');
const { render } = require('@testing-library/react-native');
const { Navigation } = require('../../lib/src/index');

describe('remx support', () => {
Expand All @@ -13,39 +13,47 @@ describe('remx support', () => {
});

it('renders normally', () => {
const tree = renderer.create(<MyConnectedComponent />);
const tree2 = renderer.create(<MyConnectedComponent />);
expect(tree.toJSON().children).toEqual(['no name']);
const { getByText } = render(<MyConnectedComponent />);
const { getByText: getByText2 } = render(<MyConnectedComponent />);
expect(getByText('no name')).toBeTruthy();
expect(getByText2('no name')).toBeTruthy();
});

it('rerenders as a result of an underlying state change (by selector)', () => {
const renderCountIncrement = jest.fn();
const tree = renderer.create(
const { getByText, rerender } = render(
<MyConnectedComponent renderCountIncrement={renderCountIncrement} />
);

expect(tree.toJSON().children).toEqual(['no name']);
expect(getByText('no name')).toBeTruthy();
expect(renderCountIncrement).toHaveBeenCalledTimes(1);

store.setters.setName('Bob');
expect(store.getters.getName()).toEqual('Bob');
expect(tree.toJSON().children).toEqual(['Bob']);

// Re-render to get updated content
rerender(<MyConnectedComponent renderCountIncrement={renderCountIncrement} />);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revisit whether actually necessary

expect(getByText('Bob')).toBeTruthy();

expect(renderCountIncrement).toHaveBeenCalledTimes(2);
});

it('rerenders as a result of an underlying state change with a new key', () => {
const renderCountIncrement = jest.fn();
const tree = renderer.create(
const { queryByText, rerender } = render(
<MyConnectedComponent printAge={true} renderCountIncrement={renderCountIncrement} />
);

expect(tree.toJSON().children).toEqual(null);
// Initially should show nothing (null children means no text)
expect(queryByText('30')).toBeNull();
expect(renderCountIncrement).toHaveBeenCalledTimes(1);

store.setters.setAge(30);
expect(store.getters.getAge()).toEqual(30);
expect(tree.toJSON().children).toEqual(['30']);

// Re-render to get updated content
rerender(<MyConnectedComponent printAge={true} renderCountIncrement={renderCountIncrement} />);
expect(queryByText('30')).toBeTruthy();

expect(renderCountIncrement).toHaveBeenCalledTimes(2);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ModalContentLayout(context: Context?) : ReactViewGroup(context), RootView{

private val mJSTouchDispatcher = JSTouchDispatcher(this)

override fun onChildStartedNativeGesture(child: View, androidEvent: MotionEvent) {
override fun onChildStartedNativeGesture(child: View?, androidEvent: MotionEvent) {
mJSTouchDispatcher.onChildStartedNativeGesture(androidEvent, this.getEventDispatcher())
}
override fun onChildStartedNativeGesture(androidEvent: MotionEvent) {
Expand All @@ -31,7 +31,7 @@ class ModalContentLayout(context: Context?) : ReactViewGroup(context), RootView{
return UIManagerHelper.getEventDispatcher(reactContext, UIManagerType.FABRIC) ?: throw IllegalStateException("EventDispatcher for Fabric UI Manager is not found")
}

override fun handleException(t: Throwable?) {
override fun handleException(t: Throwable) {
getReactContext().handleException(RuntimeException(t))
}

Expand Down
56 changes: 38 additions & 18 deletions lib/ios/RNNAppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,21 @@
#import <React/RCTSurfacePresenterStub.h>
#import <React/RCTSurfacePresenterBridgeAdapter.h>
#import <ReactCommon/RCTTurboModuleManager.h>



#if __has_include(<React-RCTAppDelegate/RCTReactNativeFactory.h>)
#import <React-RCTAppDelegate/RCTAppDelegate.h>
#import <React-RCTAppDelegate/RCTReactNativeFactory.h>
#elif __has_include(<React_RCTAppDelegate/RCTReactNativeFactory.h>)
#import <React_RCTAppDelegate/RCTAppDelegate.h>
#import <React_RCTAppDelegate/RCTReactNativeFactory.h>
#else
// RN 0.77 support
#define RN077
#import <react/config/ReactNativeConfig.h>
#endif

#import <react/renderer/runtimescheduler/RuntimeScheduler.h>
#import <react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.h>
#import <React/RCTSurfacePresenter.h>
Expand All @@ -37,15 +51,17 @@ @implementation RNNAppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

#ifdef RN077
[self _setUpFeatureFlags];

// Copied from RCTAppDelegate, it private inside it
self.rootViewFactory = [self createRCTRootViewFactory];

[RCTComponentViewFactory currentComponentViewFactory].thirdPartyFabricComponentsProvider = self;

RCTAppSetupPrepareApp(application, self.newArchEnabled);
RCTSetNewArchEnabled(TRUE);
#else
self.reactNativeFactory = [RCTReactNativeFactory new];
self.reactNativeFactory = [self.reactNativeFactory initWithDelegate:self];
#endif

RCTEnableTurboModuleInterop(YES);
RCTEnableTurboModuleInteropBridgeProxy(YES);

Expand All @@ -56,34 +72,37 @@ - (BOOL)application:(UIApplication *)application
return YES;
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
[NSException raise:@"RCTBridgeDelegate::sourceURLForBridge not implemented"
format:@"Subclasses must implement a valid sourceURLForBridge method"];
return nil;
}

- (BOOL)concurrentRootEnabled {
return true;
}



#ifdef RN077
- (RCTRootViewFactory *)createRCTRootViewFactory
{
__weak __typeof(self) weakSelf = self;
RCTBundleURLBlock bundleUrlBlock = ^{
RCTAppDelegate *strongSelf = weakSelf;
return strongSelf.bundleURL;
RCTAppDelegate *strongSelf = weakSelf;
return strongSelf.bundleURL;
};

RCTRootViewFactoryConfiguration *configuration =
[[RCTRootViewFactoryConfiguration alloc] initWithBundleURLBlock:bundleUrlBlock
newArchEnabled:self.newArchEnabled];
[[RCTRootViewFactoryConfiguration alloc] initWithBundleURLBlock:bundleUrlBlock
newArchEnabled:self.newArchEnabled];


return [[RCTRootViewFactory alloc] initWithConfiguration:configuration andTurboModuleManagerDelegate:self];
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
[NSException raise:@"RCTBridgeDelegate::sourceURLForBridge not implemented"
format:@"Subclasses must implement a valid sourceURLForBridge method"];
return nil;
}

- (BOOL)concurrentRootEnabled {
return true;
}

#pragma mark - Feature Flags

class RCTAppDelegateBridgelessFeatureFlags : public facebook::react::ReactNativeFeatureFlagsDefaults {
public:
bool enableBridgelessArchitecture() override
Expand Down Expand Up @@ -113,6 +132,7 @@ - (void)_setUpFeatureFlags
facebook::react::ReactNativeFeatureFlags::override(
std::make_unique<RCTAppDelegateBridgelessFeatureFlags>());
}
#endif

@end

Loading