Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: migrate codegen to TypeScript #1600

Merged
merged 25 commits into from
Jan 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
48b5376
chore: TS for SearchBarNativeComponent
kkafar Sep 26, 2022
8fa6e49
chore: change extension of ScreenStackNativeComponent.js file
kkafar Sep 26, 2022
cea4e7a
chore: TS for ScreenStackNativeComponent
kkafar Sep 27, 2022
a8ae537
chore: file extension for FullWindowOverlayNativeComponent
kkafar Sep 27, 2022
cf40765
chore: TS for FullWindowOverlay
kkafar Sep 27, 2022
40b05e4
chore: file extension for ScreenContainer
kkafar Sep 27, 2022
b95b423
chore: TS for ScreenContainer
kkafar Sep 27, 2022
207c932
chore: file extension for ScreenStackHeaderSubview
kkafar Sep 27, 2022
a77edf2
chore: TS for ScreenStackHeaderSubview
kkafar Sep 27, 2022
51beadd
chore: file extension for Screen
kkafar Sep 27, 2022
2237277
chore: TS for Screen
kkafar Sep 27, 2022
14608b3
chore: file extension for ScreenNavigationContainer
kkafar Sep 27, 2022
221cbd0
chore: TS for ScreenNavigationContainer
kkafar Sep 27, 2022
8159d8a
chore: file extension for ScreenStackHeaderConfig
kkafar Sep 27, 2022
28a06f0
chore: TS for ScreenStackHeaderConfig
kkafar Sep 27, 2022
c3be6f5
chore: bump @types/react-native to exactly 0.69.6
kkafar Sep 27, 2022
a74de9e
style: apply linter suggestion
kkafar Sep 27, 2022
3abe5ba
Fix linting
kkafar Nov 17, 2022
634b496
style: apply linter suggestions
kkafar Nov 17, 2022
5e338fd
Reinstall node_modules
kkafar Jan 18, 2023
2abee17
Update types in src/types
kkafar Jan 18, 2023
b92255e
Add patch for react-navigation-stack
kkafar Jan 18, 2023
c569577
Disable some eslint inspections
kkafar Jan 18, 2023
ec3ceac
Cast navigator to ahve appropriate method
kkafar Jan 18, 2023
46b5aec
Linter suggestions
kkafar Jan 18, 2023
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
6 changes: 5 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ module.exports = {
'react-native-screens/createNativeStackNavigator',
'react-native-screens/reanimated',
],
'import/ignore': ['node_modules/react-native/index\\.js$'],
'import/ignore': [
'node_modules/react-native/index\\.js$',
'react-native/Libraries/Utilities/codegenNativeComponent.*',
'react-native/Libraries/Types/CodegenTypes.*'
],
'import/resolver': {
node: {
paths: ['src'],
Expand Down
22 changes: 12 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"lint-android": "./android/gradlew -p android spotlessCheck -q",
"lint": "yarn lint-js && yarn lint-android",
"release": "npm login && release-it",
"prepare": "bob build && husky install"
"prepare": "bob build && husky install",
"postinstall": "patch-package"
},
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down Expand Up @@ -71,11 +72,10 @@
"@react-navigation/native": "^5.8.0",
"@react-navigation/stack": "^5.10.0",
"@types/jest": "^26.0.8",
"@types/react": "^16.9.44",
"@types/react-native": "^0.63.2",
"@types/react": "^18.0.24",
"@types/react-test-renderer": "^16.9.2",
"@typescript-eslint/eslint-plugin": "^3.7.1",
"@typescript-eslint/parser": "^3.7.1",
"@typescript-eslint/eslint-plugin": "^5.48.2",
"@typescript-eslint/parser": "^5.48.2",
"@react-native-community/cli": "^9.0.0",
"@react-native-community/cli-platform-android": "^9.0.0",
"@react-native-community/cli-platform-ios": "^9.0.0",
Expand All @@ -99,22 +99,24 @@
"lint-staged": "^11.1.2",
"metro-react-native-babel-preset": "^0.61.0",
"prettier": "^2.0.4",
"react": "^16.13.1",
"react": "18.2.0",
"react-dom": "^16.13.1",
"react-native": "^0.63.2",
"react-native": "0.71.0",
"react-native-reanimated": "^2.2.0",
"react-native-safe-area-context": "^4.0.1-rc.5",
"react-native-safe-area-context": "^4.4.1",
"react-native-windows": "^0.64.8",
"react-navigation": "^4.4.3",
"react-navigation-stack": "^2.9.0",
"react-test-renderer": "^16.13.1",
"release-it": "^13.5.2",
"typescript": "^3.9.7"
"patch-package": "6.5.1",
"typescript": "4.8.4"
},
"resolutions": {
"@react-native-community/cli-platform-android": "^9.0.0",
"@react-native-community/cli": "^9.0.0",
"@react-native-community/cli-platform-ios": "^9.0.0"
"@react-native-community/cli-platform-ios": "^9.0.0",
"@types/react": "^18.0.24"
},
"lint-staged": {
"{src,Example}/**/*.{js,ts,tsx}": "yarn format-js",
Expand Down
80 changes: 80 additions & 0 deletions patches/react-navigation-stack+2.10.4.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
diff --git a/node_modules/react-navigation-stack/src/vendor/types.tsx b/node_modules/react-navigation-stack/src/vendor/types.tsx
index 977e7d4..50cdd8e 100644
--- a/node_modules/react-navigation-stack/src/vendor/types.tsx
+++ b/node_modules/react-navigation-stack/src/vendor/types.tsx
@@ -104,17 +104,17 @@ export type Scene<T> = {
/**
* Progress value of the current screen.
*/
- current: Animated.AnimatedInterpolation;
+ current: Animated.AnimatedInterpolation<number>;
/**
* Progress value for the screen after this one in the stack.
* This can be `undefined` in case the screen animating is the last one.
*/
- next?: Animated.AnimatedInterpolation;
+ next?: Animated.AnimatedInterpolation<number>;
/**
* Progress value for the screen before this one in the stack.
* This can be `undefined` in case the screen animating is the first one.
*/
- previous?: Animated.AnimatedInterpolation;
+ previous?: Animated.AnimatedInterpolation<number>;
};
};

