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

17207 Коммитов

Автор SHA1 Сообщение Дата
Kevin Gozali 7143d89d81 Move TypeSafety conversion utils to github
Summary: This is utility for TurboModule codegen for the purpose of typesafety. It is not used anywhere else at the moment.

Reviewed By: cpojer

Differential Revision: D15929957

fbshipit-source-id: ecf68cc98b78bc5b9c2078492b853a677b625eea
2019-06-21 11:42:18 -07:00
Kevin Gozali 04180bf8ff Move FBLazyVector to github
Summary: FBLazyVector is a simple utility to help typesafety/codegen of TurboModule specs. This is not used widely elsewhere at the moment.

Reviewed By: hramos, cpojer

Differential Revision: D15929956

fbshipit-source-id: 17226351738335a74e7b931812a1ca901f47963f
2019-06-21 11:42:17 -07:00
Kevin Gozali 1e0c30cfdf BUCK: added rn_apple_library alias
Summary: Internally, this maps to internal wrapper, externally, this defaults to built-in apple_library.

Reviewed By: cpojer

Differential Revision: D15929954

fbshipit-source-id: c582e8b07f454e56fe02a6628c24df9c9c1dc186
2019-06-21 11:42:17 -07:00
Chris Blappert 6f310b5553 Remove old comments
Reviewed By: threepointone

Differential Revision: D15582763

fbshipit-source-id: 3185a578945a725083b08050880758c623b13875
2019-06-21 10:59:09 -07:00
Dan Abramov e81c1e3c7a Change top bar colors for Hot Reloading label
Summary: The current grey one is very bland, hard to read (no contrast) and often looks like a bug. I've changed it to match the iOS Personal Hotspot colors which look more idiomatic.

Reviewed By: cpojer

Differential Revision: D15941200

fbshipit-source-id: d60a3744c73675b40f42c329c2a44e6b8b0a93dc
2019-06-21 09:02:47 -07:00
Spencer Ahrens d7cbe3347b protect against hanging when logging nasty objects
Summary:
Logging nasty objects can cause RN to lockup as we try to format it nicely. The formatting code has some safegaurds against excessive recursion and some cycles, but it's not failsafe.

This adds a limit on the total number of times format can be called before we start to bail out. In my testing, this limit keeps the format time under ~100ms for huge objects, and logcat and other log readers start truncating it anyway so there is rarely any lost information.

I also considered using wall time, but this seemed a little cleaner. Open to suggestions.

Reviewed By: yungsters

Differential Revision: D15710157

fbshipit-source-id: b50261093270d6fb67b3473432d384ec51b98fd5
2019-06-21 07:43:52 -07:00
Dan Abramov acd349e35a Don't show "Hot Reloading" banner on first load
Summary:
D10527979 made the "update" message sequence part of initial connection signals. But the HMR client uses this sequence as a signal to show "Hot Reloading..." bar. As a result, we were showing it on every initial load when Hot Reloading is on. This is very confusing.

As a simple fix, I now send an explicit message to mark the end of the first load. I could infer that by first update message but figured this is more explicit and less likely to break. Until we receive `connection-done`, we now don't attempt to show the "Hot Reloading..." bar.

Reviewed By: rubennorte

Differential Revision: D15936085

fbshipit-source-id: b18b6aceea6c47d919b4265e58b21fc44f77b0b3
2019-06-21 06:04:19 -07:00
Dan Abramov d7c8ace001 Replace React Transform HMR with React Refresh
Summary:
This removes React Transform HMR in favor of the new React Refresh implementation. It should only affect the "Enable Hot Reloading" mode. In further diffs I will remove "React Transform HMR" completely.

This is technically a breaking change for Metro so it'll need a version bump.

Reviewed By: rickhanlonii, rubennorte

Differential Revision: D15903585

fbshipit-source-id: 074380b00868cb31857f599a03799d3584c35d87
2019-06-21 06:04:18 -07:00
Oleksandr Melnykov a15eecf6bd Back out "[RN][Android] Release underlying resources when JS instance is GC'ed on Android"
Summary:
Since Ads Manager for Android is crashing when a user tries to log in, I'm reverting D15826082 for now. Will investigate the reason of the crash later.

Crashlog: P67222724

Reviewed By: cpojer

Differential Revision: D15939152

