Commit Graph

7 Commits

Author SHA1 Message Date
Rick Hanlon de33b8a237 Generate events with no arguments
Summary:
This diff allows generating native events without any arguments with an event like:

```
{
  name: 'onEnd',
  optional: true,
  bubblingType: 'bubble',
  typeAnnotation: {
    type: 'EventTypeAnnotation',
    // note: no argument key
  },
},
```

See the snapshot updates in the diff for the native code that will be generated �

Reviewed By: shergin

Differential Revision: D15403791

fbshipit-source-id: 925a49bb477eebb234e181df681f0d6b1d4e8cf1
2019-05-22 05:36:20 -07:00
Rick Hanlon ed61a3b5f9 Handle component name
Summary:
In order to generate the view configs, we need to know the name of the component used in:

```
ReactNativeViewConfigRegistry.register(
  'RCTNativeComponent',  // <------- this name
  () => BooleanPropNativeComponentViewConfig,
);
```

For this, we'll use `component.name` in the schema (see fixture updates). Doing this would break the native code we generate though, since that code has the RCT stripped.

So this diff adds support to mirror the native stripping of 'RCT' for generated native code

Reviewed By: TheSavior

Differential Revision: D15320422

fbshipit-source-id: be1ab9964078df2c7bc6e41462776f00b94b104f
2019-05-16 10:51:06 -07:00
Rick Hanlon 0827184c60 Add PointPrimitive
Summary: Adds support for the native type Point to the rn codegen

Reviewed By: TheSavior

Differential Revision: D14462164

fbshipit-source-id: 942b5697d616c6aa6289d01bb56382fd7adac203
2019-03-19 06:36:33 -07:00
Rick Hanlon 7723c31329 Add ArrayTypeAnnotation
Summary:
Adds support for `ArrayTypeAnnotation`, usage is as:

```
{
  type: 'ArrayTypeAnnotation',
  items: {
    type: 'BooleanTypeAnnotation',
}

{
  type: 'ArrayTypeAnnotation',
  items: {
    type: 'StringTypeAnnotation',
}

{
  type: 'ArrayTypeAnnotation',
  items: {
    type: 'FloatTypeAnnotation',
}

{
  type: 'ArrayTypeAnnotation',
  items: {
    type: 'Int32TypeAnnotation',
}

{
  type: 'ArrayTypeAnnotation',
  items: {
    type: 'NativePrimitiveTypeAnnotation',
    name: 'ImageSourcePrimitive'
}

{
  type: 'ArrayTypeAnnotation',
  items: {
    type: 'NativePrimitiveTypeAnnotation',
    name: 'ColorPrimitive'
}

{
  type: 'ArrayTypeAnnotation',
  items: {
    type: 'NativePrimitiveTypeAnnotation',
    name: 'PointPrimitive' // added in the next dfif
}
```

Reviewed By: TheSavior

Differential Revision: D14462086

fbshipit-source-id: f0c25f8fe969efc01e5838f3966d910fbbd9c86c
2019-03-19 06:36:33 -07:00
Rick Hanlon f72776e8dc Add inferfaceOnly option to CodegenSchema
Summary: In some cases the implementation for native modules are more advanced and we cannot currently generate some of the files. We've decided in these cases to only generate the props + events for now, so this flag `interfaceOnly` will only generate those files 👍

Reviewed By: TheSavior

Differential Revision: D14295980

fbshipit-source-id: 1790825143206a84469015e08958bf6f00ffde52
2019-03-05 11:53:56 -08:00
Rick Hanlon cf3653baac Generate ImageSource
Summary: Generates the ImageSource primitive for components like Slider

Reviewed By: TheSavior

Differential Revision: D14262452

fbshipit-source-id: 29df3d64706633b51c784fa9acf2f054a510de76
2019-03-02 12:56:02 -08:00
Christoph Nakazawa 5ed749e1b2 Move codegen into packages/react-native-codegen
Summary: This is the first step in organizing React Native slightly differently. This doesn't set up a "monorepo" structure for the GitHub repo yet, it merely moves a few files around and I slightly updated the package.json file for the codegen project.

Reviewed By: rickhanlonii, TheSavior

Differential Revision: D13974180

fbshipit-source-id: f53375f3b6618ef12658064cb1fc690ef1f95299
2019-02-07 03:09:05 -08:00