Граф коммитов

1394 Коммитов

Автор SHA1 Сообщение Дата
Michał Osadnik f7695e0183 Harden the Flow parser to handle more AST formats for commands and props
Summary:
This diff allows for parsing more flexible AST format.

Reusing logic used for methods, I add similar support for props and commands in components. Now it's possible to define separated type for props and commands in another part of the file.

Also, extracted this method to another file for reusing purposes.

Added tests.

Reviewed By: rickhanlonii

Differential Revision: D16221445

fbshipit-source-id: 21553bf5ade66588dd7dc0320d25333260b0ada9
2019-07-16 07:32:35 -07:00
Spencer Ahrens 7d096803d1 Make VList in ScrollView warning consider horizontal prop
Summary: It's ok to put VLists in ScrollViews with different scroll directions.

Reviewed By: yungsters

Differential Revision: D16217209

fbshipit-source-id: 7b1c3e93c19867da7414ccda4cda8cc89d25d522
2019-07-15 13:31:47 -07:00
Kevin Gonzales b8ccb260ac Added button with accessibility action example and support for Touchables (#25582)
Summary:
We added a test to make sure button and accessibility actions would not have unwanted behavior. Additionally we added support for accessibility actions for all touchables. However we discovered that RCTTextView and possibly anything else that does not derive from RCTView does not support accessibility actions and need to be children off a component that does support it for it to not crash in ios. This became noticeable when TouchableWithoutFeedback only worked if text is a child of view on ios.

In a local branch we where able to modify RCTTextView to support accessibility actions and text no longer needed to be a child of view for it to work.

## Changelog

[General] [Added] - Button test with accessibility actions
[General] [Added] - Support for accessibility actions to all Touchables. With TouchableWithoutFeedback being a special case where text must be a child of view. (See AccessibilityExample.js for an example)
Pull Request resolved: https://github.com/facebook/react-native/pull/25582

Test Plan:
Test plan is testing in RNTester making sure the examples work

## Open Question
What would you say is the best practice for adding accessibility action support for all the components that do not extended from RCTView?

Reviewed By: cpojer

Differential Revision: D16192919

Pulled By: osdnk

fbshipit-source-id: 7d4e186ba1f30393f2b4d08a0e227b960f83586c
2019-07-11 01:38:18 -07:00
Michał Osadnik fb7b2d3533 Change returning value of DirectEventHandler and BubblingEventHandler to void
Summary:
returning type of Bubbling and Direct Event should be always void of Promise (if async). Other situations shouldn't be permitted.
Reformated all cases when it the function wasn't void.

Reviewed By: rickhanlonii

Differential Revision: D16165962

fbshipit-source-id: 7c1377c3ed4bd54a431a13e5bcda4f7ec0adf4dc
2019-07-10 05:40:20 -07:00
Michał Osadnik dc52f8c2e6 Force property to be optional if value has WithDefault
Summary: It's pointless to handle non optional key if value has withDefaul so I'm adding a rule into parser preventing from such cases

Reviewed By: lunaleaps

Differential Revision: D16166709

fbshipit-source-id: 38cef522b217917a3a4886d857720932f2ebb475
2019-07-09 14:44:43 -07:00
Michał Osadnik b7782fb57c Add codegen to AndroidDrawer
Summary:
Using Ricky's last changes I managed to subscribe for both new and old event name.

Fixed event to proper one for codegen in native code.

Reviewed By: TheSavior

Differential Revision: D16065660

fbshipit-source-id: b5d3762d673a34bbdf5a8e60ff4d51617c8adb81
2019-07-03 02:29:47 -07:00
Michał Osadnik 61e95e5cbf Force WithDefault not to be an optional value
Summary:
`WithDefault` appears not to be required to be prefixed with `?` because it's option value per se.

Fixed tests, removed `?` where needed, updated snapshots and review them. Added mechanism fro throwing error when `?WithDefault` found. Add tests for it.

Reviewed By: rubennorte

Differential Revision: D16048463

fbshipit-source-id: f55ed7454aacf0b8c42944a9b5c1037ad1b360fe
2019-07-02 03:30:55 -07:00
Vojtech Novak e6c7846612 allow custom StickyHeader in ScrollView-based components (#25428)
Summary:
This PR adds support for custom `StickyHeaderComponent` to be used in ScrollView (and by extension in FlatList, SectionList..).

Motivation: I've been working on a FlatList with hidable header that has a search field in it. Something like https://medium.com/appandflow/react-native-collapsible-navbar-e51a049b560a but using a FlatList w/ pull-to-refresh. The implementation can be found at https://snack.expo.io/vonovak/hidable-header-flatlist .

I used the `ListHeaderComponent` prop to render the custom header - as opposed to absolute positioning which is used in the linked article because I also need the loading indicator (I added `refreshing` and `onRefresh` for that) to show up above the header.
I proceeded by adding `stickyHeaderIndices={[0]}` to keep the header at the top, which seems to be the idiomatic way to do so. Then I added `Animated.View` with custom translation logic to the rendered header.

All appears to be working fine at the first sight - when you tap any item, you'll see it react to touch (red underlay). You'll also see the header becomes hidden if I scroll far enough and appears again after scrolling up. BUT - when you scroll down so that the header becomes hidden and tap the first visible item in the list, it will not react to touches! The reason is that `ScrollViewStickyHeader`

9a84970c35/Libraries/Components/ScrollView/ScrollView.js (L984)

has its own translation logic and when I tap onto the item at the top of the list, it seems like I'm tapping the item but I'm in fact tapping that `ScrollViewStickyHeader`.

I tried working around this by not specifying `stickyHeaderIndices={[0]}` and using `ListHeaderComponentStyle` prop (this needed some additional changes in 9a84970c35/Libraries/Lists/VirtualizedList.js (L786), and the animation is junky for some reason - as if the header always needed to "catch up" with the scroll offset, causing jitter) and `CellRendererComponent` (junky animations too), but concluded that allowing to specify custom `StickyHeaderComponent` is the cleanest way to make something like this work. I'm slightly surprised I needed to do all this to make such a usual pattern work - am I missing something?

## Changelog

[GENERAL] [ADDED] - allow custom StickyHeader in ScrollView-based components
Pull Request resolved: https://github.com/facebook/react-native/pull/25428

Test Plan: This is a minor change that should not break anything; tested locally.

Differential Revision: D16073016

Pulled By: cpojer

fbshipit-source-id: cdb878d12a426068dbaa9a54367c1190a6c55328
2019-07-01 10:54:50 -07:00
Michał Osadnik 75d01075d4 Allow primitivies without default values
Summary:
It's not needed to keep required providing default values even if they are not actually relevant.

Here I add a support for `null`, `0` of `false` instead by default and remove throwing errors if no other default value provided.

Reviewed By: rubennorte

Differential Revision: D16049047

fbshipit-source-id: bc4961af3873190568f2753fc4ec975354896df5
2019-07-01 07:51:25 -07:00
Michał Osadnik 0f83dfab8e Transform BubbleEvent and DirectEvent into DirectEventHandler and BubblingEventHandler
Summary:
It appears that `(e: BubblingEvent<T>) = mixed` exists only in given context and it's pointless to keep in this way. It could be simplified to `BubblingEventHandler<T>` without any negative consequences and that's the motivation of this diff.

The only tradeoff of this decision is leaving an opportunity to declare Bubbling/Direct event in the top of the file bc then analysing the code becomes much more difficult. However, it's not used anywhere so it's not a problem now and probably any time.

Also, changes the names to `DirectEventHandler` and `BubblingEventHandler` which are more related to current state. The names were updated in many places in code.

Reviewed By: rubennorte

Differential Revision: D16054571

fbshipit-source-id: 741d075eb46b80bac8eb73a6b30fc0b448cb3902
2019-07-01 05:13:53 -07:00
Spencer Ahrens e7a0979b8f warn if VirtualizedList is embedded in a plain ScrollView
Summary:
This breaks virtualization, viewability callbacks, and other features, so should be warned against.

Hopefully this would have made D15890785 trivial to figure out.

Reviewed By: PeteTheHeat

Differential Revision: D16040939

fbshipit-source-id: 593cd5da9891450fdcb501aef41455cf2d7baa4f
2019-06-28 18:00:44 -07:00
Rick Hanlon 9a84970c35 Add paperTopLevelNameDeprecated
Summary:
This diff adds a way for the codegen to handle view configs with non-standard top event names by adding a `paperTopLevelNameDeprecated` field to events in the schema.

## The problem
The problem this is solving is that Android host components build their own options for event settings in the view config. So instead of enforcing `onChange` to use the top level event name `topChange` like iOS does, Android can use `change` or `forbarChange` or anything the person adding the component wanted at the time:

```
// Expected
topChange: {
  registrationName: 'onChange',
},

// Android
bringBackStargateYouCowards: {
  registrationName: 'onChange',
},
```

This is possible because of the way Android builds these settings
```
// On iOS, notice that there's no option to change the top level name:
RCT_EXPORT_VIEW_PROPERTY(onChange, RCTDirectEventBlock);

// On Android, you provide the top level event name
Override
public Map getExportedCustomDirectEventTypeConstants() {
  return MapBuilder.of(
      "bringBackStargateYouCowards",
      MapBuilder.of("registrationName", "onChange"));
}
```

Since the codegen does not allow us to specify the top level event name (similar to iOS), we don't have a way to customize the names to support android

## The solution
To fix this, we're adding an extra option the event flow types:

```
onBubblingChange: (event: BubblingEvent<Event, 'customBubblingName'>) => void,
onDirectChange: (event: DirectEvent<Event, 'customDirectName'>) => void,
```

These will register **both** top level names in the view config:

```
{
  directEventTypes: {
     // Notice the same registration name is configured for different top level events
    topChange: {
      registrationName: 'onChange',
    },
    bringBackStargateYouCowards: {
      registrationName: 'onChange',
    },
  }
}
```
This means when either `topChange` or `bringBackStargateYouCowards` fires it will call the onChange listener. **This gives us the flexibility to rename the native event name without breaking backwards compatibility.** Old apps will work when `bringBackStargateYouCowards` is fired, and new apps with an update will work when `topChange` fires.

Note: only the correct name will be generated for Fabric so technically we don't even really need to migrate the paper names and this prop can be deleted when paper is gone.

Reviewed By: cpojer

Differential Revision: D16042065

fbshipit-source-id: 40d076b43ffbbfc6c65c3c19de481d922a2add62
2019-06-28 06:50:36 -07:00
Rick Hanlon 3ca19c0481 Remove Schema.js files replaced with flow types
Summary: These files are no longer needed since all files codegen'd use flow types as the source 🎉

Reviewed By: cpojer

Differential Revision: D15961378

fbshipit-source-id: 510a298b2e97cd78a9a3648cbaa239e8134daa75
2019-06-27 08:04:13 -07:00
Pavlos Vinieratos dff35882a3 add `passwordRules` for `textContentType` `newPassword` (#25407)
Summary:
On `textContentType` `newPassword` on ios, there is another property called `passwordRules` on ios 12 that can give hints to the os to generate a password with specific requirements like [here](https://developer.apple.com/password-rules/).
This is useful for apps that have a "register" screen with `emailAddress`/`username` and a `newPassword` fields, to let ios make a password that will satisfy the requirements and not one that might be not accepted after the user presses "register".

## Changelog

[iOS] [Added] - PasswordRules for new password textContentType input fields
Pull Request resolved: https://github.com/facebook/react-native/pull/25407

Test Plan: This is a bit harder, but to test you need to make an app that has associated domains with an apple-app-site-association file on that domain, enable iCloud Keychain on the test device, and then iOS will suggest a password, otherwise you will just get a warning on Xcode saying "Couldn't suggest password because of: blabla".

Differential Revision: D16028684

Pulled By: cpojer

fbshipit-source-id: d22426e07f1db45d1f79f5dad81f1465a9701f0b
2019-06-27 03:25:42 -07:00
Tim Yung 3c41e7387d RN: Cleanup PickerAndroid
Summary:
Cleans up the implementation of `AndroidPicker` and the Flow types for the native components to almost work with `codegenNativeComponent`.

The remaining blocker is that the `items` prop is an array of objects: https://fburl.com/km8uj8x2

Reviewed By: rickhanlonii

Differential Revision: D15805611

fbshipit-source-id: 34bea83db8dbaaf6eb23b00e73e0c7ce292e8a32
2019-06-26 10:05:32 -07:00
Eli White 9ad60131ba Support parsing View Commands into the schema
Summary: The schema for these view commands is lifted wholesale from the schema for TurboModules: P67239314

Reviewed By: rickhanlonii

Differential Revision: D15943109

fbshipit-source-id: a0ccd4e47067b62970218df6a32527c15868c4a5
2019-06-24 18:54:41 -07:00
Rick Hanlon 0cb512f536 Fix PullToRefresh onRefresh event
Summary: The onRefresh event is a DirectEvent not a BubblingEvent

Reviewed By: PeteTheHeat

Differential Revision: D15969475

fbshipit-source-id: 049a6ffc74306246e8dbc3acdce5b0b26e849fc7
2019-06-24 11:57:13 -07:00
Rick Hanlon 004a90b131 Generate UnimplementedNativeView
Summary: This component is only used in native (there are no JS paths to it). Currently, the schema is being used to generate the native code for this component. Here, we add the codegen types so we still generate the native code when the schemas are removed, but the view config will never be used

Reviewed By: cpojer

Differential Revision: D15960990

fbshipit-source-id: 08fd0155f603e45785520c49a3ea86e30b276f9c
2019-06-24 04:59:13 -07:00
Rick Hanlon 3bdba0e0dc Slider fromUser is required
Summary: This was a mismatch with the schema

Reviewed By: cpojer

Differential Revision: D15960977

fbshipit-source-id: 08a56ac404eb5d45c6363e4574bd3d7bacf3ca08
2019-06-24 04:59:13 -07:00
Rick Hanlon 940a7d5a51 s/PullToRefresh/PullToRefreshView
Summary: Renames PullToRefresh to PullToRefreshView to correct a previous mistake so that this matches the Schema file

Reviewed By: cpojer

Differential Revision: D15960975

fbshipit-source-id: 575e526df2efdfa260f3cbbb4b0764998a91ade0
2019-06-24 04:59:13 -07:00
Rick Hanlon aa89f908cb AndroidSwipeRefreshLayout is not interfaceOnly
Summary: I think this was just an oversight when adding the flow types (notice that this flag isn't in the schema file, and the interface is required for android)

Reviewed By: TheSavior

Differential Revision: D15960965

fbshipit-source-id: 116b289261fbcaaaff53cd657a91f03dc036fb98
2019-06-24 04:59:13 -07:00
Cameron Bourke 680abf2d56 Move to SegmentedControlIOS to use a generated view config
Summary:
## Context
Moving SegmentedControlIOS to use a generated view config.

 ---

It's worth mentioning that even though `RCTSegmentedControlNativeComponent` defines a different event type to that of `RCTView`. We currently do not have 100%  type safety for the event types in Paper. In other words, when an event for `onChange` in this case comes from the native side, it could potentially be shaped differently than what was typed in the native component file. This will be addressed in `Fabric`.
```
// RCTSegmentedControlNativeComponent.js
export type Event = $ReadOnly<{|
  value: Int32,
  selectedSegmentIndex: Int32,
|}>;
...
export type NativeProps = $ReadOnly<{|
  ...
  onChange?: ?(event: BubblingEvent<Event>) => mixed,
|}>
```
This means that in the view config diff, there will be a value of `none` for `bubblingEventTypes`

Reviewed By: rickhanlonii

Differential Revision: D15851692

fbshipit-source-id: 6653fe7a77e46afdd55808aa5a4df813b34d7f70
2019-06-24 02:03:31 -07:00
Rick Hanlon b063c41782 Generate PullToRefreshView
Summary: Adds the codgen types and generated view config for PullToRefresh

Reviewed By: TheSavior

Differential Revision: D15900138

fbshipit-source-id: ee2c179317749182aaf6d3b90c8379ce06a82b9c
2019-06-21 03:35:40 -07:00
Sam Mathias Weggersen 73c5a8ec1b Keyboard accessibility follow up (#25274)
Summary:
This is a follow up PR to https://github.com/facebook/react-native/issues/24359. There's a good thread in the mentioned PR for more background for why I'm doing this change. Essentially `focusable` makes more sense since it is about whether a view can receive user-initiated focus from a pointer or keyboard.
Pull Request resolved: https://github.com/facebook/react-native/pull/25274

Differential Revision: D15873739

Pulled By: cpojer

fbshipit-source-id: 0f526bb99ecdc68131dfc10200a5d44c2ef75b33
2019-06-21 03:13:38 -07:00
Eli White a62490808d Make ViewNativeComponent use ES6 exports
Summary: We will need to use ES6 exports when we switch this to use the codegen'd view configs. I also need to have a named export from this file.

Reviewed By: rickhanlonii

Differential Revision: D15923789

fbshipit-source-id: 513e27834583b6d021ff06d5d7f116ccdcd27722
2019-06-20 18:29:41 -07:00
Eli White 28f1aac88c Remove extra component wrapper from View
Summary:
View needed this wrapper to add a dev time warning about text children. Text children became supported and this warning was removed in https://github.com/facebook/react-native/pull/23195

This check is no longer necessary and we can reduce the overhead and improve the performance of View by removing this.

Reviewed By: rickhanlonii

Differential Revision: D15914658

fbshipit-source-id: 6456a9cb356245fa8104036b2948aa5c5bf39e0f
2019-06-20 18:29:41 -07:00
Eli White 2a4882e7e9 Using generated ViewConfigs for AndroidSwipeRefreshLayoutNativeComponent
Summary: $title

Reviewed By: rickhanlonii

Differential Revision: D15914074

fbshipit-source-id: 40fa6dcdf27b4fb88d936c439ba66a11e55966a9
2019-06-20 14:02:20 -07:00
Rick Hanlon f4fa539b8c Add android view props
Summary: Adds the view config props from android

Reviewed By: sahrens, shergin

Differential Revision: D15925354

fbshipit-source-id: 600dfbd9f77bde3323673c047c4461714d88d9d8
2019-06-20 12:45:44 -07:00
Peter Argany 7bb2ba5494 Flow typed & codegen RCTInputAccessoryViewNativeComponent
Summary: title

Reviewed By: rickhanlonii

Differential Revision: D15804045

fbshipit-source-id: 6969984441e9c87750abbc0a046fb7b447a78c91
2019-06-19 18:41:58 -07:00
Peter Argany b441ced5c5 Flow type and codegen for RCTProgressViewNativeComponent
Summary: title

Reviewed By: rickhanlonii

Differential Revision: D15821776

fbshipit-source-id: 332abc58d270875a1ee45f954b287ecaac1912ef
2019-06-19 18:41:57 -07:00
Peter Argany b83a573c7d Flow type and codegen AndroidProgressBarNativeComponent
Summary: title

Reviewed By: rickhanlonii

Differential Revision: D15822629

fbshipit-source-id: 2d4181a860ae351c217ca3fb67b1d3bfeb4476e1
2019-06-19 18:36:14 -07:00
Rick Hanlon ff5592cff4 Add paperComponentName and paperComponentNameDeprecated
Summary:
This diff removes an option from the codegen and replaces it with two new options

Removes:
- `isDeprecatedPaperComponentNameRCT`

Adds:
- `paperComponentName`: a better version of the removed option that allows more than just adding RCT
- `paperComponentNameDeprecated`: a new option that allows migrating native code to a new name

```
  // Use for components with no current paper rename in progress
  // Does not check for new name
  paperComponentName?: string,

  // Use for components currently being renamed in paper
  // Will use new name if it is available and fallback to this name
  paperComponentNameDeprecated?: string,
```

For example, Slider uses `paperComponentName: 'RCTSlider'` because it has a different name in fabric but is not currently being migrated to a new name. Because of other work in progress, we don't want to use UIManager check if we don't need to

Reviewed By: shergin

Differential Revision: D15857629

fbshipit-source-id: ca0d3b7dc4a75e00d136ae1f5c84f7423960399d
2019-06-19 09:56:04 -07:00
Rick Hanlon d789bb80c3 Revert D15780039: [RN Codegen] Add JS view config for View
Differential Revision:
D15780039

Original commit changeset: 1ec8ed1b57fd

fbshipit-source-id: d023e896dce9bb61e2e2ad6bd6babbeb973812a5
2019-06-17 11:29:45 -07:00
Rick Hanlon 6fef48096d Add JS view config for View
Summary: This diff adds the generated view config for View (in DEV)

Reviewed By: ejanzer

Differential Revision: D15780039

fbshipit-source-id: 1ec8ed1b57fd2341552746051980129848cb8e85
2019-06-17 10:50:13 -07:00
Cameron Bourke 6c5ddb027d make RCTMaskedView use generated view config
Summary:
### View Configs

(iOS only component)

Moving component `RCTMaskedViewNativeComponent` to use `generated view configs` instead of `requireNativeComponent`

 ---

### View Manager Migration List

Reviewed By: rickhanlonii

Differential Revision: D15822020

fbshipit-source-id: 9a4380fb5544ad69581c8aa3a3b2669503dd5141
2019-06-14 07:01:11 -07:00
Rubén Norte 5689302a6a Add RTCSafeAreaView
Summary: Adds codegen component for RTCSafeAreaView(NativeComponent).

Reviewed By: rickhanlonii

Differential Revision: D15804215

fbshipit-source-id: 103312aecb35029d05412b70829dbe4668ba7768
2019-06-14 03:16:54 -07:00
Rick Hanlon 942de57182 Add fix for react-native-gesture-handler
Summary: This diff fixes an issue with generated view configs due to react-native-gesture-handler adding events to view which are not in the view  config on javascript. These will need removed later when react-native-gesture-handler is updated for the new system

Reviewed By: fkgozali

Differential Revision: D15813596

fbshipit-source-id: 8914c093d9cb03e320406d154bb88abf557a951e
2019-06-13 15:32:02 -07:00
Rick Hanlon a3b9840885 Add Slider and Switch
Summary: This diff turns on codegen for Slider and Switch

Reviewed By: TheSavior

Differential Revision: D15738544

fbshipit-source-id: a0dfb5b05fd62f28fc3865855986e49598dd5e19
2019-06-11 05:06:42 -07:00
Christoph Nakazawa f8a400a53f Move ViewPagerAndroid JS code to FB Internal
Summary:
This module is being removed from React Native via Lean Core. This diff moves all the related JS files to FB internal.

Note: I removed two references to previously removed modules from some files in this diff. I hope you don't mind.

Reviewed By: TheSavior

Differential Revision: D15714919

fbshipit-source-id: 88ea406396b31f5c255e06d9c92b67127c81db4a
2019-06-11 00:29:27 -07:00
Rick Hanlon 5b7be95a1d Use generated view config for iOS Switch
Summary:
Adds a generated view config for iOS Switch

Note: this required some refactoring because the SwitchNativeComponent file included both iOS and android componets, so I broke them out into:

- AndroidSwitchNativeComponent (not generated)
- SwitchNativeComponent (generated)

The schema that we're using is for the  iOS version so that's the config that's generated here

Reviewed By: cpojer

Differential Revision: D15495402

fbshipit-source-id: 07b3bc9c780cbf8f6cbf66e976e15981cefcadfa
2019-06-10 03:34:13 -07:00
Rick Hanlon 2c1fd6f764 Add codegen flowtypes to UnimplementedNativeView
Summary:
This diff adds the generated view config for UnimplementedNativeView

Note: I believe this component was created in JS just for the codegen because it's unused anywhere

Reviewed By: cpojer

Differential Revision: D15494268

fbshipit-source-id: 8d17465fe59861a299b76565d6edbaf168f45906
2019-06-10 03:34:13 -07:00
Rick Hanlon 504fc0c7d0 Update flow parser to use codegenNativeComponent
Summary:
This diff updated the codegen flow types syntax replacing:

```
type Options = {
  isDeprecatedPaperComponentNameRCT: true,
};

type ActivityIndicatorNativeType = CodegenNativeComponent<
  'ActivityIndicatorView',
  NativeProps,
  Options,
>;

module.exports = ((requireNativeComponent(
  'RCTActivityIndicatorView',
): any): ActivityIndicatorNativeType);
```
with:

```
export default codegenNativeComponent<NativeProps>('ActivityIndicatorView', {
  isDeprecatedPaperComponentNameRCT: true,
});
```

This is from Tim's comment in the [View Config Codegen Quip](https://fb.quip.com/jR2aASHad4Se):

> What it CodegenNativeComponent were instead `NativeComponent.fromFlow<T>('…')` that returned `'...'`?
>And the Babel plugin swapped it for NativeComponent.fromSchema('...', {…}) which would both register and return '...'?

I went with `codegenNativeComponent` because it has nice parity with `requireNativeComponent`

I also didn't update the babel output here (we can update that whenever) because I think `registerGeneratedViewConfig` is more clear for what it's doing

Reviewed By: cpojer

Differential Revision: D15602077

fbshipit-source-id: 2d24dc32136ba6d31724f8c929b51417ba625a58
2019-06-07 12:31:36 -07:00
Rick Hanlon efec97f2be Add view config babel plugin
Summary:
This diff adds a babel plugin for the generated view configs which will inline them in the file instead of needing to check the view configs in (fb only)

The way it works is:
- babel reads the code
- looks for type alias `CodegenNativeComponent` in `*NativeComponet.js` files
- run the flow parser on the file source to create a schema
- run the schema into codegen to get the view config source code
- inject the generated source code back into the NativeComponent.js file
- remove the original export
- profit

After this diff we will remove the `js1 build viewconfigs` command and the checked-in NativeViewConfig.js files

Note: since this plugin is not published to open source, for now OSS will continue using the `requireNativeComponent` function

Reviewed By: cpojer

Differential Revision: D15516062

fbshipit-source-id: a8efb077773e04fd9753a7036682eeaae9175e09
2019-06-07 12:31:36 -07:00
Rick Hanlon 886fb501bd RN Codegen] Add registerGeneratedViewConfig
Summary:
This diff updated the format of generated view configs so that they don't need to spread View props into every config, by adding a new registerGeneratedConfig function which will spread them instead

This is a bit of a cleanup of the generated output but is primarily so that the view config babel plugin will not need to rely on object spreading or object.assigns

Reviewed By: TheSavior, cpojer

Differential Revision: D15517199

fbshipit-source-id: 08e575578177bad12d40ee3dcad9381974b6466d
2019-06-07 12:31:35 -07:00
Пётр Потапов d9a8ac5071 Fix: RefreshControl in FlatList makes borderWidth not working (#24411)
Summary:
Fixes #22752

On line 1021 you are passing base style to props:
`style: [baseStyle, this.props.style],`

Explicitly passing base style to ScrollView just overrides this line and doesn't let developers to customise style of any inheritors of ScrollView (not only FlatList) with custom RefreshControl.

So this line (1113) seems to be removed.

## Changelog

[GENERAL] [Fixed] - fix of Android's bug that doesn't let override ScrollView's Style with custom RefreshControl.
Pull Request resolved: https://github.com/facebook/react-native/pull/24411

Differential Revision: D15713061

Pulled By: cpojer

fbshipit-source-id: 461259800f867af15e53e0743a5057ea4528ae69
2019-06-07 02:47:47 -07:00
Kevin Gozali 723adad439 Reland "[react-native][PR] [TM] Add spec for UIManager"
Summary: Original commit changeset: dff59dc9c98b

Reviewed By: JoshuaGross

Differential Revision: D15579147

fbshipit-source-id: 77a58d2ab3324e243610c1a4d4ab794a7095b3ee
2019-05-31 12:58:56 -07:00
Petr Nikolaev b0254e8d3c Revert D15551356: [react-native][PR] [TM] Add spec for UIManager
Differential Revision:
D15551356

Original commit changeset: 076c4ce635aa

fbshipit-source-id: dff59dc9c98bc579851091855611ee5d973931d0
2019-05-31 06:36:09 -07:00
Eric Lewis a0879ce49f Add spec for UIManager (#24902)
Summary:
part of #24875. Because some of the methods are rewriteable, I dropped the `+` from the signature, this doesn't feel right to me, but I am not sure if the codegen requires that. If it does, it will probably be better to extend the spec and allow those specific methods to be overriden in a UIManager.js interface. Thoughts on that fkgozali or RSNara?

## Changelog

[General] [Added] - Add TM spec for UIManager
Pull Request resolved: https://github.com/facebook/react-native/pull/24902

Reviewed By: hramos

Differential Revision: D15551356

Pulled By: fkgozali

fbshipit-source-id: 076c4ce635aa7ea41e21cbd67c47ecd562fc320d
2019-05-30 21:05:11 -07:00
James Ide 33ee6f8b99 Add a lint rule to disallow Haste imports (#25058)
Summary:
This is an ESLint plugin that infers whether an import looks like a Haste module name. To keep the linter fast and simple, it does not look in the Haste map. Instead, it looks for uppercase characters in single-name import paths, since npm has disallowed uppercase letters in package names for a long time. There are some false negatives (e.g. "merge" is a Haste module and this linter rule would not pick it up) but those are about 1.1% of the module names in the RN repo, and unit tests and integration tests will fail anyway once Haste is turned off.

You can disable the lint rule on varying granular levels with ESLint's normal disabling/enabling mechanisms.

Also rewrote more Haste imports so that the linter passes (i.e. fixed lint errors as part of this PR).

## Changelog

[General] [Changed] - Add a lint rule to disallow Haste imports
Pull Request resolved: https://github.com/facebook/react-native/pull/25058

Differential Revision: D15515826

Pulled By: cpojer

fbshipit-source-id: d58a3c30dfe0887f8a530e3393af4af5a1ec1cac
2019-05-30 07:45:16 -07:00
Wojteg1337 08efb1d73b Add spec for AndroidToast (#24888)
Summary:
part of #24875

## Changelog

[General] [Added] - Add TM spec for AndroidToast
Pull Request resolved: https://github.com/facebook/react-native/pull/24888

Reviewed By: RSNara

Differential Revision: D15543043

Pulled By: fkgozali

fbshipit-source-id: 6636dd913f7c006704ead1aa92d37e42a4edf70e
2019-05-29 18:33:28 -07:00