-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch native codegen over to flow parser
Summary: This diff switches the native codegen over to the flow parser It does this by: - Creating a new e2e directory - Migrating the schema.js fixtures to flow types in e2e/ - Updating the buck tests to use the flow type fixtures - Finally, updating the rest of rn_codegen to use *NativeComponent instead of *Schema.js Removing all of the schemas in the next diff to keep this one clean Reviewed By: cpojer Differential Revision: D15960603 fbshipit-source-id: 3df28b31e618491301578ab7f6e28a80f55404b2
- Loading branch information
1 parent
ea817fd
commit 98b03fa
Showing
24 changed files
with
472 additions
and
240 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 was deleted.
Oops, something went wrong.
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
40 changes: 40 additions & 0 deletions
40
packages/react-native-codegen/e2e/__test_fixtures__/ArrayPropsNativeComponent.js
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,40 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @format | ||
* @flow | ||
*/ | ||
|
||
'use strict'; | ||
|
||
import type { | ||
PointValue, | ||
ColorValue, | ||
} from '../../../../Libraries/StyleSheet/StyleSheetTypes'; | ||
import type {ImageSource} from '../../../../Libraries/Image/ImageSource'; | ||
import type { | ||
Int32, | ||
Float, | ||
WithDefault, | ||
} from '../../../../Libraries/Types/CodegenTypes'; | ||
import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes'; | ||
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent'; | ||
|
||
type NativeProps = $ReadOnly<{| | ||
...ViewProps, | ||
|
||
// Props | ||
names?: $ReadOnlyArray<string>, | ||
disableds?: $ReadOnlyArray<boolean>, | ||
progress?: $ReadOnlyArray<Int32>, | ||
radii?: $ReadOnlyArray<Float>, | ||
colors?: $ReadOnlyArray<ColorValue>, | ||
srcs?: $ReadOnlyArray<ImageSource>, | ||
points?: $ReadOnlyArray<PointValue>, | ||
sizes?: WithDefault<$ReadOnlyArray<'small' | 'large'>, 'small'>, | ||
|}>; | ||
|
||
export default codegenNativeComponent<NativeProps>('ArrayPropsNativeComponent'); |
26 changes: 26 additions & 0 deletions
26
packages/react-native-codegen/e2e/__test_fixtures__/BooleanPropNativeComponent.js
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,26 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @format | ||
* @flow | ||
*/ | ||
|
||
'use strict'; | ||
|
||
import type {WithDefault} from '../../../../Libraries/Types/CodegenTypes'; | ||
import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes'; | ||
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent'; | ||
|
||
type NativeProps = $ReadOnly<{| | ||
...ViewProps, | ||
|
||
// Props | ||
disabled?: WithDefault<boolean, false>, | ||
|}>; | ||
|
||
export default codegenNativeComponent<NativeProps>( | ||
'BooleanPropNativeComponent', | ||
); |
24 changes: 24 additions & 0 deletions
24
packages/react-native-codegen/e2e/__test_fixtures__/ColorPropNativeComponent.js
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,24 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @format | ||
* @flow | ||
*/ | ||
|
||
'use strict'; | ||
|
||
import type {ColorValue} from '../../../../Libraries/StyleSheet/StyleSheetTypes'; | ||
import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes'; | ||
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent'; | ||
|
||
type NativeProps = $ReadOnly<{| | ||
...ViewProps, | ||
|
||
// Props | ||
tintColor?: ColorValue, | ||
|}>; | ||
|
||
export default codegenNativeComponent<NativeProps>('ColorPropNativeComponent'); |
24 changes: 24 additions & 0 deletions
24
packages/react-native-codegen/e2e/__test_fixtures__/EnumPropNativeComponent.js
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,24 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @format | ||
* @flow | ||
*/ | ||
|
||
'use strict'; | ||
|
||
import type {WithDefault} from '../../../../Libraries/Types/CodegenTypes'; | ||
import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes'; | ||
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent'; | ||
|
||
type NativeProps = $ReadOnly<{| | ||
...ViewProps, | ||
|
||
// Props | ||
alignment?: WithDefault<'top' | 'center' | 'bottom-right', 'center'>, | ||
|}>; | ||
|
||
export default codegenNativeComponent<NativeProps>('EnumPropNativeComponent'); |
43 changes: 43 additions & 0 deletions
43
packages/react-native-codegen/e2e/__test_fixtures__/EventNestedObjectPropsNativeComponent.js
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,43 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @format | ||
* @flow | ||
*/ | ||
|
||
'use strict'; | ||
|
||
import type { | ||
Int32, | ||
BubblingEvent, | ||
WithDefault, | ||
} from '../../../../Libraries/Types/CodegenTypes'; | ||
import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes'; | ||
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent'; | ||
|
||
type OnChangeEvent = $ReadOnly<{| | ||
location: { | ||
source: { | ||
url: string, | ||
}, | ||
x: Int32, | ||
y: Int32, | ||
}, | ||
|}>; | ||
|
||
type NativeProps = $ReadOnly<{| | ||
...ViewProps, | ||
|
||
// Props | ||
disabled?: WithDefault<boolean, false>, | ||
|
||
// Events | ||
onChange?: ?(event: BubblingEvent<OnChangeEvent>) => void, | ||
|}>; | ||
|
||
export default codegenNativeComponent<NativeProps>( | ||
'EventNestedObjectPropsNativeComponent', | ||
); |
Oops, something went wrong.