-
-
Notifications
You must be signed in to change notification settings - Fork 530
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: migrate codegen to TypeScript (#1600)
## Description Issues * [x] ~~`activityState` is set to `0.0` by default in codegened files despite being explicitly set to `WithDefault<Float, -1.0>` in config (it should be `-1.0`). Tested it multiple times it looks like you can't set number < 0 for default when using TypeScript - tested with both `Int32` and `Float` (with Flow it worked fine).~~ * [x] ~~`yarn lint` fails~~ * [x] ~#1631 There are no other differences between codegened files -- I checked it file by file with diff tool. Update: It was confirmed by React Native developer that this indeed is a bug and will be fixed with 0.71. Update: * facebook/react-native#34800 was merged and is available is `0.71` rc branches of React Native. ### ***Important note*** Merging this PR will be breaking change for Fabric support for `react-native` versions lower than `0.71.0` (`activityState` & `sheetCornerRadius` will be broken). ## Changes * Migrated codegen spec files from Flow to TS. * Also bumped `@types/react-native` to `0.69.6` [(see explanation)](d2ed6ec) * Had to do some minor type-fixing in our types * Had to patch `react-navigation-stack` types. This dependency is required for v4. <!-- ## Screenshots / GIFs Here you can add screenshots / GIFs documenting your change. You can add before / after section if you're changing some behavior. ### Before ### After --> ## Test code and steps to reproduce I created a backup of codegened code from before this PR. After applying these changes I ran: `./gradlew :react-native-screens:generateCodegenArtifactsFromSchema` (or just build application) and then I manually compared codegend files using diff checker - the output code is the same. ## Checklist - [x] Ensured that CI passes (there is a known issue with e2e on iOS, it will be handled separately)
- Loading branch information
Showing
26 changed files
with
1,417 additions
and
1,213 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', {}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', {}); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.