fbshipit-source-id: bc1276e6057418821e1ebd90203bea586943b633
2019-06-21 05:28:43 -07:00
Christoph Nakazawa 17edd131eb Downgrade TextInput warning
Summary: See https://fb.workplace.com/groups/rn.core/permalink/2389524107945980/ for motivation

Reviewed By: rubennorte

Differential Revision: D15938804

fbshipit-source-id: 78f72ec24ddeca0d3a71497dd1931eff2df3c330
2019-06-21 04:15:06 -07:00
David Aurelio 52e4c8df6c Replace relative include
Summary: Replaces the relative include to `YGEnums.h` in `yoga/event/event.h` with `#include <yoga/YGEnums.h>

Reviewed By: SidharthGuglani

Differential Revision: D15778634

fbshipit-source-id: 2bceeb58f26c0d9d0df6c0e7ea20b8ddf68a1ee5
2019-06-21 04:09:52 -07:00
Guilherme Iscaro 4b9c99dff0 Protocol property of WebSocket object is undefined (#25273)
Summary:
Prior to this patch the websocket protocol was not being set when a connection
was opened, which could cause client libraries and apps to not work properly.
According to the [whatwg] spec the protocol must be set once the connection is
estabilished.

[whatwg]: https://html.spec.whatwg.org/multipage/web-sockets.html#feedback-from-the-protocol

## Changelog

[Javascript] [Fixed] - Properly set the this.protocol on WebSocket open
[Android] [Fixed] - Send the server chosen protocol to the WebSocket object
[iOS] [Fixed] - Send the server chosen protocol to the WebSocket object
Pull Request resolved: https://github.com/facebook/react-native/pull/25273

Test Plan:
In order to reproduce the issue you **need to install wampy@6.2.1**. Since **wampy@6.2.2** and newer contains a workaround for this react-native bug.

https://www.npmjs.com/package/wampy

```javascript
/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 *
 * format
 * flow
 */

import React, { Component } from 'react';
import { Platform, StyleSheet, Text, View } from 'react-native';
import Wampy from "wampy";

const instructions = Platform.select({
  ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
  android:
    'Double tap R on your keyboard to reload,\n' +
    'Shake or press menu button for dev menu',
});

type Props = {};

