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

16153 Коммитов

Автор SHA1 Сообщение Дата
Héctor Ramos d4ce8463a8 React sync for revisions f24a0da...8e25ed2
Summary:
This sync includes the following changes:

- **[8e25ed20b](https://github.com/facebook/react/commit/8e25ed20b )**: Unify noop and test renderer assertion APIs (#14952) //<Andrew Clark>//
- **[870214f37](https://github.com/facebook/react/commit/870214f37 )**: Deprecate ref.setNativeProps in favor of ReactNative.setNativeProps (#14912) //<Eli White>//
- **[3989c0950](https://github.com/facebook/react/commit/3989c0950 )**: eslint-plugin-react-hooks@1.3.0 //<Dan Abramov>//
- **[1bbfbc98d](https://github.com/facebook/react/commit/1bbfbc98d )**: [ESLint] Add more cases to exhaustive-deps rule (#14930) //<Dan Abramov>//
- **[412f88296](https://github.com/facebook/react/commit/412f88296 )**: fix(eslint-plugin-react-hooks): node engine updated to version 7 because of object.entries(#14951) //<Farhad Yasir>//
- **[ba708fa79](https://github.com/facebook/react/commit/ba708fa79 )**: Remove ReactNoop.flushDeferredPri and flushUnitsOfWork (#14934) //<Andrew Clark>//
- **[920b0bbb3](https://github.com/facebook/react/commit/920b0bbb3 )**: [scheduler] Pass didTimeout argument to callbacks (#14931) //<Andrew Clark>//
- **[f99fca3cb](https://github.com/facebook/react/commit/f99fca3cb )**: Fix sample ESLint configuration (#14926) //<Matt Thomson>//
- **[22bb94764](https://github.com/facebook/react/commit/22bb94764 )**: Release eslint-plugin-react-hooks@1.2.0 //<Dan Abramov>//
- **[a77bbf1a1](https://github.com/facebook/react/commit/a77bbf1a1 )**: [ESLint] Warn against assignments from inside Hooks (#14916) //<Dan Abramov>//
- **[219ce8a9c](https://github.com/facebook/react/commit/219ce8a9c )**: Fix tracing fixture (#14917) //<Dan Abramov>//
- **[8c1966590](https://github.com/facebook/react/commit/8c1966590 )**: Release 16.8.3 //<Dan Abramov>//
- **[7de4d2391](https://github.com/facebook/react/commit/7de4d2391 )**: Fix UMD builds by re-exporting the scheduler priorities (#14914) //<Dan Abramov>//
- **[d0318fb3f](https://github.com/facebook/react/commit/d0318fb3f )**: Updating copyright headers, dropping the year (#14893) //<Nathan Hunzaker>//
- **[f978d5fde](https://github.com/facebook/react/commit/f978d5fde )**: Fix warning message for new setNativeProps method. on -> with (#14909) //<Eli White>//
- **[b0f45c0fc](https://github.com/facebook/react/commit/b0f45c0fc )**: Adding ReactNative.setNativeProps that takes a ref (#14907) //<Eli White>//
- **[4f4aa69f1](https://github.com/facebook/react/commit/4f4aa69f1 )**: Adding setNativeProps tests for NativeMethodsMixin (#14901) //<Eli White>//
- **[b96b61dc4](https://github.com/facebook/react/commit/b96b61dc4 )**: Use the canonical nativeTag for Fabric's setNativeProps (#14900) //<Eli White>//
- **[dab2fdbbb](https://github.com/facebook/react/commit/dab2fdbbb )**: Add eslint-plugin-react-hooks/exhaustive-deps rule to check stale closure dependencies (#14636) //<Dan Abramov>//
- **[1493abd7e](https://github.com/facebook/react/commit/1493abd7e )**: Deleted empty App.css (#14149) //<Josh R>//
- **[13645d224](https://github.com/facebook/react/commit/13645d224 )**: Deal with fallback content in Partial Hydration (#14884) //<Sebastian Markbåge>//
- **[c506ded3b](https://github.com/facebook/react/commit/c506ded3b )**: Don't discard render phase state updates with the eager reducer optimization (#14852) //<Dan Abramov>//
- **[0e67969cb](https://github.com/facebook/react/commit/0e67969cb )**: Prompt to include UMD build artifact links in GitHub release (#14864) //<Brian Vaughn>//
- **[fad0842fd](https://github.com/facebook/react/commit/fad0842fd )**: Release scripts documentation (#14863) //<Brian Vaughn>//
- **[ab7a67b1d](https://github.com/facebook/react/commit/ab7a67b1d )**: Fix react-dom/server context leaks when render stream destroyed early (#14706) //<overlookmotel>//
- **[3e5556043](https://github.com/facebook/react/commit/3e5556043 )**: Release 16.8.2 //<Dan Abramov>//
- **[dfabb77a9](https://github.com/facebook/react/commit/dfabb77a9 )**: Include another change in 16.8.2 //<Dan Abramov>//
- **[c555c008b](https://github.com/facebook/react/commit/c555c008b )**: Include component stack in 'act(...)' warning (#14855) //<Sunil Pai>//
- **[ff188d666](https://github.com/facebook/react/commit/ff188d666 )**: Add React 16.8.2 changelog (#14851) //<Dan Abramov>//
- **[c4d8ef643](https://github.com/facebook/react/commit/c4d8ef643 )**: Fix typo in code comment (#14836) //<Deniz Susman>//
- **[08e955435](https://github.com/facebook/react/commit/08e955435 )**: Statically enable suspense/partial hydration flag in www (#14842) //<Sebastian Markbåge>//
- **[0e4135e8c](https://github.com/facebook/react/commit/0e4135e8c )**: Revert "[ShallowRenderer] Queue/rerender on dispatched action after render component with hooks (#14802)" (#14839) //<Dan Abramov>//
- **[6d4038f0a](https://github.com/facebook/react/commit/6d4038f0a )**: [ShallowRenderer] Queue/rerender on dispatched action after render component with hooks (#14802) //<Rodrigo Ribeiro>//
- **[fa6205d52](https://github.com/facebook/react/commit/fa6205d52 )**: Special case crossOrigin for SVG image elements (#14832) //<Brandon Dail>//
- **[c6bee765b](https://github.com/facebook/react/commit/c6bee765b )**: Remove false positive warning and add TODOs about `current` being non-null (#14821) //<DanAbramov>//
- **[3ae94e188](https://github.com/facebook/react/commit/3ae94e188 )**: Fix ignored sync work in passive effects (#14799) //<Dan Abramov>//
- **[f3a14951a](https://github.com/facebook/react/commit/f3a14951a )**: Partial Hydration (#14717) //<Sebastian Markbåge>//

Changelog:

[GENERAL] [Changed] React sync for revisions f24a0da...22bb947

Reviewed By: gaearon

Differential Revision: D14160361

fbshipit-source-id: fffdc922f3ee5dfeeee656a8f213a6d3c03e8481
2019-02-27 07:57:19 -08:00
David Aurelio 537ed61d94 Breaking remove `YogaNode#clone`
Summary:
@public

The cloning features of YogaNode don’t seem to be used. Let’s remove them.

Reviewed By: SidharthGuglani

Differential Revision: D14165624

fbshipit-source-id: 5b710964a4abf1b35f3bcc25b143ffc719a03cec
2019-02-27 05:03:12 -08:00
Valentin Shergin 9207377058 Fabric: State-related mounting logic for iOS
Summary: The changes allows to get the State object on mounting layer and initiate the updates.

Reviewed By: mdvacca

Differential Revision: D14217185

fbshipit-source-id: 370644e06e350932e93c39adbe46544b071c28b3
2019-02-27 00:32:25 -08:00
Valentin Shergin 802534e611 Fabric: Introducting State, an escape path from unidirectional data flow
Summary:
In React Native there are several use cases where React State is not the only input that affects the component tree. E.g., in case of a <Modal> component, the screen size directly affects the layout of components inside modal; in the case of uncontrolled <TextInput> component, the text inside the input affects the layout of the surrounding components. `State` is a special (legit!) workaround for all those similar cases. Native part of React Native maintains a special shared object between all nodes of the same family and use that during cloning and commits.

See coming commits to know how to use that.

In the near future State will fully replace LocalData concept but for simplicity they both exist for now.

Reviewed By: mdvacca

Differential Revision: D14217184

fbshipit-source-id: 6e018c5b68208d662462013bce0f4e2733d2f673
2019-02-27 00:32:25 -08:00
Valentin Shergin b9107084f7 Fabric: Small refactoring in EventQueue
Summary:
A couple of small changes:
  1. `onEnqueue` was decoupled from `enqueueEvent` for easier and unified overiding in subclasses (other methods will call `onEnqueue` soon);
  2. `flushEvents` was decoupled from `onBeat` (we will put more stuff into `onBeat` soon).

Reviewed By: mdvacca

Differential Revision: D14205769

fbshipit-source-id: 574c2b2caaa6432bc7782b2f3bc147fa1fb82bd3
2019-02-27 00:32:25 -08:00
Valentin Shergin 104ef96498 Fabric: LayoutConstraints::clamp()
Summary: `LayoutConstraints::clamp` clamps the provided `Size` between the `minimumSize` and `maximumSize` bounds of this `LayoutConstraints`.

Reviewed By: mdvacca

Differential Revision: D14205770

fbshipit-source-id: 4799608cead393451d334e47dd6906255699a1e8
2019-02-27 00:32:25 -08:00
Joshua Gross 3c1114eea7 Enable Slider component
Summary:
Enable Slider component in Fabric on Android.

{F151706188}

Reviewed By: mdvacca

Differential Revision: D14220147

fbshipit-source-id: 10b29112e950c8de98cba995839780c4f4e8d3b6
2019-02-26 14:40:58 -08:00
Joshua Gross 57afad1c1f RCTCameraRollManager: fix "all" photos filter
Summary: Currently, trying to fetch "all" photos will loop and never complete. Now it appears to produce the expected results (acting like the "All Photos" smart library in Photos) and doesn't loop. Confirmed console log results, showing no loops: P60994983

Reviewed By: PeteTheHeat

Differential Revision: D14221545

fbshipit-source-id: 31381b1ba2c673fd210cb95f3b7d0f8ffc23ec3f
2019-02-26 11:29:56 -08:00
Maël Nison b13d59d901 Adds missing dependencies to rn
Summary:
The following stack is meant to fix all "unsatisfied peer dependencies" that I could find in xplat/js.

Starting from Yarn v2 such problems will become much more noticeable, as they currently behave in unpredictable ways that can include the peer dependency being satisfied by a random package from the dependency tree. The v2 will enforce well-defined relationships between packages.

In this case, RN was missing some dependency required by `babel-preset-fbjs` through peer dependencies.

Reviewed By: pvdz

Differential Revision: D14136856

fbshipit-source-id: 5a7eeee913ebfe63573353683c152ad5512a66e3
2019-02-26 09:42:11 -08:00
zhongwuzw f3ad49be67 Fixed placeholder font not consistent with text's font when in multiline mode (#23654)
Summary:
Placeholder's font not consistent with text's font, it leads to cursor dislocation. We need to keep consistent between placeholder and text.

[iOS] [Fixed] - Fixed placeholder font not consistent with text's font when in multiline mode
Pull Request resolved: https://github.com/facebook/react-native/pull/23654

Differential Revision: D14226174

Pulled By: hramos

fbshipit-source-id: 7cfb3b73d8799d22d5cbbfe557df8de3f5fcf034
2019-02-26 09:36:45 -08:00
zhongwuzw 06c6c7c673 Remove compatible system code for iOS8 and before (#23656)
Summary:
We already only support `iOS9+`, so we can remove all compatible codes now.

[iOS] [Fixed] - Remove compatible system code for iOS8 and before
Pull Request resolved: https://github.com/facebook/react-native/pull/23656

Differential Revision: D14224986

Pulled By: hramos

fbshipit-source-id: cac9ffe6788dd3eaf4f4f5f2b219f325ba78e85f
2019-02-26 07:58:52 -08:00
Masayuki Iwai 58c956768a Update _scrollAnimatedValue offset of ScrollViews. (#19481)
Summary:
`_scrollAnimatedValue` offset of ScrollView is set once in `UNSAFE_componentWillMount` but it is never updated.
It causes unexpected render result.

![rn-scrollview-fix1](https://user-images.githubusercontent.com/143255/40640292-61843eca-6350-11e8-9412-f5383ea65ea0.gif)

So I suggest to update `_scrollAnimatedValue` offset when ScrollView contentInset is updated.
Pull Request resolved: https://github.com/facebook/react-native/pull/19481

Differential Revision: D14223304

Pulled By: cpojer

fbshipit-source-id: 4191cfcf6414adf3a0abd156517d5f9778565671
2019-02-26 01:42:28 -08:00
Christoph Nakazawa 14d9b2d68d Remove ListView and SwipeableListView from React Native
Summary:
This diff removes ListView and SwipeableListView from React Native:
* Removes the code and all examples
* Removes the exports on `react-native-implementation` but leaves an error message in dev mode only
* Uses `deprecated-react-native-listview` for `ListView` and `deprecated-react-native-swipeable-listview` for `SwipeableListView`

Both ListView and SwipeableListView are now fully removed from React Native in open source and we will continue to use the deprecated packages internally.

Reviewed By: TheSavior

Differential Revision: D14181708

fbshipit-source-id: 5030c33791f998567de058fee934449c16fa1d54
2019-02-25 22:40:10 -08:00
gengjiawen 4ba304dda5 extract jest config from package.json (#23638)
Summary:
Make package.json slimmer.

[General] [Changed] - Move Jest config outside of package.json
Pull Request resolved: https://github.com/facebook/react-native/pull/23638

Differential Revision: D14212028

Pulled By: cpojer

fbshipit-source-id: 5d5961eb47b04cc2cc2eeaf6b1cafdc156883bc1
2019-02-25 21:49:10 -08:00
zhongwuzw 9ac219e077 fix getter of result from Image query cache (#23602)
Summary:
We assume `map` is the type of `Map`, but actually it's not, so we would get type error.

[iOS] [Fixed] - [RNTester] fix getter of result from Image query cache
Pull Request resolved: https://github.com/facebook/react-native/pull/23602

Differential Revision: D14221747

Pulled By: cpojer

fbshipit-source-id: 06cf08078a330e4d5731ad72010c87e9e69fcd7b
2019-02-25 20:34:44 -08:00
Valentin Shergin 9a64755a18 Fabric: `events` module was merged into `core` module
Summary: That's bummer that we have to do it, but it's actually reasonable. Files in `core` and `events` depend on each other creating circular dependencies and other similar hard problem.

Reviewed By: mdvacca

Differential Revision: D14195022

fbshipit-source-id: 96a44ae28631cc9ccd7d7de72a94526f9e0dd12a
2019-02-25 19:12:08 -08:00
Luna Wei 4cf70306b9 Use cached react tag versus id on view
Summary: Due to the way (initial) surface implementation plays with ReactRootView (RRV), the react tag from the UIManagerModule is now set on the surface container view rather than on RRV as it was historically done. RRV still caches the react tag but just doesn't use it as an id on the view so `RRV.getViewId()` no longer equals `RRV.getReactTag()`.

Reviewed By: mdvacca

Differential Revision: D14110104

fbshipit-source-id: 6dbcc41c85fd7a6c32c7250f68f4a84bed4e075a
2019-02-25 17:25:42 -08:00
David Vacca 19765c9b8c update props during pre allocation of views
Summary:
This diff changes the pre-allocation of Images update the props on the ImageViews during the creation of ShadowNodes instead of during rendering.

The purpose of this change is to optimize TTI.

Reviewed By: shergin

Differential Revision: D14214844

fbshipit-source-id: b81005f2bf494f62f421dc24846e1561e13b9a87
2019-02-25 17:21:24 -08:00
David Vacca 4859b1a126 Remove unused variables
Summary: Trivial diff to remove unused variables

Reviewed By: fkgozali

Differential Revision: D14214843

fbshipit-source-id: ace624bafce12c9ee6ce02051d684e581e78fe2c
2019-02-25 17:21:24 -08:00
ericlewis 78b167c735 Call super if shouldDisableScrollInteraction false (#23647)
Summary:
Allow iOS to handle `touchesShouldCancelInContentView` on RCTScrollView if we aren't disabling the scroll interaction.

[iOS] [Changed] - RCTScrollView allows iOS to handle touchesShouldCancelInContentView
Pull Request resolved: https://github.com/facebook/react-native/pull/23647

Differential Revision: D14214248

Pulled By: hramos

fbshipit-source-id: 6e1bab3085aed6cabb93fb5dc988afe3911817e8
2019-02-25 14:35:17 -08:00
ericlewis 918620bdcb Fix xcode warnings (#23648)
Summary:
Fixes yet more Xcode warnings.

[iOS] [Fixed] - Xcode warnings
Pull Request resolved: https://github.com/facebook/react-native/pull/23648

Differential Revision: D14214231

Pulled By: hramos

fbshipit-source-id: 050ab8519ca77941894b650b1c56bfcbe86e2c69
2019-02-25 14:30:39 -08:00
Albert Sun 24b9889fb2 Location (iOS): Call back on requests only if they pass age and accuracy filters
Summary:
iOS pretty much always immediately updates location with the last cached location. This leads to the getCurrentPosition() API often returning this stale location. This change adds filtering to keep waiting until CLLocationManager provides a location fix that passes the requirements for each pending request.

This is potentially breaking in that clients that rely upon getCurrentPosition being extremely fast may find that location fixes take longer than before. However in such cases they should relax their requirements for maximumAge and/or accuracy.

Reviewed By: mmmulani

Differential Revision: D13889626

fbshipit-source-id: f566314ed5968151dad0839b99e0d3c9a562af13
2019-02-25 14:21:36 -08:00
ericlewis 6f9e47839d Fix unused param warnings (#23642)
Summary:
Fixes unused warnings in RNTesterUnitTests.

[iOS] [Fixed] - Fixes unused warnings in RNTesterUnitTests.
Pull Request resolved: https://github.com/facebook/react-native/pull/23642

Differential Revision: D14212036

Pulled By: hramos

fbshipit-source-id: 4c7ab2b0d6129267fc62dff7d8bcb394acd670ab
2019-02-25 12:59:34 -08:00
Spencer Ahrens ea54ceca13 basic useNativeDriver functionality
Summary:
Not super clean, but not terrible.

Unfortunately this still relies on the old Paper UIManager calling delegate methods to flush the operations queues. This will work for Marketplace You since Paper will be active, but we need to fix this, along with Animated Events which don't work at all yet.

Random aside: it seems like taps are less responsive in fabric vs. paper, at least on iOS. There is a sporadic delay between the touches event coming in nativly to the JS callback invoking the native module function to start the animation - this will need some debugging.

Reviewed By: shergin

Differential Revision: D14143331

fbshipit-source-id: 63a17eaafa1217d77a532a2716d9f886a96fae59
2019-02-25 12:25:34 -08:00
Valentin Shergin 53e15c9e95 Fabric: `event/primitive.h` was splitted into several files
Summary: It's handy to have all in one file but it also make it hard/impossible to fight with circular dependencies, so I had to slit it.

Reviewed By: mdvacca

Differential Revision: D14188546

fbshipit-source-id: 20809f1ea227c6f8f32922ed5760226248b718e3
2019-02-25 12:21:01 -08:00
Valentin Shergin af1808de69 Fabric: RootShadowNode::clone() fix
Summary:
The previous implementation of the method cloned the root node twice (one time at the very end of the method and one time at the end of loop body).
The new one does it once and a bit more readable.

Reviewed By: mdvacca

Differential Revision: D14187969

fbshipit-source-id: 9859deadd4b041ac115c37108188aab70200c75d
2019-02-25 12:21:01 -08:00
Valentin Shergin 30141e230d Fabric: Clone function for RootShadowNode
Summary:
RootShadowNode does not have ComponentDescriptor counterpart (because it cannot be created via UIManager) and we used to always clone it manually.
However, apparently, some algorithms (e.g. clone algorithm inside RootShadowNode, which is used by setNativeProps) require valid clone function associated with the node.
So, we implement it.

Reviewed By: JoshuaGross

Differential Revision: D14187762

fbshipit-source-id: a9b6b332a18583217ff0e4f9c15aea0ffb113ba2
2019-02-25 12:21:01 -08:00
Valentin Shergin e00f62022e Fabric: More flexible definition of ConcreteViewShadowNode
Summary:
The ConcreteViewShadowNode was changed to be independend of actual amount of template arguments of ConcreteShadowNode.
We will use it soon.

Reviewed By: JoshuaGross

Differential Revision: D14187761

fbshipit-source-id: b4c8051e2ae3803932713b0c255492466e80d3bd
2019-02-25 12:21:01 -08:00
Pim de Witte 7c4dbd617d Prop to disable the default pan responder on ScrollView that blocks touches when snapToInterval is enabled (#19110)
Summary:
The ScrollView component seems to have been written for a default touch up / touch down scrolling behavior. However, when using snapToInterval, this default behavior of adding PanResponders while the ScrollView is animating or has an active touch causes bugs with the PanResponder hijacking touches it is not supposed to hijack.
Pull Request resolved: https://github.com/facebook/react-native/pull/19110

Differential Revision: D14071342

Pulled By: hramos

fbshipit-source-id: ac285d9967dd6e2a347943b2455d4f986062ef62
2019-02-25 12:14:19 -08:00
ericlewis fd3db03427 Update openUrl (#23640)
Summary:
Fix deprecation with openUrl, handles feedback in #17011.

[iOS] [Fixed] - openUrl deprecation
Pull Request resolved: https://github.com/facebook/react-native/pull/23640

Differential Revision: D14211015

Pulled By: hramos

fbshipit-source-id: 9c8fa9f61aaa14542af9456dc39f6bfabd6a1405
2019-02-25 11:42:18 -08:00
ericlewis cd7cc7d640 Fix deadstore in RCTSpringAnimation (#23643)
Summary:
Fixes an unused storage of variable.

[iOS] [Fixed] - Fix deadstore in RCTSpringAnimation
Pull Request resolved: https://github.com/facebook/react-native/pull/23643

Differential Revision: D14211089

Pulled By: hramos

fbshipit-source-id: 640d46be25f03d766698f6e85490c7d1a6a019fc
2019-02-25 11:36:56 -08:00
ericlewis b758d63bc9 Fix image scaling (#23641)
Summary:
An updated version of: #22009, this compares the correct image size.

[iOS] [Fixed] - Compare network image sizes correctly
Pull Request resolved: https://github.com/facebook/react-native/pull/23641

Differential Revision: D14210991

Pulled By: hramos

fbshipit-source-id: 079053ef4a8f0e62da6eead9afc8de9285b35966
2019-02-25 11:31:55 -08:00
Sergei Dryganets 972f39985a This change fixes currently broken ReactContext listeners mechanism. (#22318)
Summary:
This mechanism is heavily abused inside of the react-native and inside of the various native modules.
The main problem is that people don't remove their listeners and as result, we have memory leaks.

Some modules like UIManager, NativeAnimatedModule have resources holding Activity context. Those modules are held through a pretty long chain of dependencies.

In order to allow GC to collect those listeners, I replaced the CopyOnWriteSet by WeakHashMap and synchronized access. It is not such a big deal in terms of performance as those listeners are not called/modified too frequently but this prevents hard to debug memory leaks.

Changelog:
----------
Help reviewers and the release process by writing your own changelog entry. When the change doesn't impact React Native developers, it may be ommitted from the changelog for brevity. See below for an example.

[Android] [Fixed] - ReactContext - lifecycle listeners don't cause the leaks even if not removed.

Pull Request resolved: https://github.com/facebook/react-native/pull/22318

Reviewed By: mdvacca

Differential Revision: D13106915

Pulled By: hramos

fbshipit-source-id: d506e5035a7f7bea1b57a6308fb5d9b5fcb277a7
2019-02-25 08:06:22 -08:00
yukai1 b2d3052de7 ModalHostView's child view can not fill screen (#18615)
Summary:
Signed-off-by: yukai <yk3372@gmail.com>

In some Android device such as Samsung S8, the ModalHostView's child view can't fill the screen.
before:
![before](https://user-images.githubusercontent.com/1514899/38024961-3e756f8e-32b9-11e8-9555-50a7cf778288.jpeg)
The JS ModalHostView can't fill the bottom, the area is device's navigation bar.

In class ModalHostShadowNode, follow code calculate is error:
`Point modalSize = ModalHostHelper.getModalHostSize(getThemedContext());`
This way not care the device's navigation bar, so the height is smaller than real.
For Samsung S8, real height is 2220 and modalSize.y is 2076.
Pull Request resolved: https://github.com/facebook/react-native/pull/18615

Differential Revision: D14206830

Pulled By: cpojer

fbshipit-source-id: abe35ce1ab253aa1472d2c798543b515218be445
2019-02-25 01:18:42 -08:00
August Lilleaas a8449c14ac Allow ReactActivityDelegate subclass to overrride mainComponentName (#19814)
Summary:
Currently, the final field mMainComponentName is used. This field is
initialized in the constructor of ReactActivityDelegate, and the
ReactActivityDelegate itself is initialized in the constructor of
ReactActivity. This means that the only way you can pass a main
component name to ReactActivityDelegate, is when your ReactActivity
subclass is constructed. At this point in the lifecycle of an
activity, the getIntent() value that the activity was initialized by
returns null, making it impossible to set the mainComponentName
dynamically based on data passed to the activity via an intent.

The mMainComponentName final field is also only used in onCreate of
the delegate, so it's not actually needed by the ReactActivityDelegate
at construction time. So the above limitation is not fundamental, it's
just a side effect of the API design.

By allowing subclasses of ReactActivityDelegate to implement a
getMainComponentName method, the subclass then has full control of how
to initialize the value. So an implementation of getMainComponentName
could be:

    public String getMainComponentName() {
        return getIntent().getStringExtra("reactMainComponentName");
    }

This commit doesn't remove anything and only adds a new method, so it
should be fully backwards compatible.

Thank you for sending the PR! We appreciate you spending the time to work on these changes.
Help us understand your motivation by explaining why you decided to make this change.

<!--
  Required: Write your motivation here.
  If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->
Pull Request resolved: https://github.com/facebook/react-native/pull/19814

Differential Revision: D14206644

Pulled By: cpojer

fbshipit-source-id: 8532560f944362fe0cce263a7f9a503df8ae539f
2019-02-25 00:40:11 -08:00
Takeru Chuganji b664dfdae3 iOS: Resolve a build warning for 32bit devices (#19416)
Summary:
<!--
  Required: Write your motivation here.
  If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->

This PR resolves a warning `Implicit conversion loses floating-point precision: 'double' to 'CGFloat' (aka 'float')` when building not only this library **but also apps** for 32bit devices since it's declared in public header file.
Pull Request resolved: https://github.com/facebook/react-native/pull/19416

Differential Revision: D14206633

Pulled By: cpojer

fbshipit-source-id: a65a4774235fa7fb24fac2f9bf7e51ba2a027377
2019-02-25 00:07:51 -08:00
zhongwuzw 7a7eb11965 Fix textAttributes not applied when typing text (#23585)
Summary:
Currently, if we has `defaultValue`, textAttributes like `letterSpacing` can works, but if textinput has not default text, when we typing the text, some attributes not applied.

[iOS] [Fixed] - Fix textAttributes not applied when typing text
Pull Request resolved: https://github.com/facebook/react-native/pull/23585

Differential Revision: D14206568

Pulled By: cpojer

fbshipit-source-id: 7db276d811684bf6e01f8d30287cca80095db87c
2019-02-24 23:37:41 -08:00
Guillaume Hain 8d2e8fdca4 macOS : request interactive input when killing the packager (#19663)
Summary:
Do not request interactive input when running on a CI

When I'm running the build on my CI server, many Terminal windows are remaining on the server because of the `read` command.

This PR prevent this behaviour when the `CI` environment variable is defined so that it doesn't alter the behaviour on local machines.
Pull Request resolved: https://github.com/facebook/react-native/pull/19663

Differential Revision: D14206458

Pulled By: cpojer

fbshipit-source-id: 476067ebebb07c6e708469fa8829a06e05c58200
2019-02-24 22:48:17 -08:00
zhongwuzw 5bc9c9b014 Add Image query cache result type (#23608)
Summary:
In iOS, seems we have no ways to check wether the cached item is from disk or memory, only `storagePolicy == NSURLCacheStorageAllowedInMemoryOnly ` we can think it's from memory. So we need to add a new result like `disk/memory`?

[iOS] [Added] - Add Image query cache result type
Pull Request resolved: https://github.com/facebook/react-native/pull/23608

Differential Revision: D14205902

Pulled By: cpojer

fbshipit-source-id: 29c253878b5c6776cd4776508e24c57e6bfa7dfa
2019-02-24 21:59:50 -08:00
zhongwuzw d2ac9a0698 Fixed deprecated declarations warning (#23625)
Summary:
Fixed deprecated declarations warning.
cc cpojer .

[iOS] [Fixed] - Fixed deprecated declarations warning
Pull Request resolved: https://github.com/facebook/react-native/pull/23625

Differential Revision: D14205929

Pulled By: cpojer

fbshipit-source-id: 5e46f7f598ab1080b93923dcc25c98e1cd4362cd
2019-02-24 19:38:58 -08:00
Wei Yang b9d3743cda add talkback navigation support for links and header (#22447)
Summary:
1. add role description for heading
2. add talkback navigation support for link and header

Fixes #22440
Pull Request resolved: https://github.com/facebook/react-native/pull/22447

Differential Revision: D14205822

Pulled By: cpojer

fbshipit-source-id: 86bfc3bfc851f3544b1962012abaf8d1a357a9d2
2019-02-24 19:25:51 -08:00
David Vacca 2e42cc7652 optimize calls to updateRootLayoutSpecs
Summary: This diff changes the onMeasure method of the RootView to optimize the amount of times we call updateRootLayoutSpecs in Fabric

Reviewed By: shergin

Differential Revision: D14198155

fbshipit-source-id: ff2deee04540899c25d4e38b0bd93333f74c6ace
2019-02-24 11:58:47 -08:00
David Vacca daccb54353 Add new performance metric in Fabric
Summary: This diff adds a new metric in Fabric to measure time it takes to Fabric finish transaction in CPP

Reviewed By: shergin

Differential Revision: D14198153

fbshipit-source-id: 987d1db1ae669906192060cc9b9e077901da6787
2019-02-24 11:58:47 -08:00
David Vacca 10679a97c3 Temporarily remove optimization of updateRootLayoutSpecs
Summary: revert D14142305

Reviewed By: shergin

Differential Revision: D14198154

fbshipit-source-id: 2f2b2b6e0c0d64b71dc720b3d934c348600e0367
2019-02-24 11:58:47 -08:00
Héctor Ramos 39ecd5642d Annotate our CircleCI config (#23606)
Summary:
Inspired by [react-native-netinfo's config](https://github.com/react-native-community/react-native-netinfo/blob/master/.circleci/config.yml). Annotate each of the major sections in our Circle CI config to reduce friction when contributing to our open source test infrastructure.

I've also removed all single-use aliases. While the old layout improved readability when looking at a particular job, it also obscured the actual command being run, as well as introduced unnecessary friction (contributors would need to understand how aliases work, syntax is finicky).

I've also moved the oss sanity checks to the analysis job, as we don't want this test to block the checkout_code job from succeeding, which would block all other downstream jobs.

There should be no other material changes to the actual jobs.

[General] [Changed] - Updated open source test configuration
Pull Request resolved: https://github.com/facebook/react-native/pull/23606

Differential Revision: D14199783

Pulled By: hramos

fbshipit-source-id: 61072eec5c05b8731916a9d8f6bc09ae5191fbb5
2019-02-23 17:04:22 -08:00
Dulmandakh 0b4f74176c add nullable annotations to some ViewManager methods (#23610)
Summary:
Add nullable annotations to BaseViewManager and ViewManager methods. This will improve Kotlin developer experience and help Android Studio to offer better autocomplete.

[Android] [Changed] - add nullable annotations to BaseViewManager and ViewManager methods. Might break ViewManagers in Kotlin.
Pull Request resolved: https://github.com/facebook/react-native/pull/23610

Differential Revision: D14198630

Pulled By: mdvacca

fbshipit-source-id: c596c88254e1d02f0af233a466f685200fac8917
2019-02-23 10:07:31 -08:00
Nate Hunzaker 0d5aebbd9a Use existing character set in POST body when possible (#23603)
Summary:
This commit fixes a bug introduced in a previous attempt (https://github.com/facebook/react-native/pull/23580) to address an issue where okhttp appended `charset=utf-8` to the Content-Type header when otherwise not specified.

In that commit, I converted all characters to UTF-8, however it should instead use an existing encoding when possible.

Related issues:
https://github.com/facebook/react-native/issues/8237#issuecomment-466304854

[Android][fixed] - Respect existing character set when specified in fetch() POST request
Pull Request resolved: https://github.com/facebook/react-native/pull/23603

Differential Revision: D14191750

Pulled By: hramos

fbshipit-source-id: 11c1bfd98ccd33cd8e54ea426285b7d2ce9c2d7c
2019-02-22 16:20:49 -08:00
Chris Sarbora c1349b5960 Rename makeCriticalNativeMethod to discourage over-use
Summary: "Critical" or "Fast" JNI methods are enticing by their name, but carry dangers that are not trivially visible.

Reviewed By: davidaurelio

Differential Revision: D14184560

fbshipit-source-id: 89ec70f53bb2cb89ff568d8b1fe222ede86c9824
2019-02-22 14:29:45 -08:00
David Vacca 8928358108 optimize updateRootLayoutSpecs to not call setContraints if they did not change
Summary: This diff avoids calling mBinding.setConstraints when the measurespecs haven't changed

Reviewed By: shergin

Differential Revision: D14142305

fbshipit-source-id: 6770c97dcf0fb23c605a90fb6c3311d2fb771d11
2019-02-22 13:51:30 -08:00
David Vacca 1aa279d78b Force updateRootLayoutSpecs to run synchronously
Summary: This diff makes updateRootLayoutSpecs to run synchronously on any thread instead of schedulling this to run in the JS thread

Reviewed By: shergin

Differential Revision: D14142306

fbshipit-source-id: 746f9c51f13e6d987fd9bca35a7c502cc8622f7b
2019-02-22 13:51:30 -08:00