Skip to content

Commit 5b489bd

Browse files
committed
Merge branch 'main' into fix/mapbox-initialization
2 parents 4ebb8f6 + b0947e0 commit 5b489bd

File tree

355 files changed

+10615
-4106
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

355 files changed

+10615
-4106
lines changed

.eslintrc.js

-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ module.exports = {
109109
},
110110
rules: {
111111
// TypeScript specific rules
112-
'@typescript-eslint/no-unsafe-assignment': 'off',
113112
'@typescript-eslint/prefer-enum-initializers': 'error',
114113
'@typescript-eslint/no-var-requires': 'off',
115114
'@typescript-eslint/no-non-null-assertion': 'error',

.github/actions/javascript/bumpVersion/bumpVersion.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ if (!semanticVersionLevel || !versionUpdater.isValidSemverLevel(semanticVersionL
4949
console.log(`Invalid input for 'SEMVER_LEVEL': ${semanticVersionLevel}`, `Defaulting to: ${semanticVersionLevel}`);
5050
}
5151

52-
const {version: previousVersion}: PackageJson = JSON.parse(fs.readFileSync('./package.json').toString());
52+
const {version: previousVersion} = JSON.parse(fs.readFileSync('./package.json').toString()) as PackageJson;
5353
if (!previousVersion) {
5454
core.setFailed('Error: Could not read package.json');
5555
}

.github/actions/javascript/createOrUpdateStagingDeploy/createOrUpdateStagingDeploy.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ import GitUtils from '@github/libs/GitUtils';
88

99
type IssuesCreateResponse = Awaited<ReturnType<typeof GithubUtils.octokit.issues.create>>['data'];
1010

11-
type PackageJSON = {
11+
type PackageJson = {
1212
version: string;
1313
};
1414

1515
async function run(): Promise<IssuesCreateResponse | void> {
1616
// Note: require('package.json').version does not work because ncc will resolve that to a plain string at compile time
17-
const packageJson: PackageJSON = JSON.parse(fs.readFileSync('package.json', 'utf8'));
17+
const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8')) as PackageJson;
1818
const newVersionTag = packageJson.version;
1919

2020
try {

.github/actions/javascript/getGraphiteString/getGraphiteString.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const run = () => {
3333
}
3434

3535
try {
36-
const current: RegressionEntry = JSON.parse(entry);
36+
const current = JSON.parse(entry) as RegressionEntry;
3737

3838
// Extract timestamp, Graphite accepts timestamp in seconds
3939
if (current.metadata?.creationDate) {

.github/actions/javascript/getPreviousVersion/getPreviousVersion.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function run() {
1111
core.setFailed(`'Error: Invalid input for 'SEMVER_LEVEL': ${semverLevel}`);
1212
}
1313

14-
const {version: currentVersion}: PackageJson = JSON.parse(readFileSync('./package.json', 'utf8'));
14+
const {version: currentVersion} = JSON.parse(readFileSync('./package.json', 'utf8')) as PackageJson;
1515
if (!currentVersion) {
1616
core.setFailed('Error: Could not read package.json');
1717
}

.github/actions/javascript/validateReassureOutput/validateReassureOutput.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type {CompareResult, PerformanceEntry} from '@callstack/reassure-compare/
33
import fs from 'fs';
44

55
const run = (): boolean => {
6-
const regressionOutput: CompareResult = JSON.parse(fs.readFileSync('.reassure/output.json', 'utf8'));
6+
const regressionOutput = JSON.parse(fs.readFileSync('.reassure/output.json', 'utf8')) as CompareResult;
77
const countDeviation = Number(core.getInput('COUNT_DEVIATION', {required: true}));
88
const durationDeviation = Number(core.getInput('DURATION_DEVIATION_PERCENTAGE', {required: true}));
99

+61-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,65 @@
1-
import {useIsFocused as realUseIsFocused, useTheme as realUseTheme} from '@react-navigation/native';
1+
/* eslint-disable import/prefer-default-export, import/no-import-module-exports */
2+
import type * as ReactNavigation from '@react-navigation/native';
3+
import createAddListenerMock from '../../../tests/utils/createAddListenerMock';
24

3-
// We only want these mocked for storybook, not jest
4-
const useIsFocused: typeof realUseIsFocused = process.env.NODE_ENV === 'test' ? realUseIsFocused : () => true;
5+
const isJestEnv = process.env.NODE_ENV === 'test';
56

6-
const useTheme = process.env.NODE_ENV === 'test' ? realUseTheme : () => ({});
7+
const realReactNavigation = isJestEnv ? jest.requireActual<typeof ReactNavigation>('@react-navigation/native') : (require('@react-navigation/native') as typeof ReactNavigation);
8+
9+
const useIsFocused = isJestEnv ? realReactNavigation.useIsFocused : () => true;
10+
const useTheme = isJestEnv ? realReactNavigation.useTheme : () => ({});
11+
12+
const {triggerTransitionEnd, addListener} = isJestEnv
13+
? createAddListenerMock()
14+
: {
15+
triggerTransitionEnd: () => {},
16+
addListener: () => {},
17+
};
18+
19+
const useNavigation = () => ({
20+
...realReactNavigation.useNavigation,
21+
navigate: jest.fn(),
22+
getState: () => ({
23+
routes: [],
24+
}),
25+
addListener,
26+
});
27+
28+
type NativeNavigationMock = typeof ReactNavigation & {
29+
triggerTransitionEnd: () => void;
30+
};
731

832
export * from '@react-navigation/core';
9-
export {useIsFocused, useTheme};
33+
const Link = realReactNavigation.Link;
34+
const LinkingContext = realReactNavigation.LinkingContext;
35+
const NavigationContainer = realReactNavigation.NavigationContainer;
36+
const ServerContainer = realReactNavigation.ServerContainer;
37+
const DarkTheme = realReactNavigation.DarkTheme;
38+
const DefaultTheme = realReactNavigation.DefaultTheme;
39+
const ThemeProvider = realReactNavigation.ThemeProvider;
40+
const useLinkBuilder = realReactNavigation.useLinkBuilder;
41+
const useLinkProps = realReactNavigation.useLinkProps;
42+
const useLinkTo = realReactNavigation.useLinkTo;
43+
const useScrollToTop = realReactNavigation.useScrollToTop;
44+
export {
45+
// Overriden modules
46+
useIsFocused,
47+
useTheme,
48+
useNavigation,
49+
triggerTransitionEnd,
50+
51+
// Theme modules are left alone
52+
Link,
53+
LinkingContext,
54+
NavigationContainer,
55+
ServerContainer,
56+
DarkTheme,
57+
DefaultTheme,
58+
ThemeProvider,
59+
useLinkBuilder,
60+
useLinkProps,
61+
useLinkTo,
62+
useScrollToTop,
63+
};
64+
65+
export type {NativeNavigationMock};

__mocks__/@ua/react-native-airship.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,31 @@ const iOS: Partial<typeof AirshipIOS> = {
1515
},
1616
};
1717

18-
const pushIOS: AirshipPushIOS = jest.fn().mockImplementation(() => ({
18+
const pushIOS = jest.fn().mockImplementation(() => ({
1919
setBadgeNumber: jest.fn(),
2020
setForegroundPresentationOptions: jest.fn(),
2121
setForegroundPresentationOptionsCallback: jest.fn(),
22-
}))();
22+
}))() as AirshipPushIOS;
2323

24-
const pushAndroid: AirshipPushAndroid = jest.fn().mockImplementation(() => ({
24+
const pushAndroid = jest.fn().mockImplementation(() => ({
2525
setForegroundDisplayPredicate: jest.fn(),
26-
}))();
26+
}))() as AirshipPushAndroid;
2727

28-
const push: AirshipPush = jest.fn().mockImplementation(() => ({
28+
const push = jest.fn().mockImplementation(() => ({
2929
iOS: pushIOS,
3030
android: pushAndroid,
3131
enableUserNotifications: () => Promise.resolve(false),
3232
clearNotifications: jest.fn(),
3333
getNotificationStatus: () => Promise.resolve({airshipOptIn: false, systemEnabled: false, airshipEnabled: false}),
3434
getActiveNotifications: () => Promise.resolve([]),
35-
}))();
35+
}))() as AirshipPush;
3636

37-
const contact: AirshipContact = jest.fn().mockImplementation(() => ({
37+
const contact = jest.fn().mockImplementation(() => ({
3838
identify: jest.fn(),
3939
getNamedUserId: () => Promise.resolve(undefined),
4040
reset: jest.fn(),
4141
module: jest.fn(),
42-
}))();
42+
}))() as AirshipContact;
4343

4444
const Airship: Partial<AirshipRoot> = {
4545
addListener: jest.fn(),

__mocks__/fs.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
12
const {fs} = require('memfs');
23

34
module.exports = fs;

__mocks__/react-native.ts

+7-4
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jest.doMock('react-native', () => {
4141
};
4242
};
4343

44-
const reactNativeMock: ReactNativeMock = Object.setPrototypeOf(
44+
const reactNativeMock = Object.setPrototypeOf(
4545
{
4646
NativeModules: {
4747
...ReactNative.NativeModules,
@@ -86,7 +86,7 @@ jest.doMock('react-native', () => {
8686
},
8787
Dimensions: {
8888
...ReactNative.Dimensions,
89-
addEventListener: jest.fn(),
89+
addEventListener: jest.fn(() => ({remove: jest.fn()})),
9090
get: () => dimensions,
9191
set: (newDimensions: Record<string, number>) => {
9292
dimensions = newDimensions;
@@ -98,11 +98,14 @@ jest.doMock('react-native', () => {
9898
// so it seems easier to just run the callback immediately in tests.
9999
InteractionManager: {
100100
...ReactNative.InteractionManager,
101-
runAfterInteractions: (callback: () => void) => callback(),
101+
runAfterInteractions: (callback: () => void) => {
102+
callback();
103+
return {cancel: () => {}};
104+
},
102105
},
103106
},
104107
ReactNative,
105-
);
108+
) as ReactNativeMock;
106109

107110
return reactNativeMock;
108111
});

android/app/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ android {
107107
minSdkVersion rootProject.ext.minSdkVersion
108108
targetSdkVersion rootProject.ext.targetSdkVersion
109109
multiDexEnabled rootProject.ext.multiDexEnabled
110-
versionCode 1009000305
111-
versionName "9.0.3-5"
110+
versionCode 1009000407
111+
versionName "9.0.4-7"
112112
// Supported language variants must be declared here to avoid from being removed during the compilation.
113113
// This also helps us to not include unnecessary language variants in the APK.
114114
resConfigs "en", "es"

0 commit comments

Comments
 (0)