Skip to content

Commit 52a36fa

Browse files
React Native 0.78 support (#8120)
* Added missing feature flags * Fixes for rn 78 * Fixed unit tests * Fixed unit tests * Fixed unit tests * Initial comit for RN078 iOS * Implemented dynamic pipelines (#8124) * Implemented dynamic pipelines * Implemented dynamic pipelines for rn 77 and 78 * Downgraded reanimated to support both 77 and 78 * Fixed BW for rn77 * RN 77 Fixes * RN 77 Fixes * RN 77 Fixes * Fixes after pr * Fixes after pr * Fixed docs --------- Co-authored-by: Mark de Vocht <[email protected]>
1 parent 9fc2dae commit 52a36fa

File tree

21 files changed

+810
-566
lines changed

21 files changed

+810
-566
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
- label: ":android: Android (RN 0.77.3)"
2+
env:
3+
JAVA_HOME: /opt/openjdk/jdk-17.0.9.jdk/Contents/Home/
4+
REACT_NATIVE_VERSION: 0.77.3
5+
command:
6+
- "nvm install"
7+
- "./scripts/ci.android.sh"
8+
key: "android_rn_77"
9+
timeout_in_minutes: 90
10+
artifact_paths: "/Users/builder/uibuilder/work/artifacts/**/*"
11+
12+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
- label: ":android: Android (RN 0.78.3)"
2+
env:
3+
JAVA_HOME: /opt/openjdk/jdk-17.0.9.jdk/Contents/Home/
4+
REACT_NATIVE_VERSION: 0.78.3
5+
command:
6+
- "nvm install"
7+
- "./scripts/ci.android.sh"
8+
key: "android"
9+
timeout_in_minutes: 90
10+
artifact_paths: "/Users/builder/uibuilder/work/artifacts/**/*"
11+
12+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
- label: ":ios: iOS (RN 0.77.3)"
2+
env:
3+
REACT_NATIVE_VERSION: 0.77.3
4+
command:
5+
- "nvm install"
6+
- "./scripts/ci.ios.sh"
7+
key: "ios_rn_77"
8+
timeout_in_minutes: 90
9+
artifact_paths: "/Users/builder/uibuilder/work/artifacts/**/*"
10+
11+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
- label: ":ios: iOS (RN 0.78.3)"
2+
env:
3+
REACT_NATIVE_VERSION: 0.78.3
4+
command:
5+
- "nvm install"
6+
- "./scripts/ci.ios.sh"
7+
key: "ios"
8+
timeout_in_minutes: 90
9+
artifact_paths: "/Users/builder/uibuilder/work/artifacts/**/*"
10+
11+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
- wait
2+
- label: ":package: Publish"
3+
env:
4+
JAVA_HOME: /opt/openjdk/jdk-17.0.9.jdk/Contents/Home/
5+
if: "build.pull_request.id == null"
6+
command:
7+
- "nvm install"
8+
- "npm install"
9+
- "npm run release"
10+
depends_on:
11+
- ios
12+
- android
13+
timeout_in_minutes: 90
14+
15+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
- block: ":rocket: Release!"
2+
prompt: "Fill out the details for release"
3+
if: 'build.message =~ /^release\$/i'
4+
fields:
5+
- text: "VERSION"
6+
key: "version"
7+
- text: "NPM_TAG"
8+
key: "npm-tag"
9+
default: 'null'
10+
required: false
11+
- text: "BUILD_DOCUMENTATION_VERSION"
12+
key: "build-documentation-version"
13+
default: 'null'
14+
hint: 'Leave NULL if no version is specified'
15+
- text: "REMOVE_DOCUMENTATION_VERSION"
16+
key: "remove-documentation-version"
17+
default: 'null'
18+
hint: 'Leave NULL if no version is specified'
19+
20+

.buildkite/pipeline.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash -e
2+
3+
echo "steps:"
4+
5+
cat .buildkite/jobs/pipeline.release.yml
6+
cat .buildkite/jobs/pipeline.android_rn_77.yml
7+
cat .buildkite/jobs/pipeline.android_rn_78.yml
8+
cat .buildkite/jobs/pipeline.ios_rn_77.yml
9+
cat .buildkite/jobs/pipeline.ios_rn_78.yml
10+
cat .buildkite/jobs/pipeline.publish.yml
11+
12+

integration/redux/Redux.test.js

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const React = require('react');
22
require('react-native');
3-
const renderer = require('react-test-renderer');
3+
const { render, act } = require('@testing-library/react-native');
44
const { Provider } = require('react-redux');
55
const { Navigation } = require('../../lib/src/index');
66

@@ -30,8 +30,8 @@ describe('redux support', () => {
3030
store.reduxStore
3131
);
3232

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

3737
it('passes props into wrapped components', () => {
@@ -50,46 +50,49 @@ describe('redux support', () => {
5050
<HOC {...props} />
5151
))();
5252

53-
const tree = renderer.create(
53+
const { getByText } = render(
5454
<CompFromNavigation componentId="componentId" renderCountIncrement={renderCountIncrement} />
5555
);
56-
expect(tree.toJSON().children).toEqual(['no name']);
56+
expect(getByText('no name')).toBeTruthy();
5757
expect(renderCountIncrement).toHaveBeenCalledTimes(1);
5858
});
5959

6060
it('rerenders as a result of an underlying state change (by selector)', () => {
6161
const renderCountIncrement = jest.fn();
62-
const tree = renderer.create(
62+
const { getByText, rerender } = render(
6363
<Provider store={store.reduxStore}>
6464
<MyConnectedComponent renderCountIncrement={renderCountIncrement} />
6565
</Provider>
6666
);
6767

68-
expect(tree.toJSON().children).toEqual(['no name']);
68+
expect(getByText('no name')).toBeTruthy();
6969
expect(renderCountIncrement).toHaveBeenCalledTimes(1);
7070

71-
store.reduxStore.dispatch({ type: 'redux.MyStore.setName', name: 'Bob' });
71+
act(() => {
72+
store.reduxStore.dispatch({ type: 'redux.MyStore.setName', name: 'Bob' });
73+
});
7274
expect(store.selectors.getName(store.reduxStore.getState())).toEqual('Bob');
73-
expect(tree.toJSON().children).toEqual(['Bob']);
74-
75+
expect(getByText('Bob')).toBeTruthy();
7576
expect(renderCountIncrement).toHaveBeenCalledTimes(2);
7677
});
7778

7879
it('rerenders as a result of an underlying state change with a new key', () => {
7980
const renderCountIncrement = jest.fn();
80-
const tree = renderer.create(
81+
const { queryByText, rerender } = render(
8182
<Provider store={store.reduxStore}>
8283
<MyConnectedComponent printAge={true} renderCountIncrement={renderCountIncrement} />
8384
</Provider>
8485
);
8586

86-
expect(tree.toJSON().children).toEqual(null);
87+
// Initially should show nothing (null children means no text)
88+
expect(queryByText('30')).toBeNull();
8789
expect(renderCountIncrement).toHaveBeenCalledTimes(1);
8890

89-
store.reduxStore.dispatch({ type: 'redux.MyStore.setAge', age: 30 });
91+
act(() => {
92+
store.reduxStore.dispatch({ type: 'redux.MyStore.setAge', age: 30 });
93+
});
9094
expect(store.selectors.getAge(store.reduxStore.getState())).toEqual(30);
91-
expect(tree.toJSON().children).toEqual(['30']);
92-
95+
expect(queryByText('30')).toBeTruthy();
9396
expect(renderCountIncrement).toHaveBeenCalledTimes(2);
9497
});
9598
});

integration/remx/remx.test.js

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const React = require('react');
22
require('react-native');
3-
const renderer = require('react-test-renderer');
3+
const { render, act } = require('@testing-library/react-native');
44
const { Navigation } = require('../../lib/src/index');
55

66
describe('remx support', () => {
@@ -13,39 +13,45 @@ describe('remx support', () => {
1313
});
1414

1515
it('renders normally', () => {
16-
const tree = renderer.create(<MyConnectedComponent />);
17-
const tree2 = renderer.create(<MyConnectedComponent />);
18-
expect(tree.toJSON().children).toEqual(['no name']);
16+
const { getByText } = render(<MyConnectedComponent />);
17+
const { getByText: getByText2 } = render(<MyConnectedComponent />);
18+
expect(getByText('no name')).toBeTruthy();
19+
expect(getByText2('no name')).toBeTruthy();
1920
});
2021

2122
it('rerenders as a result of an underlying state change (by selector)', () => {
2223
const renderCountIncrement = jest.fn();
23-
const tree = renderer.create(
24+
const { getByText } = render(
2425
<MyConnectedComponent renderCountIncrement={renderCountIncrement} />
2526
);
2627

27-
expect(tree.toJSON().children).toEqual(['no name']);
28+
expect(getByText('no name')).toBeTruthy();
2829
expect(renderCountIncrement).toHaveBeenCalledTimes(1);
2930

30-
store.setters.setName('Bob');
31+
act(() => {
32+
store.setters.setName('Bob');
33+
});
3134
expect(store.getters.getName()).toEqual('Bob');
32-
expect(tree.toJSON().children).toEqual(['Bob']);
33-
35+
expect(getByText('Bob')).toBeTruthy();
3436
expect(renderCountIncrement).toHaveBeenCalledTimes(2);
3537
});
3638

3739
it('rerenders as a result of an underlying state change with a new key', () => {
3840
const renderCountIncrement = jest.fn();
39-
const tree = renderer.create(
41+
const { queryByText } = render(
4042
<MyConnectedComponent printAge={true} renderCountIncrement={renderCountIncrement} />
4143
);
4244

43-
expect(tree.toJSON().children).toEqual(null);
45+
// Initially should show nothing (null children means no text)
46+
expect(queryByText('30')).toBeNull();
4447
expect(renderCountIncrement).toHaveBeenCalledTimes(1);
4548

46-
store.setters.setAge(30);
49+
act(() => {
50+
store.setters.setAge(30);
51+
});
4752
expect(store.getters.getAge()).toEqual(30);
48-
expect(tree.toJSON().children).toEqual(['30']);
53+
54+
expect(queryByText('30')).toBeTruthy();
4955

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

lib/android/app/src/main/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class ModalContentLayout(context: Context?) : ReactViewGroup(context), RootView{
1616

1717
private val mJSTouchDispatcher = JSTouchDispatcher(this)
1818

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

34-
override fun handleException(t: Throwable?) {
34+
override fun handleException(t: Throwable) {
3535
getReactContext().handleException(RuntimeException(t))
3636
}
3737

0 commit comments

Comments
 (0)