export default class App extends Component<Props> {
  state = {conState: 'Initializing...'};
  componentDidMount() {
    const url = "wss://demo.crossbar.io/ws";

    const ws = new Wampy(url, {
      realm: "crossbardemo",
      ws: WebSocket,
      debug: true,
      onConnect: () => {
        console.log("WAMP onConnect");
        this.setState({conState: 'Connected'});
      },
      onClose: () => {
        console.log("WAMP onClose");
        this.setState({conState: 'Connection closed'});
      },
      onError: () => {
        console.log("WAMP onError");
        this.setState({conState: 'Connection Error'});
      }
    });
  }

  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.message}>{this.state.conState}</Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  message: {
    fontSize: 20,
    color: 'black'
  },
});
```

Using the code above one must see the message **WAMP onConnect** on Console and **Connected** in the middle of the screen

Closes https://github.com/facebook/react-native/issues/24796

Differential Revision: D15938870

Pulled By: cpojer

fbshipit-source-id: 10a0a9b40c2a69e484ead37149abc2b1158a4ffc
2019-06-21 03:46:54 -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
Kacper Wiszczuk c52027baf7 Deprecate React Native ART (#25321)
Summary:
Since React Native ART has been extracted to community module, we can deprecate it in Core. You can find the community module [here](https://github.com/react-native-community/art).

## Changelog

[General] [Deprecate] - Deprecate React Native ART
Pull Request resolved: https://github.com/facebook/react-native/pull/25321

Test Plan:
Deprecation warning prints when user imports ART from react-native core module.

cc. cpojer

Differential Revision: D15938910

Pulled By: cpojer

fbshipit-source-id: d360fab6582c0d6c9064005246a012d2d5391c5c
2019-06-21 03:35:39 -07:00
Michał Pierzchała 86a97e7830 – Bring back autolinking to the iOS template (#25314)
Summary:
Bringing back iOS autolinking to the template after reverting: 261197d857 (commitcomment-33479829)

## Changelog

[iOS] [Added] – Bring back autolinking to the iOS template
Pull Request resolved: https://github.com/facebook/react-native/pull/25314

Test Plan: `test_ios_e2e` should still pass

Differential Revision: D15938862

Pulled By: cpojer

fbshipit-source-id: 4cd948b280a90229fd128b0f6901f7f89c647204
2019-06-21 03:13:38 -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
Janic Duplessis 1fb4b6caa0 Native Animated - Support events using RCT{Direct|Bubbling}EventBlock on iOS (#25317)
Summary:
Reland https://github.com/facebook/react-native/issues/15611 and added the gcc warning that was different from fb internal config. The original PR missed the static keyword for the `RCTNormalizeAnimatedEventName` function which triggered the gcc warning internally but not with the OSS xcode config.

When calling a prop of type `RCTDirectEventBlock` or `RCTBubblingEventBlock` it uses a completely different code path than events using `[RCTEventDispatcher sendEvent:]` and those were not dispatched to the `RCTEventDispatcherListener`s. We also do some event name normalization which caused issues between the JS and native event names. To fix that I simply remove the parts we normalize from the event key.

## Changelog:

[iOS] [Fixed] - Support events using RCT{Direct|Bubbling}EventBlock
Pull Request resolved: https://github.com/facebook/react-native/pull/25317

Test Plan: Added a Slider (it uses RCTBubblingEventBlock for its onValueChange event) that can control a native animated value in RNTester to reproduce the bug and made sure this diff fixes it.

Differential Revision: D15938856

Pulled By: cpojer

fbshipit-source-id: 7e7a3459e2a2e8b1254a2f1ec8153a159ea73eed
2019-06-21 03:05:59 -07:00
aamalric d010fc3bf4 Add key action info to Android EventHandler events. (#25300)
Summary:
Add event key action for Android EventHandler events, helps to know if the key event is a up (key release, value is 1) or down (key pressed, value is 0) action.

## Changelog

[ANDROID] [ADDED] - Add event key action to EventHandler events.
Pull Request resolved: https://github.com/facebook/react-native/pull/25300

Test Plan: No test added

Differential Revision: D15897484

Pulled By: cpojer

fbshipit-source-id: fdb3d5413d9da3dd5f46d41e31ac60f0b341f3eb
2019-06-21 03:00:32 -07:00
Sidharth Guglani fc82c59be7 Send measure pass duration
Summary: Send measure callback duration time to yoga plugin

Reviewed By: davidaurelio

Differential Revision: D15917548

fbshipit-source-id: 2c947f14ddbc5932cedd0aab8622260478ec29a6
2019-06-21 02:33:02 -07:00
Dan Abramov 5d29590cd4 Update renderer and packages
Summary:
This pulls in the latest package updates for Fresh. It doesn't have any user-observable behavior.

The renderer is rebuilt on top of the last cherry-picked sync. I cherry-picked https://github.com/facebook/react/pull/15928 on top of it.

Reviewed By: rickhanlonii

Differential Revision: D15901887

fbshipit-source-id: ccd974f79e4c0a2a8a8cab0d472deeaedf1e3ddd
2019-06-20 21:18:46 -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
Luna Wei 122acca759 StickerViewNativeComponent
Summary:
view config RCTStickerViewNativeComponent

had to get one view config in before I left London lol

Reviewed By: rickhanlonii

Differential Revision: D15825774

fbshipit-source-id: 846d9ee1d15f6ec64d88a1af7b72fd863ae10afc
2019-06-20 15:09:00 -07:00
Joshua Gross 40043a175e Animations: attempt to mitigate crashes in T43628589
Summary: Trying to mitigate animation-related crashes in T43628589. Clues: all the crashes are off the main thread, and most operations in this class happen explicitly in blocks executed on the main thread. I think there's a category of race conditions caused by animations not being allocated yet when this code runs / being deallocated as it's running. We shouldn't need to add locks if everything just runs on the main thread.

Reviewed By: PeteTheHeat

Differential Revision: D15924310

fbshipit-source-id: d82f5434e53fd394c4a7548d52f59a0f63961779
2019-06-20 15:00:21 -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
Eli White 09fe15910e Android SwipeRefreshLayout now supports strings for size
Summary:
Previously SwipeRefreshLayout (RefreshControl on Android) required taking an int as the size. This required a complex dance of pulling these constant values off of the native view config. As we are going to stop sending view configs from native and instead hardcode them in JS we can't do that anymore.

We will change the type of size from:
```
size?: ?(
  | typeof RefreshLayoutConsts.SIZE.DEFAULT
  | typeof RefreshLayoutConsts.SIZE.LARGE
),
```

to:
```
size?: ?('default' | 'large')
```

In this commit we are supporting the old style as well as the new style. The old way of specifying the sizes will go away in a future release.

Changelog:
[Android] [Added] - RefreshControl now supports strings and not just numbers for size.

Reviewed By: mdvacca

Differential Revision: D15909582

fbshipit-source-id: 1849edc980e1698de147e88d710e0f28d0fdc8d8
2019-06-20 10:58:27 -07:00
Kudo Chien cbf1b39c66 Fix Android Picker ArrayOutOfBoundsException during Picker.Item update from a long list (#25276)
Summary:
axe-fb reported this side effect from my previous commit in https://github.com/facebook/react-native/pull/24793#issuecomment-502202082
After revisited the implementation of Android Spinner, it seems the formal way to update existing adapter is mutating it, i.e. `arrayAdapter.clear()` & `arrayAdapter.addAll()` to update a Spinner Adapter.
`setAdapter()` will reset everything including `mDataChanged`.
A race condition may happens between rendering a long picker list and reseting adapter.
Here is a code snippet: https://snack.expo.io/kudochien/80f810
To reproduce the issue, please select large item (e.g. 500) first and click the button right hand side.
Please not to verify this on Expo directly in the meantime, because Expo with RN 0.59 does not include my previous commit.

## Changelog

[Android] [Fixed] - Fix Picker ArrayOutOfBoundsException during Picker.Item update from a long list
Pull Request resolved: https://github.com/facebook/react-native/pull/25276

Test Plan:
1. Check the test case https://snack.expo.io/kudochien/80f810 will have exception or not.
2. Regression of https://snack.expo.io/Sy1JClEag from https://github.com/facebook/react-native/issues/13351
3. Regression of https://snack.expo.io/kudochien/android-picker-issue from https://github.com/facebook/react-native/issues/22821
4. RNTester Picker example

Reviewed By: mdvacca

Differential Revision: D15857426

Pulled By: axe-fb

fbshipit-source-id: 8ef902447fdd1b8aeab50ad061545cd14c735e51
2019-06-20 07:48:20 -07:00
Oleksandr Melnykov 3a8b988cb2 Release underlying resources when JS instance is GC'ed on Android
Summary:
[Android] [Added] - Release underlying resources when JS instance is GC'ed on Android

D15279651 introduced a crash for Oculus Twilight on Android (T45199437), so it was reverted by D15611385.

This diff fixes the crash and re-applies D15279651. The problem was that ProGuard renamed BlobModule.remove() to BlobModule.release(), but the C++ code in `BlobCollector.cpp` still expected the old name. I confirmed this by looking at the Extracted Symbols file for the build which introduces the crash (https://fburl.com/mobile/ud40od3i):

```
com.facebook.react.modules.blob.BlobModule -> com.facebook.react.modules.blob.BlobModule:
...
8190:8193:void remove(java.lang.String):190:193 -> release
...
```

See the full log file here: https://fburl.com/pn02bwkb.

The solution is to annotate the method with `DoNotStrip` so that ProGuard doesn't rename it.

Reviewed By: mdvacca, cpojer

Differential Revision: D15826082

fbshipit-source-id: f7470d394666cd34c1acae5c6ffaecc84d5ca5a3
2019-06-20 02:49:19 -07:00
Rick Hanlon 8253f90967 Bump babel plugin version to break metro cache
Reviewed By: ejanzer

Differential Revision: D15904504

fbshipit-source-id: 8ea7437156d1bfebaeec3a5dcfccadaad728400b
2019-06-20 02:43:15 -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
Valentin Shergin 044176925b Fabric: Disabling RN_SHADOW_TREE_INTROSPECTION
Summary:
It's unclear why, but the introspection infra is enabled somehow in prod.
It must be some kind of misconfiguration somewhere. Until we figure it now, we have to disable it completly.

Reviewed By: mdvacca

Differential Revision: D15908765

fbshipit-source-id: 2b17c61938731d43eaef51b070a4ec1ae9e5e1df
2019-06-19 18:07:11 -07:00
Rick Hanlon 503df2c69a Move scheduler to dependencies
Summary: Fixes https://github.com/react-native-community/releases/issues/116#issuecomment-503449687

Reviewed By: gaearon

Differential Revision: D15901557

fbshipit-source-id: 653119c181585cf9a4a561b350c66bd10cb674bd
2019-06-19 12:01:04 -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
Moti Zilberman 56f08fcf84 Pop bridge frames from errors thrown by sync host function calls
Summary:
When a synchronous call from JS to native code throws an error, it doesn't include a useful stack trace from the native side. To improve error attribution, this diff pops the frames in `MessageQueue.js` and `NativeModules.js` from the stack traces of such errors. This uses the `error.framesToPop` convention understood by RN's global error handler.

For now we limit this to errors converted from C++ exceptions in host functions, since those are not likely to ever contain further JavaScript frames at the point where we catch them; if they did, it would violate our assumption that the top two frames of the stack are in the JS bridge code.

Reviewed By: cwdick

Differential Revision: D15805054

fbshipit-source-id: 8c1dd7c81b00b6a88e31473271889af1f88f7263
2019-06-19 09:15:14 -07:00
Moti Zilberman 37bbfa663d Add test for sync methods (type=sync)
Summary: Adds a test for synchronous methods (`type === 'sync'`) in NativeModules. This doesn't modify any behaviour.

Reviewed By: amnn

Differential Revision: D15804757

fbshipit-source-id: 4db76dbd0b0b111ed9311d4b7ec35a077c377f01
2019-06-19 09:15:14 -07:00
Moti Zilberman 88e9098a64 Preserve the caller's JS stack trace when a type=promise method rejects
Summary: TSIA

Reviewed By: cwdick

Differential Revision: D15802451

fbshipit-source-id: db31ddf697afe54c22bc2c16254a6231497d5c3f
2019-06-19 09:15:14 -07:00
Moti Zilberman d216b55ef5 Add test for promise-returning methods (type=promise)
Summary: Adds a test for promise-returning methods (`type === 'promise'`) in `NativeModules`. This doesn't modify any behaviour.

Reviewed By: cwdick

Differential Revision: D15802452

fbshipit-source-id: 8dc1f862d33742ef4ba355ca36338e0dbabf8edb
2019-06-19 09:15:14 -07:00
Moti Zilberman 0f92984eba Strengthen ModuleConfig Flow typing
Summary:
Types the last 3 members of the `ModuleConfig` tuple (functions, promise method IDs, and sync method IDs) as nullable and immutable arrays. This is in line with how they are used in the code; one debug-only call site had to be fixed to account for nullability.

Also updates the test data in `MessageQueueTestConfig` to explicitly conform to this type.

Reviewed By: amnn

Differential Revision: D15899159

fbshipit-source-id: b6955ba92efc73253de48e2ce7c3034fa91adce3
2019-06-19 09:15:13 -07:00
Dan Abramov 7f1a38af8f React sync (partial)
Summary:
This isn't a full sync. It only includes cherry-picked commits for Fresh, as well as previously cherry-picked commits during last two syncs.

Changes that are already synced:

* https://github.com/facebook/react/pull/15604
* https://github.com/facebook/react/pull/15786
* https://github.com/facebook/react/pull/15802

New changes:

* 5be064b591
* 6b6d8fa183
* 92bcf2a63c
* 7b4c2f7ede
* 39a3f2f160
* cabdebb3b7
* a277671412
* 86aad18a66
* 25b3e07039
* ffee2957e2
* a817bc5462
* abb2f0fbaf
* 2e20d9ed81
* 5d3502448c
* 6628573cb9
* 5815bfff8c

**This might look like a lot but note that very few of these actually touch the renderer code.** Most affect integration tests and `react-refresh` package which **has already been synced separately**.

So this is about getting in a few renderer changes that were included in those commits. That's very self-contained.

The renderer source diff is this: https://gist.github.com/gaearon/ddbda5845b4dba0d9915e2ed7f7b11e2. You can also see that in prod bundles below there's only one meaningful change (`type` used instead of `elementType`) which in that case is equivalent.

Reviewed By: rickhanlonii

Differential Revision: D15898205

fbshipit-source-id: 19619f4ff01f24765613f19e826b0199485d81bb
2019-06-19 07:54:28 -07:00
Anton Domashnev 0f03086e72 Revert D15896806: [react-native][PR] Native Animated - Support events using RCT{Direct|Bubbling}EventBlock on iOS
Differential Revision:
D15896806

Original commit changeset: c0ae463f4c3f

fbshipit-source-id: be534e8abe5fa0d7afb4f05012f32db00774fc65
2019-06-19 02:57:44 -07:00
Janic Duplessis 083f835c9f Native Animated - Support events using RCT{Direct|Bubbling}EventBlock on iOS (#15611)
Summary:
When calling a prop of type `RCTDirectEventBlock` or `RCTBubblingEventBlock` it uses a completely different code path than events using `[RCTEventDispatcher sendEvent:]` and those were not dispatched to the `RCTEventDispatcherListener`s. We also do some event name normalization which caused issues between the JS and native event names. To fix that I simply remove the parts we normalize from the event key.

## Changelog:

[iOS] [Fixed] - Support events using RCT{Direct|Bubbling}EventBlock
Pull Request resolved: https://github.com/facebook/react-native/pull/15611

Test Plan: Added a Slider (it used RCTBubblingEventBlock for it's onValueChange event) that can control a native animated value in RNTester to reproduce the bug and made sure this diff fixes it.

Differential Revision: D15896806

Pulled By: cpojer

fbshipit-source-id: c0ae463f4c3f890062238575e813ed7ab3b7a7e6
2019-06-19 01:42:54 -07:00
Kevin Gozali a89e9323fc Cache Platform constants in JS
Summary: For better perf with TurboModule, cache the return value of NativePlatformConstants*.getConstants() in JS so that we avoid going back into native (from JS) for each call. This specific method is called very frequently throughout RN codebase.

Reviewed By: mdvacca

Differential Revision: D15893289

fbshipit-source-id: ce8016ed7d3efb420df93e27dbfa77d7d4f06cf8
2019-06-18 23:10:50 -07:00
Valentin Shergin 99ece27897 Fabric: Setting up correct `pointScaleFactor` in `Binding::startSurface`
Summary: Previously, we didn't provide any LayoutContext to the very first commit (aka startSurface); apparently it causes problems.

Reviewed By: mdvacca

Differential Revision: D15891472

fbshipit-source-id: b2a785bdad5764eb97b41f5bf5679807107bd8a0
2019-06-18 19:35:35 -07:00
Kevin Gozali e6f28bb4f7 Android TM: create TurboModuleManager earlier
Summary: Some TM lookup from native will fail assertion if done too early, because TM Manager is not initialized yet.

Reviewed By: mdvacca

Differential Revision: D15872776

fbshipit-source-id: 7616c1424816f73a45aa1d9723e7807ae10392a7
2019-06-18 16:22:17 -07:00
Kevin Gozali 2df90738d5 Android: Use enum type for looking up JSIModule's
Summary:
To avoid unnecessary class loads, and better modularity, let's use string keys (enum) to access JSIModule's. For now all JSIModule's are all known inside the core infra (only FabricUIManager and TurboModuleManager right now), so let's keep it simple and explicitly list them out.

The only problem here is we lose some form of type safety...

Reviewed By: JoshuaGross

Differential Revision: D15872777

fbshipit-source-id: 9c2de7ef1e88ef3a6dff5888d644f9d8963af2a3
2019-06-18 16:22:17 -07:00
Emily Janzer 0d971f97d5 Fix weird formatting in FabricUIManager
Summary: I added this function in D15810990, not sure why lint didn't complain about this...

Reviewed By: zackargyle

Differential Revision: D15880129

fbshipit-source-id: 4d207ba26be46186dc3904c82d82a4a83d4d4eb7
2019-06-18 12:09:47 -07:00
Valentin Shergin 6f97733bb8 Fabric: Changing `ComponentName` type alias from `std::string` to `char *`
Summary:
ComponentName is used by many core component of React Native, such as ComponentDescriptor, ShadowNode, ShadowView and so on. In all those cases this value represents the actual name of the component which came from `concreteComponentName` template parameter of ConcreteShadowNode. In all of those cases, it's raw `char const *` type. So, we don't need to use owning representation of the string (std::string) in all those places.

The only exception from this is a part where we receive the name of the component from JS side. In this case, the source string comes from JS and has to be analyzed as a character sequence to find corresponding ComponentDescriptor.

In my experiments, 20% of the time during diffing is spent on copying (this) `std::string`.

Reviewed By: mdvacca

Differential Revision: D15844407

fbshipit-source-id: a2e71505e22d09107e001bdf661d4a826bcf2dea
2019-06-18 11:31:20 -07:00