Skip to content

Commit c9d0b66

Browse files
author
stevegalili
committed
⏫ Upgrading to react-native 0.66.0 🔥 0️.6️6️.0️
1 parent f8cc16b commit c9d0b66

20 files changed

Lines changed: 110 additions & 131 deletions

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ DerivedData
2323

2424
# Android/IntelliJ
2525
#
26-
build/
2726
.idea
2827
.gradle
2928
local.properties
3029
*.iml
30+
*.hprof
3131

3232
# Visual Studio Code
3333
#

__mocks__/react-native-gesture-handler.ts

Lines changed: 0 additions & 32 deletions
This file was deleted.

__mocks__/react-native-video.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import {View} from 'react-native'
2+
3+
export default View

__tests__/FlatList.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'react-native'
2+
// @ts-ignore
23
import React from 'react'
34
import {
45
fireEvent,
@@ -33,10 +34,9 @@ it('scrolls to top and refreshes all items', async () => {
3334

3435
getByText(/pizza/i)
3536
expect(() => getByText(/the impossible burger/i)).toThrow(
36-
/no instances found/i,
37+
'Unable to find an element with text: /the impossible burger/i',
3738
) //intially not shown
3839
fireEvent.scroll(getByTestId('flat-list'), eventData)
3940
await waitForElementToBeRemoved(() => getByText(/loading more dishes/i))
4041
await waitFor(() => expect(getByText(/the impossible burger/i)))
41-
//2 awaits results in a warning at the moment see https://github.com/callstack/react-native-testing-library/issues/379
4242
})

__tests__/Home.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react'
22
import {fireEvent, render, waitFor} from '@testing-library/react-native'
33
import App from '../src/components/App'
44
import {expect, it, jest} from '@jest/globals'
5+
56
//mocking async storage module
67
const mockedSetItem = jest.fn()
78
jest.mock('@react-native-community/async-storage', () => ({

__tests__/Modal.test.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'react-native'
2+
// @ts-ignore
23
import React from 'react'
34
import {fireEvent, render, waitFor} from '@testing-library/react-native'
45
import {expect, it} from '@jest/globals'
@@ -13,13 +14,17 @@ jest.mock('react-native/Libraries/Modal/Modal', () => {
1314
})
1415

1516
it('renders modal screen correctly', async () => {
16-
const {getByText, debug} = render(<ModalScreen />)
17+
const {getByText} = render(<ModalScreen />)
1718

18-
expect(() => getByText(/hello world/i)).toThrow(/no instances found/i) //modal is initially closed
19+
expect(() => getByText(/hello world/i)).toThrow(
20+
'Unable to find an element with text: /hello world/i',
21+
) //modal is initially closed
1922

2023
fireEvent.press(getByText(/show modal/i))
2124
await waitFor(() => getByText(/hello world/i)) //modal is now visible
2225

2326
fireEvent.press(getByText(/hide modal/i))
24-
expect(() => getByText(/hide modal/i)).toThrow(/no instances found/i) //modal is closed again
27+
expect(() => getByText(/hide modal/i)).toThrow(
28+
'Unable to find an element with text: /hide modal/i',
29+
) //modal is closed again
2530
})

__tests__/Video.test.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,12 @@ import {fireEvent, render} from '@testing-library/react-native'
44
import Video from '../src/components/Video'
55
import {StatusBar} from 'react-native'
66

7+
// 'react-native-video' is being mocked in /__mocks__/react-native-video.ts
8+
79
const navigationMock = {
810
setOptions: jest.fn(),
911
}
1012

11-
jest.mock('react-native-video', () => {
12-
const mockComponent = require('react-native/jest/mockComponent')
13-
return mockComponent('react-native-video')
14-
})
15-
1613
it('renders/navigates throughout app screens', async () => {
1714
const {getByText, getByA11yLabel} = render(
1815
<Video navigation={navigationMock} />,

android/app/build.gradle

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,9 @@ def enableHermes = project.ext.react.get("enableHermes", false);
126126
def nativeArchitectures = project.getProperties().get("reactNativeDebugArchitectures")
127127

128128
android {
129+
ndkVersion rootProject.ext.ndkVersion
129130
compileSdkVersion rootProject.ext.compileSdkVersion
130131

131-
compileOptions {
132-
sourceCompatibility JavaVersion.VERSION_1_8
133-
targetCompatibility JavaVersion.VERSION_1_8
134-
}
135-
136132
defaultConfig {
137133
applicationId "com.testingrnapps"
138134
minSdkVersion rootProject.ext.minSdkVersion
@@ -189,8 +185,7 @@ android {
189185
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
190186
def abi = output.getFilter(OutputFile.ABI)
191187
if (abi != null) { // null for the universal-debug, universal-release variants
192-
output.versionCodeOverride =
193-
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
188+
output.versionCodeOverride = defaultConfig.versionCode * 1000 + versionCodes.get(abi)
194189
}
195190

196191
}
@@ -229,7 +224,7 @@ dependencies {
229224
// Run this once to be able to run the application with BUCK
230225
// puts all compile dependencies into folder libs for BUCK to use
231226
task copyDownloadableDepsToLibs(type: Copy) {
232-
from configurations.compile
227+
from configurations.implementation
233228
into 'libs'
234229
}
235230

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
xmlns:tools="http://schemas.android.com/tools">
3+
xmlns:tools="http://schemas.android.com/tools">
44

55
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
6-
7-
<application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" />
6+
<application
7+
android:usesCleartextTraffic="true"
8+
tools:targetApi="28"
9+
tools:ignore="GoogleAppIndexingWarning">
10+
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity"/>
11+
</application>
812
</manifest>

android/app/src/main/AndroidManifest.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
<category android:name="android.intent.category.LAUNCHER" />
2222
</intent-filter>
2323
</activity>
24-
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
2524
</application>
2625

2726
</manifest>

0 commit comments

Comments
 (0)