@@ -509,7 +509,7 @@ export type StackCardInterpolationProps = {
/**
* Animated node representing the progress value of the current screen.
*/
- progress: Animated.AnimatedInterpolation;
+ progress: Animated.AnimatedInterpolation<number>;
};
/**
* Values for the current screen the screen after this one in the stack.
@@ -519,7 +519,7 @@ export type StackCardInterpolationProps = {
/**
* Animated node representing the progress value of the next screen.
*/
- progress: Animated.AnimatedInterpolation;
+ progress: Animated.AnimatedInterpolation<number>;
};
/**
* The index of the card in the stack.
@@ -528,15 +528,15 @@ export type StackCardInterpolationProps = {
/**
* Animated node representing whether the card is closing (1 - closing, 0 - not closing).
*/
- closing: Animated.AnimatedInterpolation;
+ closing: Animated.AnimatedInterpolation<number>;
/**
* Animated node representing whether the card is being swiped (1 - swiping, 0 - not swiping).
*/
- swiping: Animated.AnimatedInterpolation;
+ swiping: Animated.AnimatedInterpolation<number>;
/**
* Animated node representing multiplier when direction is inverted (-1 - inverted, 1 - normal).
*/
- inverted: Animated.AnimatedInterpolation;
+ inverted: Animated.AnimatedInterpolation<number>;
/**
* Layout measurements for various items we use for animation.
*/
@@ -588,7 +588,7 @@ export type StackHeaderInterpolationProps = {
/**
* Animated node representing the progress value of the current screen.
*/
- progress: Animated.AnimatedInterpolation;
+ progress: Animated.AnimatedInterpolation<number>;
};
/**
* Values for the current screen the screen after this one in the stack.
@@ -598,7 +598,7 @@ export type StackHeaderInterpolationProps = {
/**
* Animated node representing the progress value of the next screen.
*/
- progress: Animated.AnimatedInterpolation;
+ progress: Animated.AnimatedInterpolation<number>;
};
/**
* Layout measurements for various items we use for animation.
19 changes: 0 additions & 19 deletions src/fabric/FullWindowOverlayNativeComponent.js

This file was deleted.

6 changes: 6 additions & 0 deletions src/fabric/FullWindowOverlayNativeComponent.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
import type { ViewProps } from 'react-native';

interface NativeProps extends ViewProps {}

export default codegenNativeComponent<NativeProps>('RNSFullWindowOverlay', {});
19 changes: 0 additions & 19 deletions src/fabric/ScreenContainerNativeComponent.js

This file was deleted.

6 changes: 6 additions & 0 deletions src/fabric/ScreenContainerNativeComponent.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
import type { ViewProps } from 'react-native';

interface NativeProps extends ViewProps {}

export default codegenNativeComponent<NativeProps>('RNSScreenContainer', {});
104 changes: 0 additions & 104 deletions src/fabric/ScreenNativeComponent.js

This file was deleted.

Loading