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

16688 Коммитов

Автор SHA1 Сообщение Дата
zhongwuzw 12d58d431a Update rncore podspec to exclude codegen test files (#24513)
Summary:
Related bddd9c7d59. Exclude these tests files from podspec.

cc. cpojer

[iOS] [Fixed] - Update rncore podspec to exclude codegen test files
Pull Request resolved: https://github.com/facebook/react-native/pull/24513

Differential Revision: D14996897

Pulled By: rickhanlonii

fbshipit-source-id: 28b29f24f482ed678f15c44c5c579ced97ea651f
2019-04-18 09:30:51 -07:00
Valentin Shergin 832164169d Fabric: Unification of registration process of `ComponentView`s and `ComponentDescriptor`s
Summary:
Registries, providers, providers of registries, registres of providers. All that can be really confusing, but that represents best the constraints and desires that we have:
* We need to be able to register components on-the-fly (so we need a mechanism that will propagate changes);
* We don't want to register ComponentDescriptors separately from ComponentView classes;
* C++ not always gives us abstractions that we want (e.g. pointers to constructors).

After the change, we can remove the whole Buck target that has a bunch of handwritten boilerplate code.

There is a still room for polish and removing some concepts, types or classes but this diff is already huge.

Reviewed By: JoshuaGross

Differential Revision: D14983906

fbshipit-source-id: ce536ebea0c905059c7a4d644dc25233e2809761
2019-04-17 22:44:20 -07:00
Valentin Shergin 00eab3d6fb Fabric: Introducing ComponentDescriptorProvider
Summary:
ComponentDescriptorProvider represents unified way to create a particular descriptor.
Now all ComponentViews (which support RCTComponentViewProtocol) expose a `ComponentDescriptorProvider` which will allow creating and registering ComponentDescriptor instances for all visual components automatically as a part of ComponentView registration process.
Don't panic, everything is still being as explicit as it always was, no magic involved; we just will have only one registration step instead of two parallel.

That also opens a way to register components on the fly.

Reviewed By: JoshuaGross

Differential Revision: D14963488

fbshipit-source-id: 9e9d9166fabaf7b30b35b8647faa6e3a19cd2435
2019-04-17 22:44:20 -07:00
Marc Horowitz 0735873fbc Make isInspectable safe to call from any thread
Summary: The bridge was not properly isolating isInspectable onto the JS thread.

Reviewed By: fkgozali

Differential Revision: D14991970

fbshipit-source-id: 92a06c90bade8f92bfa81fa3b7dfb23b17db6117
2019-04-17 21:23:19 -07:00
Kevin Gozali 1149d85b9f iOS RNTester: install SampleTurboModule regardless
Summary: This installs the sample module to the RNTester.xcodeproj without using any TurboModule infra. This is possible because SampleTurboModule is backward compatible with the existing NativeModules system. This also fixes CI test failure: https://circleci.com/gh/facebook/react-native/84752

Reviewed By: RSNara

Differential Revision: D14987572

fbshipit-source-id: f5f2c4330c7f6558c7d4beeb43198869090dee02
2019-04-17 16:37:49 -07:00
Spencer Ahrens efe6a0f0b5 make sure onLayout calls _updateViewableItems immediately
Summary:
Makes sure `onViewableItemsChanged` fires ASAP when `waitForInterations` is false.

This also works around another deeper bug where updates scheduled with `InteractionManager` aren't firing at all in some cases, and thus instead of just firing late, `onViewableItemsChanged` isn't firing until scroll which is not what we want with `waitForInterations: false`. That bug will require more digging.

Differential Revision: D14984333

fbshipit-source-id: 718b39670307c6bc16268759bdb513682745265d
2019-04-17 14:27:17 -07:00
Radovan Šmitala 30a0ce27b1 Move Yargs to devDependencies (#24496)
Summary:
Yargs package is used only in test scripts and script for bumping version.
Based on this https://github.com/facebook/react-native/search?q=yargs&unscoped_q=yargs Yargs is not really required in production build and should be moved as development dependency.

[General] [Changed] - Moved Yargs to devDepencies
Pull Request resolved: https://github.com/facebook/react-native/pull/24496

Differential Revision: D14982834

Pulled By: cpojer

fbshipit-source-id: 81b6be413b2037e1b852cba91f4a2c04267ae930
2019-04-17 13:56:10 -07:00
Rick Hanlon 62bac80f90 Fix metro websocket reconnect logic
Summary:
This diff fixes the reconnect logic with the metro websockets which is causing the app to not re-connect when metro crashes. To demonstrate the issue, consider the following video:

{F156029086}

On the left we have metro, on the right is the xcode console with some logging to show the reconnecting phase. When we kill the metro server you can see the app tries to reconnect once and that's it - when metro is started back up, you can see the notification that there are no apps running and can also see that cmd+opt+r doesn't work anymore

I updated the logic to optimistically start the connection and if it's still unavailable to retry again after the timeout

[iOS][Fixed] - Metro websocket reconnect logic

Reviewed By: shergin

Differential Revision: D14961433

fbshipit-source-id: 0569aa169dc9f538a7e4a8d04e99de39f2e9b3f9
2019-04-17 13:39:21 -07:00
Valentin Shergin 45ae1e4411 Fabric: `[]`-family of methods was removed from ComponentDescriptorRegistry
Summary:
Motivation:
 * We don't use them much, and we already have `at`-methods, which are better.
* We don't want to expose `ComponentDescriptor`s as shared pointers (because it's not clear, not so performant, and because we don't want to store them as shared pointer in the future);
* In idiomatic C++ `[]` operator has mutating semantic, that's not what we want to communicate via the interface of the class.

Reviewed By: sahrens

Differential Revision: D14963487

fbshipit-source-id: dbfddee2ba90d70c3bb8dcf1959d553571c47bab
2019-04-17 13:39:20 -07:00
Eli White 83c0d025f1 React sync
Summary:
This sync includes the following changes:
- **[1b2159acc](https://github.com/facebook/react/commit/1b2159acc )**: [React Native] measure calls will now call FabricUIManager (#15324) //<Eli White>//
- **[c7a959982](https://github.com/facebook/react/commit/c7a959982 )**: [React Native] Add tests to paper renderer for measure, measureLayout (#15323) //<Eli White>//
- **[aece8119c](https://github.com/facebook/react/commit/aece8119c )**: Refactor EventComponent logic + add onOwnershipChange callback (#15354) //<Dominic Gannaway>//
- **[183d1f42e](https://github.com/facebook/react/commit/183d1f42e )**: Fix: Measure expiration times relative to module initialization (#15357) //<Andrew Clark>//
- **[b4bc33a58](https://github.com/facebook/react/commit/b4bc33a58 )**: Fix areHookInputsEqual method  warning params order (#15345) //<砖家>//
- **[29fb5862f](https://github.com/facebook/react/commit/29fb5862f )**: Move EventComponent state creation to complete phase + tests (#15352) //<Dominic Gannaway>//
- **[745baf2e0](https://github.com/facebook/react/commit/745baf2e0 )**: Provide new jsx transform target for reactjs/rfcs#107 (#15141) //<Ricky Vetter>//
- **[81a61b1d1](https://github.com/facebook/react/commit/81a61b1d1 )**: React events: add delay props to Press module (#15340) //<Nicolas Gallagher>//
- **[4064ea9fa](https://github.com/facebook/react/commit/4064ea9fa )**: Experimental event API: Support EventComponent onUnmount responder callback (#15335) //<Dominic Gannaway>//
- **[4fbbae8af](https://github.com/facebook/react/commit/4fbbae8af )**: Add full TouchHitTarget hit slop (experimental event API) to ReactDOM (#15308) //<Dominic Gannaway>//
- **[958b6173f](https://github.com/facebook/react/commit/958b6173f )**: Add delay props to Hover event module (#15325) //<Nicolas Gallagher>//
- **[c3cc936da](https://github.com/facebook/react/commit/c3cc936da )**: Add Hover,Focus,Press docs to REAMDE (#15328) //<Nicolas Gallagher>//
- **[49595e921](https://github.com/facebook/react/commit/49595e921 )**: [New Scheduler] Fix: Suspending an expired update (#15326) //<Andrew Clark>//
- **[b93a8a9bb](https://github.com/facebook/react/commit/b93a8a9bb )**: Experimental event API: refactor responder modules for lifecycle inclusion (#15322) //<Dominic Gannaway>//
- **[937d262f5](https://github.com/facebook/react/commit/937d262f5 )**: React events: keyboard press, types, tests (#15314) //<Nicolas Gallagher>//
- **[7a2dc4853](https://github.com/facebook/react/commit/7a2dc4853 )**: Allow DevTools to toggle Suspense fallbacks (#15232) //<Dan Abramov>//
- **[43b1f74c8](https://github.com/facebook/react/commit/43b1f74c8 )**: Alternate fix for #14198 //<Andrew Clark>//
- **[41aa345d2](https://github.com/facebook/react/commit/41aa345d2 )**: Fix a crash in Suspense with findDOMNode //<Dan Abramov>//
- **[6d0effad7](https://github.com/facebook/react/commit/6d0effad7 )**: Expose extra internals in FB build of react-dom/unstable-new-scheduler (#15311) //<Andrew Clark>//
- **[3a44ccefe](https://github.com/facebook/react/commit/3a44ccefe )**: Fix feature flags react-dom/unstable-new-scheduler (#15309) //<Andrew Clark>//
- **[92a1d8fea](https://github.com/facebook/react/commit/92a1d8fea )**: mark react-events as private so we publish script skips it for now (#15307) //<Sunil Pai>//
- **[e5c59359c](https://github.com/facebook/react/commit/e5c59359c )**: Prevent bundling of Node polyfills when importing TestUtils/TestRenderer (#15305) //<Dan Abramov>//
- **[73187239a](https://github.com/facebook/react/commit/73187239a )**: writing unit tests in experimental event Drag API (#15297) //<Behzad Abbasi>//
- **[89064fe68](https://github.com/facebook/react/commit/89064fe68 )**: Adds displayName to EventComponent and EventTarget (#15268) //<Dominic Gannaway>//
- **[fc6a9f1a1](https://github.com/facebook/react/commit/fc6a9f1a1 )**: Add test for async event dispatching (#15300) //<Nicolas Gallagher>//
- **[38fa84088](https://github.com/facebook/react/commit/38fa84088 )**: Experiemental event API - wrap async dispatched events (#15299) //<Dominic Gannaway>//
- **[4d5cb64aa](https://github.com/facebook/react/commit/4d5cb64aa )**: Rewrite ReactFiberScheduler for better integration with Scheduler package (#15151) //<Andrew Clark>//
- **[aed0e1c30](https://github.com/facebook/react/commit/aed0e1c30 )**: await act(async () => ...) (#14853) //<Sunil Pai>//
- **[4c75881ee](https://github.com/facebook/react/commit/4c75881ee )**: Remove maxDuration from tests (#15272) //<Sebastian Markbåge>//
- **[9307932fe](https://github.com/facebook/react/commit/9307932fe )**: Refactor event object creation for the experimental event API (#15295) //<Dominic Gannaway>//
- **[6a1e6b2f7](https://github.com/facebook/react/commit/6a1e6b2f7 )**: Experimental event API: loosen EventTarget constraints and warnings (#15292) //<Dominic Gannaway>//
- **[f243deab8](https://github.com/facebook/react/commit/f243deab8 )**: Add tests for Press responder event module (#15290) //<Nicolas Gallagher>//
- **[296c4393d](https://github.com/facebook/react/commit/296c4393d )**: Add Press event prop types and fix a check in Safari (#15288) //<Nicolas Gallagher>//
- **[4482fdded](https://github.com/facebook/react/commit/4482fdded )**: Fix host context issues around EventComponents and EventTargets (#15284) //<Dominic Gannaway>//
- **[5ef0d1d29](https://github.com/facebook/react/commit/5ef0d1d29 )**: Rename hover props in experimental event API and write unit tests (#15283) //<Behzad Abbasi>//
- **[9444a5472](https://github.com/facebook/react/commit/9444a5472 )**: Warn on nested EventTragets in experimental event API (#15287) //<Dominic Gannaway>//
- **[7f1f5ddc3](https://github.com/facebook/react/commit/7f1f5ddc3 )**: Rename press props in experimental event API (#15263) //<Nicolas Gallagher>//
- **[2e02469fa](https://github.com/facebook/react/commit/2e02469fa )**: ReactNative's ref.measureLayout now takes a ref (#15126) //<Eli White>//
- **[1b94fd215](https://github.com/facebook/react/commit/1b94fd215 )**: Make setNativeProps a no-op with Fabric renderer (#15094) //<Eli White>//
- **[08055a625](https://github.com/facebook/react/commit/08055a625 )**: Fix Press module in experimental event API (#15262) //<Nicolas Gallagher>//
- **[f4625f518](https://github.com/facebook/react/commit/f4625f518 )**: Fix on(Long)PressChange events in experimental press event API (#15256) //<Nicolas Gallagher>//
- **[a41b21770](https://github.com/facebook/react/commit/a41b21770 )**: Add additional event API responder surfaces (#15248) //<Dominic Gannaway>//
- **[700f17be6](https://github.com/facebook/react/commit/700f17be6 )**: Fix longpress in experimental Press event module (#15246) //<Nicolas Gallagher>//
- **[5d336df70](https://github.com/facebook/react/commit/5d336df70 )**: Allow for null targetFiber for root event handling (#15247) //<Dominic Gannaway>//
- **[c6f3524df](https://github.com/facebook/react/commit/c6f3524df )**: Adds React event component and React event target support to SSR renderer (#15242) //<Dominic Gannaway>//
- **[c7a2dce50](https://github.com/facebook/react/commit/c7a2dce50 )**: Disable JS urls at build level for www (#15230) //<Sebastian Markbåge>//
- **[fb6b50871](https://github.com/facebook/react/commit/fb6b50871 )**: Update versions for 16.8.6 //<Dan Abramov>//
- **[1cfd25668](https://github.com/facebook/react/commit/1cfd25668 )**: Fix circular module imports causing file size increase (#15231) //<Dominic Gannaway>//
- **[669cafb36](https://github.com/facebook/react/commit/669cafb36 )**: Adds experimental event component responder surfaces (#15228) //<Dominic Gannaway>//
- **[d8cb10f11](https://github.com/facebook/react/commit/d8cb10f11 )**: Enabled warnAboutDeprecatedLifecycles flag by default (#15186) //<Brian Vaughn>//
- **[80f8b0d51](https://github.com/facebook/react/commit/80f8b0d51 )**: Add part of the event responder system for experimental event API (#15179) //<Dominic Gannaway>//
- **[5c2b2c085](https://github.com/facebook/react/commit/5c2b2c085 )**: Warn about async infinite useEffect loop (#15180) //<Dan Abramov>//
- **[8e9a013c0](https://github.com/facebook/react/commit/8e9a013c0 )**: Release 16.8.5 //<Dan Abramov>//
- **[f33e5790b](https://github.com/facebook/react/commit/f33e5790b )**: eslint-plugin-react-hooks@1.6.0 //<Dan Abramov>//
- **[b1cccd1ed](https://github.com/facebook/react/commit/b1cccd1ed )**: Warn about setState directly in dep-less useEffect (#15184) //<Dan Abramov>//
- **[78f2775ed](https://github.com/facebook/react/commit/78f2775ed )**: Flip event passive logic on passiveBrowserEventsSupported (#15190) //<Dominic Gannaway>//
- **[f161ee2eb](https://github.com/facebook/react/commit/f161ee2eb )**: React.warn() and React.error() (#15170) //<Brian Vaughn>//
- **[78968bb3d](https://github.com/facebook/react/commit/78968bb3d )**: Validate useEffect without deps too (#15183) //<Dan Abramov>//
- **[4b8e1641b](https://github.com/facebook/react/commit/4b8e1641b )**: Fork performWork instead of using boolean flag (#15169) //<Sebastian Markbåge>//
- **[56035dac6](https://github.com/facebook/react/commit/56035dac6 )**: unstable_Profiler -> Profiler (#15172) //<Brian Vaughn>//
- **[31518135c](https://github.com/facebook/react/commit/31518135c )**: Strengthen nested update counter test coverage (#15166) //<Dan Abramov>//
- **[66f280c87](https://github.com/facebook/react/commit/66f280c87 )**: Add internal logic for listening to event responders (#15168) //<Dominic Gannaway>//
- **[b1a56abd6](https://github.com/facebook/react/commit/b1a56abd6 )**: Fork ReactFiberScheduler with feature flag //<Andrew Clark>//
- **[45f571736](https://github.com/facebook/react/commit/45f571736 )**: ReactFiberScheduler -> ReactFiberScheduler.old //<Andrew Clark>//
- **[c05b4b81f](https://github.com/facebook/react/commit/c05b4b81f )**: Link to useLayoutEffect gist in a warning (#15158) //<Dan Abramov>//
- **[061d6ce3c](https://github.com/facebook/react/commit/061d6ce3c )**: fix(react-dom): access iframe contentWindow instead of contentDocument (#15099) //<Renan Valentin>//
- **[b83e01cad](https://github.com/facebook/react/commit/b83e01cad )**: Adds more scaffolding for experimental event API (#15112) //<Dominic Gannaway>//
- **[daeda44d8](https://github.com/facebook/react/commit/daeda44d8 )**: Follow up to 15150 (#15152) //<Dominic Gannaway>//
- **[acd65db5b](https://github.com/facebook/react/commit/acd65db5b )**: Deprecate module pattern (factory) components (#15145) //<Sebastian Markbåge>//
- **[55cc921c5](https://github.com/facebook/react/commit/55cc921c5 )**: Adds react-events package for internal testing (#15150) //<Dominic Gannaway>//
- **[7ad738630](https://github.com/facebook/react/commit/7ad738630 )**: Improve warning for invalid class contextType (#15142) //<Dan Abramov>//
- **[1e3364e76](https://github.com/facebook/react/commit/1e3364e76 )**: Test that we don't suspend when disabling yielding (#15143) //<Sebastian Markbåge>//
- **[42c3c967d](https://github.com/facebook/react/commit/42c3c967d )**: Compile invariant directly to throw expressions (#15071) //<Andrew Clark>//
- **[df7b87d25](https://github.com/facebook/react/commit/df7b87d25 )**: Warn for Context.Consumer with contextType (#14831) //<Brandon Dail>//
- **[2b93d686e](https://github.com/facebook/react/commit/2b93d686e )**: Add more info to invalid hook call error message (#15139) //<Jared Palmer>//
- **[d926936f0](https://github.com/facebook/react/commit/d926936f0 )**: Eager bailout optimization should always compare to latest reducer (#15124) //<Andrew Clark>//
- **[4162f6026](https://github.com/facebook/react/commit/4162f6026 )**: Add feature flag to disable yielding (#15119) //<Sebastian Markbåge>//
- **[8d60bd4dc](https://github.com/facebook/react/commit/8d60bd4dc )**: [Shallow] Implement setState for Hooks and remount on type change (#15120) //<Dan Abramov>//
- **[035e4cffb](https://github.com/facebook/react/commit/035e4cffb )**: Change passive checker to use defineProperty (#15121) //<Dominic Gannaway>//
- **[b283d75c1](https://github.com/facebook/react/commit/b283d75c1 )**: Support React.memo in ReactShallowRenderer (#14816) //<Brandon Dail>//
- **[f0621fe23](https://github.com/facebook/react/commit/f0621fe23 )**: Use same example code for async effect warning (#15118) //<Dan Abramov>//
- **[52c870c8d](https://github.com/facebook/react/commit/52c870c8d )**: Fix shallow renderer not allowing hooks in forwardRef render functions (#15100) //<Sebastian Silbermann>//
- **[f1ff4348c](https://github.com/facebook/react/commit/f1ff4348c )**: Don't suggest a function as its own dep (#15115) //<Dan Abramov>//
- **[371bbf36b](https://github.com/facebook/react/commit/371bbf36b )**: Add infrastructure for passive/non-passive event support for future API exploration (#15036) //<Dominic Gannaway>//
- **[ab5fe174c](https://github.com/facebook/react/commit/ab5fe174c )**: Don't set the first option as selected in select tag with `size` attribute  (#14242) //<Mateusz>//
- **[935f60083](https://github.com/facebook/react/commit/935f60083 )**: eslint-plugin-react-hooks@1.5.1 //<Dan Abramov>//
- **[0c03a4743](https://github.com/facebook/react/commit/0c03a4743 )**: Adds experimental event API scaffolding (#15108) //<Dominic Gannaway>//
- **[1204c7897](https://github.com/facebook/react/commit/1204c7897 )**: [eslint] Wording tweaks (#15078) //<Sophie Alpert>//
- **[9d77a317b](https://github.com/facebook/react/commit/9d77a317b )**: Improve async useEffect warning (#15104) //<Dan Abramov>//
- **[103378b1e](https://github.com/facebook/react/commit/103378b1e )**: Warn for javascript: URLs in DOM sinks (#15047) //<Sebastian Markbåge>//
- **[5d0c3c6c7](https://github.com/facebook/react/commit/5d0c3c6c7 )**: [Partial Hydration] Render client-only content at normal priority (#15061) //<Sebastian Markbåge>//
- **[6a4a261ee](https://github.com/facebook/react/commit/6a4a261ee )**: Test suspended children are hidden before layout in persistent mode (#15030) //<Andrew Clark>//
- **[bc8bd24c1](https://github.com/facebook/react/commit/bc8bd24c1 )**: Run persistent mode tests in CI (#15029) //<Andrew Clark>//
- **[3f4852fa5](https://github.com/facebook/react/commit/3f4852fa5 )**: Run Placeholder tests in persistent mode, too (#15013) //<Andrew Clark>//
- **[d0289c7e3](https://github.com/facebook/react/commit/d0289c7e3 )**: eslint-plugin-react-hooks@1.5.0 //<Dan Abramov>//
- **[03ad9c73e](https://github.com/facebook/react/commit/03ad9c73e )**: [ESLint] Tweak setState updater message and add useEffect(async) warning (#15055) //<Dan Abramov>//
- **[eb6247a9a](https://github.com/facebook/react/commit/eb6247a9a )**: More concise messages (#15053) //<Dan Abramov>//
- **[197703ecc](https://github.com/facebook/react/commit/197703ecc )**: [ESLint] Add more hints to lint messages (#15046) //<Dan Abramov>//
- **[6d2666bab](https://github.com/facebook/react/commit/6d2666bab )**: Fix ESLint rule crash (#15044) //<Dan Abramov>//
- **[9b7e1d138](https://github.com/facebook/react/commit/9b7e1d138 )**: [ESLint] Suggest moving inside a Hook or useCallback when bare function is a dependency (#15026) //<Dan Abramov>//
- **[1e3b6192b](https://github.com/facebook/react/commit/1e3b6192b )**: Import Scheduler directly, not via host config (#14984) //<Andrew Clark>//
- **[5d49dafac](https://github.com/facebook/react/commit/5d49dafac )**: Enforce deps array in useMemo and useCallback (#15025) //<Dan Abramov>//
- **[a9aa24ed8](https://github.com/facebook/react/commit/a9aa24ed8 )**: 16.8.4 and changelog //<Brian Vaughn>//
- **[fa5d4ee43](https://github.com/facebook/react/commit/fa5d4ee43 )**: [ESLint] Treat functions that don't capture anything as static (#14996) //<Dan Abramov>//
- **[fd557d453](https://github.com/facebook/react/commit/fd557d453 )**: Warn on mount when deps are not an array (#15018) //<Dan Abramov>//
- **[ce45ca9ba](https://github.com/facebook/react/commit/ce45ca9ba )**: Prettier //<Andrew Clark>//
- **[757a70b25](https://github.com/facebook/react/commit/757a70b25 )**: ReactNoop.yield -> Scheduler.yieldValue (#15008) //<Andrew Clark>//
- **[9d756d903](https://github.com/facebook/react/commit/9d756d903 )**: Revert #14756 changes to ReactFiberScheduler (#14992) //<Andrew Clark>//
- **[f16442a10](https://github.com/facebook/react/commit/f16442a10 )**: eslint-plugin-react-hooks@1.4.0 //<Dan Abramov>//
- **[e1e45fb36](https://github.com/facebook/react/commit/e1e45fb36 )**: [ESLint] Suggest to destructure props when they are only used as members (#14993) //<Dan Abramov>//
- **[59ef28437](https://github.com/facebook/react/commit/59ef28437 )**: Warn about dependencies outside of render scope (#14990) //<Dan Abramov>//
- **[df7b4768c](https://github.com/facebook/react/commit/df7b4768c )**: [ESLint] Deduplicate suggested dependencies (#14982) //<Dan Abramov>//
- **[02404d793](https://github.com/facebook/react/commit/02404d793 )**: Avoid dynamic dispatch for scheduler calls (#14968) //<Dan Abramov>//
- **[bb2939ccc](https://github.com/facebook/react/commit/bb2939ccc )**: Support editable useState hooks in DevTools (#14906) //<Brian Vaughn>//
- **[69060e1da](https://github.com/facebook/react/commit/69060e1da )**: Swap expect(ReactNoop) for expect(Scheduler) (#14971) //<Andrew Clark>//
- **[ccb2a8a44](https://github.com/facebook/react/commit/ccb2a8a44 )**: Replace test renderer's fake Scheduler implementation with mock build (#14970) //<Andrew Clark>//
- **[53e787b45](https://github.com/facebook/react/commit/53e787b45 )**: Replace noop's fake Scheduler implementation with mock Scheduler build (#14969) //<Andrew Clark>//
- **[3ada82b74](https://github.com/facebook/react/commit/3ada82b74 )**: Allow extraneous effect dependencies (#14967) //<Dan Abramov>//
- **[00748c53e](https://github.com/facebook/react/commit/00748c53e )**: Add new mock build of Scheduler with flush, yield API (#14964) //<Andrew Clark>//
- **[4186952a6](https://github.com/facebook/react/commit/4186952a6 )**: Fixed incompatibility between react-debug-tools and useContext() (#14940) //<Brian Vaughn>//
- **[0b8efb229](https://github.com/facebook/react/commit/0b8efb229 )**: Allow omitting constant primitive deps (#14959) //<Dan Abramov>//
- **[875d05d55](https://github.com/facebook/react/commit/875d05d55 )**: Include full error messages in React Native build (#15363) //<Andrew Clark>//
- **[c64b33003](https://github.com/facebook/react/commit/c64b33003 )**: Move EventTypes to ReactTypes (#15364) //<Dominic Gannaway>//
- **[4c78ac0b9](https://github.com/facebook/react/commit/4c78ac0b9 )**: Track Event Time as the Start Time for Suspense (#15358) //<Sebastian Markbåge>//

Changelog:
[General][Changed] - React sync for revisions 8e25ed2...c64b330

Reviewed By: hramos

Differential Revision: D14862650

fbshipit-source-id: 350447246d26c69e7f462c5eb4e3ec02e99d05bb
2019-04-17 12:03:55 -07:00
Estevão Lucas e76a7df5b5 - Add DevSetting native module (making it cross-platform) (#24441)
Summary:
React Native has a `NativeModule` to manipulate programmatically the dev menu options (live reload, hot reload, remote debugging, etc), called [`DevSettings`](https://github.com/facebook/react-native/blob/master/React/Modules/RCTDevSettings.mm#L120). However this module is only available for iOS.

This PR brings the same `DevSettings` for Android, making it a cross-platform NativeModule.

Motivation: Right now if your app needs to programmatically reload RN, one option is to install [`react-native-restart`](https://www.npmjs.com/package/react-native-restart). It's a tiny dependency, but it's annoying to have to install it, while the code to do so is inside RN codebase. According to NPM, react-native-restart has ~12k weekly downloads, shows it's a recurring feature for many apps (my case).

Thus making `NativeModules.DevSettings` is a small increment in the codebase, just exposing the dev menu methods, to improve the Development Experience

[Android] [Added] - Add DevSetting native module (making it cross-platform)

With expection of `setIsShakeToShowDevMenuEnabled`, the following methods will be available for both platforms:
* reload
* setHotLoadingEnabled
* setIsDebuggingRemotely
* setIsShakeToShowDevMenuEnabled
* setLiveReloadEnabled
* setProfilingEnabled
* toggleElementInspector
Pull Request resolved: https://github.com/facebook/react-native/pull/24441

Differential Revision: D14932751

Pulled By: cpojer

fbshipit-source-id: 465e6a89c3beb5fd1ea22e80ea02e9438f596a09
2019-04-17 11:00:17 -07:00
Frieder Bluemle 62ff7d6863 Update detox to 12.2.0 (#24425)
Summary:
This updates `detox` from `12.1.1` to `12.2.0`.
It includes (amongst other things) the following fixes, as described on the [12.1.4 release page](https://github.com/wix/Detox/releases/tag/12.1.4):

- hotfix: redundant logs in the folder
- fix: stabilize simulator log recording

It also updates the detox test script and config in `packages.json` (which was previously missed when detox was updated to 12.1.x). It will remove the following deprecation warnings:

```
detox[6416] WARN:  [test.js] Deprecation warning: "file" and "specs" support will be dropped in the next Detox version.
detox[6416] WARN:  [test.js] Please edit your package.json according to the migration guide: https://wix.to/I0DOAK0
```

Instead of extra preprocessing the test folder by `detox`, it will now be passed straight to `jest`.

More information in the [migration guide](https://github.com/wix/Detox/blob/master/docs/Guide.Migration.md).

[General] [Changed] - Update detox to 12.2.0
Pull Request resolved: https://github.com/facebook/react-native/pull/24425

Differential Revision: D14973771

Pulled By: cpojer

fbshipit-source-id: 367ed1f75d2cc3b02349282e7a6201684ba130a7
2019-04-17 10:18:44 -07:00
Sam Mathias Weggersen 01bcde3ed8 Keyboard accessibility improvements (#24359)
Summary:
In order to meet our accessibility requirements we need to have full support for keyboard navigation. The Touchable components works with press/tap with a finger, but doesn't respond to 'enter' when using a keyboard. Navigation works fine. This PR adds an onClick listener to touchable views that have the onPress prop defined.

[Android] [Added] - Add View.OnClickListener to Touchable components when onPress is defined
Pull Request resolved: https://github.com/facebook/react-native/pull/24359

Differential Revision: D14971230

Pulled By: cpojer

fbshipit-source-id: ca5559ca1308ee6c338532a00dcea4d00fa57f42
2019-04-17 09:55:24 -07:00
cpojer a1250da646 Add document describing the RN ecosystem. (#24493)
Summary:
This change adds a document outlining the main stakeholders in React Native and their responsibilities: Partners, core contributors and community contributors

It serves as an overview for companies and individuals who are interested in contributing, to get a better understand of how the project is set up, who supports it, and what they do.

This is the first version and I am hoping to integrate it into more places in the future as well as I'd like to keep it up-to-date as things change. Hector is working on a detailed document outlining what it means to be a core contributor and we'll make a list of existing core contributors soon as well.
Pull Request resolved: https://github.com/facebook/react-native/pull/24493

Differential Revision: D14973910

Pulled By: cpojer

fbshipit-source-id: 3a722582be6bb3b953f10073682c5841cdae2c27
2019-04-17 09:06:37 -07:00
James Treanor 31850df116 Fix nullability warnings in RCTExceptionsManager (#24467)
Summary:
There are a number of nullability warnings in `RCTExceptionsManager` when building React Native for iOS with Xcode 10.2. This resolves them without changing the existing behavior.

See the warnings here:

![image](https://user-images.githubusercontent.com/1773641/56201323-89551380-6038-11e9-9998-b6a8d3d28f36.png)

[iOS] [Fixed] - Fix nullability warnings in RCTExceptionsManager
Pull Request resolved: https://github.com/facebook/react-native/pull/24467

Differential Revision: D14973485

Pulled By: cpojer

fbshipit-source-id: 2fac9f067ac9418397c3913760a2403f9a2cc147
2019-04-17 08:36:14 -07:00
Rick Hanlon bddd9c7d59 Generate Tests
Summary:
To ensure greater type safety, we want to generate some cpp tests for the fromRawValue conversions

This diff adds support to generate Tests.cpp along with the `buck test` targets itegrated into the rn_codegen rule automatically. The tests just `assert(true, true)` as a starting point

Reviewed By: fkgozali

Differential Revision: D14739493

fbshipit-source-id: fc9dea64ea31e6af7d997aebc54cfd459d48bf4f
2019-04-17 07:32:18 -07:00
Rick Ratmansky 44fe9904ac Removing more unused libraries from the repo
Summary: This is removing packages and libraries from the repo.  Any modified buck files simply change the redirect targets to something more appropriate (no logic actually changed)

Differential Revision: D14950721

fbshipit-source-id: 6c14f827b76ca1dbaf83dcb983930f362c6a27d4
2019-04-16 11:32:43 -07:00
Samuel Susla 51990014eb Add border properties to `RCTImageView`
Summary:
Second attempt at adding border properties to `RCTImageView`.

Previous attempt can be found at D14875673 which was reverted.

1. `UIImageView` is no longer laid out in in `layoutSubviews`.
2. `updateWithImage` was not being called, I instead of calling `self.image = image` I was calling `_imageView.image = image` directly which skips calling `updateWithImage`. This meant that image's rendering mode was not changed to `template`.

Reviewed By: shergin

Differential Revision: D14934103

fbshipit-source-id: b74c692f9f8ad520ef1f9c70ec4b4aa68b868cd4
2019-04-16 11:04:20 -07:00
Ramanpreet Nara 129aeacf48 Add exception handling to method invocations
Summary:
If you call into a Java method (from C++ using JNI) that raises an exception, the JNI call won't actually raise a C++ error. Instead, the `JNIEnv` will record the pending Java exception and the C++ will continue executing as normal. This is bad because the next time you call into JNI, the app will actually crash, unless you explicitly cleared the exception using `JNIEnv::ExceptionClear()` before the JNI call.

With respect to TurboModules, we need to make sure that RedBoxes show up whenever a native methods raise an exception. We also don't want the app to crash when a JNI method call fails because of a raised exception. Therefore, in this diff, I raise a C++ exception if `JNIEnv::ExceptionCheck()` is true.

Reviewed By: mdvacca

Differential Revision: D14738540

fbshipit-source-id: 4c3063aa93ae7aef025bd2dab6b45059bb8fb409
2019-04-16 09:18:14 -07:00
Ramanpreet Nara d1c35aaa84 Add support for Promises
Summary:
If the return type of a TurboModule method is `Promise`, the infra should create a `com.facebook.react.bridge.Promise` object and pass it as the final argument of the TurboModule Java method call. The Java TurboModule method can then do some work asynchronously and either resolve or reject the promise at some point in time.

**Note:** I stacked a diff for error handling on top of this one.

Reviewed By: mdvacca

Differential Revision: D13653156

fbshipit-source-id: 4c30c3223ad8f47c6ba7f1236527aaced01c8ae8
2019-04-16 09:18:14 -07:00
Valentin Shergin ba199eade5 Fabric: Marking RCTViewComponentView's methods from RCTComponentViewProtocol as `NS_REQUIRES_SUPER`
Summary: If some class or category override/implement one of those methods, it implies that subclasses must call super for them. `NS_REQUIRES_SUPER` allows to enforce this constraint.

Reviewed By: JoshuaGross

Differential Revision: D14896804

fbshipit-source-id: a481f16e1f7ab901d70deb6486f2ca1cf19dd8d7
2019-04-16 07:35:08 -07:00
Valentin Shergin 6392894e59 Fabric: Using `finalizeUpdates:` in RCTViewComponentView
Summary:
Previously we could call `invalidateLayer` twice during a mounting transaction (one for update-props, one for update-layout-metrics), that was sub-optimal.
Now, with `finalizeUpdates:` we can do it only once. That should save us some CPU cycles.

Reviewed By: JoshuaGross

Differential Revision: D14896802

fbshipit-source-id: b6572fb2a4fa48a12b1d1c29144cd7c67f6cff80
2019-04-16 07:35:08 -07:00
Valentin Shergin f4fd1831da Fabric: `RNWrapManagedObject` and `RNUnwrapManagedObject` helpers
Summary: We use this pattern already and seems we use it more. Those two functions introduce a "semantical" wrappers for this context, so now there is no need to think which exact `__bridge ***` qualifier we should use, so it's much less error-prone.

Reviewed By: JoshuaGross

Differential Revision: D14896800

fbshipit-source-id: 85b86bfcefdad5aff0375e7172769df86c001506
2019-04-16 07:35:08 -07:00
Valentin Shergin 1f5af2a6f1 Fabric: ComponentDescriptor now contains ContextContainer and EventDispatcher refs
Summary:
Turns out that storing and using ContextContainer in custom subclasses is a huge pain. At the same time seems that a lot of custom components need some DI instrument, so we need this instrument anyway.

Moving stuff from the template to the base class should also help with codesize a bit.

Reviewed By: JoshuaGross

Differential Revision: D14921356

fbshipit-source-id: 4dbb961fe32bd66c73513d7e053bbed229860a31
2019-04-16 07:35:07 -07:00
Valentin Shergin c79db53a9a Fabric: Introducing `-[RCTComponentViewProtocol finalizeUpdates:]`
Summary:
The new method is being called right after all update methods were called for a particular component view.
It is useful for performing updates that require knowledge of several independent aspects of the compound mounting change (e.g. props *and* layout constraints).

Reviewed By: JoshuaGross

Differential Revision: D14896801

fbshipit-source-id: 485d8c97d81d7a2ad7a7afc209094c328da6ef3c
2019-04-16 07:35:07 -07:00
Valentin Shergin 184cfd5594 Fabric: Bunch of small changes in ContextContainer
Summary:
So, changes:
* Correctness checks only in debug mode (codesize win?);
* `registerInstance` marked as const (because it's thread safe);
* ContextContainer::Shared also enforces constness;
* Using faster better::map;
* Using shared/RW mutex instead of regular one;
* SharedContextContainer got removed.

Reviewed By: sahrens

Differential Revision: D14920284

fbshipit-source-id: f0f8d970e7fae79a1abe3bc32827db9fd2d17e13
2019-04-16 07:35:07 -07:00
David Aurelio cdf3343dd0 Code formatting: allow short inline methods on one line
Summary:
@public

This allows short methods defined in class declarations to occupy a single line.
The change makes class declarations more readable.

Reviewed By: SidharthGuglani

Differential Revision: D14950012

fbshipit-source-id: 1321949475184181c6cceb86613f730e430763e2
2019-04-16 07:14:12 -07:00
Taylor123 faaa92bb04 disable momentum scrolling for horizontal ScrollView (#24045)
Summary:
Would like feedback from the community as this may not be the best solution for all

I would like to restrict (or paginate) the fling of a horizontal ScrollView when `snapToInterval` is set. This is not currently possible with `pagingEnabled`, since the pagination works only when items are the entire width of the ScrollView.

This implementation simply restricts the predicted `targetOffset` found from the `x` velocity and replaces it with the offset when the pan gesture ended.

To get pagination working, I may paginate based on the interval by calculating the offset delta from the beginning of the gesture to current offset and restricting the scrolling behavior to the `snapToInterval`. If this is preferred, I can update this PR or make a new one, but wanted to start a discussion since it seems like there are many in the community that would like this feature  #21302 .

[General] [Added] - add prop `disableIntervalMomentum` to disable the predictive scrolling behavior of horizontal ScrollViews
Pull Request resolved: https://github.com/facebook/react-native/pull/24045

Differential Revision: D14939754

Pulled By: sahrens

fbshipit-source-id: 26be19c47dfb8eed4d7e6035df53a77451e23081
2019-04-15 14:40:44 -07:00
Alston Lin e28b6f314a Fixed bug with Android's CameraRoll module where saveToPhotos crashed devices on a very small subset of devices
Summary:
For a small subset of Android devices, the following line of code caused the device to crash

```
output.transferFrom(input, 0, Long.MAX_VALUE);
```

According to the [Java docs](https://docs.oracle.com/javase/1.5.0/docs/api/java/nio/channels/FileChannel.html), this is what the function does.

> Transfers bytes into this channel's file from the given readable byte channel.
An attempt is made to read up to count bytes from the source channel and write them to this channel's file starting at the given position. An invocation of this method may or may not transfer all of the requested bytes; whether or not it does so depends upon the natures and states of the channels. Fewer than the requested number of bytes will be transferred if the source channel has fewer than count bytes remaining, or if the source channel is non-blocking and has fewer than count bytes immediately available in its input buffer.

Hence, using `Long.MAX_VALUE` seemed to be the standard way to transfer all bytes from one channel to the other.

However, it appeared that for some reason on a subset of old Android devices, the device tries to allocate `count` bytes of memory before transferring the bytes. Obviously, this caused a crash because no device has that much memory. This was fixed transferring bytes using a 1MB buffer.

Differential Revision: D14921778

fbshipit-source-id: 7fa46e10c656e23ae7d5679c72b278188f09ad0a
2019-04-15 12:38:30 -07:00
Kevin Gozali 0bd931e47e TM: Added TurboModuleExample in RNTester
Summary:
This showcases SampleTurboModule usage in RNTester. Notes:
* iOS only for now, and you must use cocoapods version.
* You cannot use Chrome debugger when loading this specific example.

As illustrated in the example, the callsite should access `NativeSampleTurboModule` to access the native side.

{F155901711}

Reviewed By: cpojer

Differential Revision: D14932537

fbshipit-source-id: a733e1cd3b642b9e572d5ac6347f4775d495578a
2019-04-15 12:25:48 -07:00
Kevin Gozali 4da6e4a042 TM iOS: Install SampleTurboModule in RNTester (pods)
Summary: This sets up RCTSampleTurboModule (and other variants) in RNTester when built with cocoapods. There's no call site yet though. And RNTester.xcodeproj doesn't support it.

Reviewed By: cpojer

Differential Revision: D14932535

fbshipit-source-id: db8eafd6777cbec8f3592dafdccbdd7cf44e38bc
2019-04-15 12:25:48 -07:00
Kevin Gozali a2aba45067 TM iOS: Move SampleTurboModule to OSS
Summary:
This provides various versions of SampleTurboModule, that are:
* compatible with existing NativeModule
* TurboModule compliant

Variants:
* RCTSampleTurboModule (traditional objc module)
* RCTSampleTurboCxxModule (objc++ module using CxxModule)
* SampleTurboModule (pure C++ impl of a TurboModule, no ObjC)

As noted in some files, they need to be codegen'ed based on the `NativeSampleTurboModule.js` (Flow type). The codegen script is not yet usable in OSS (we'll work on it some time in H2 2019). For now, these files need to be manually synced with Flow type.

Reviewed By: cpojer

Differential Revision: D14932539

fbshipit-source-id: fb887192384e5e6e4dff4cac68b4e037a4783cd9
2019-04-15 12:25:47 -07:00
Kevin Gozali e612b9b0f5 TM iOS: Install TurboModule system in RNTester (pod) by default
Summary:
For CocoaPods variant only: install TurboModule binding so that sample modules can start using it. This commit only installs `global.__turboModuleProxy` - no sample module is provided.

Note: RNTester.xcodeproj will NOT have TurboModule enabled, due to complication in the .xcodeproj setup (doable, but maybe for some other time...)

To test:

```
console.error(global.__turboModuleProxy == null ? 'BOO' : 'YAY!');
```

Saw `YAY!` in RNTester pod version.

Reviewed By: cpojer

Differential Revision: D14932536

fbshipit-source-id: 3dc083da9154ec320ce6789ec7f2cef5a08fd6a7
2019-04-15 12:25:47 -07:00
Kevin Gozali 642fafffd8 RNTester: Support RCTCxxBridgeDelegate
Summary: This is to prepare for custom JS runtime binding installation. Note: AppDelegate needs to become .mm

Reviewed By: cpojer

Differential Revision: D14932538

fbshipit-source-id: 30f32223cc405d0cace9e3076b5a2a1d8cc9e3b2
2019-04-15 12:25:47 -07:00
Kevin Gozali 431bd7cd74 RNTester: update Podfile
Summary: Podfile.lock seems outdated.

Reviewed By: cpojer

Differential Revision: D14932540

fbshipit-source-id: f2b885f8b456e890951afa462fe433e7f3e737a6
2019-04-15 12:25:47 -07:00
Janic Duplessis 5e36b0c6eb Add support for cancelling fetch requests with AbortController (#24419)
Summary:
This adds https://github.com/mysticatea/abort-controller to polyfill [AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController). This is used to cancel requests when using `fetch`.

This also updates `event-target-shim` to 5.0 to make sure we only have one version of this dependency. This updates required adding a polyfill for `console.assert` which is used by the new version. I made one based on https://github.com/gskinner/console-polyfill/blob/master/console.js#L74.

The polyfill is very small, especially since we already use `event-target-shim` so I think it makes sense to include in core.

Depends on #24418 so that the fetch polyfill supports the `signal` parameter.

Fixes #18115

[General] [Added] - Add support for cancelling fetch requests with AbortController
Pull Request resolved: https://github.com/facebook/react-native/pull/24419

Differential Revision: D14912858

Pulled By: cpojer

fbshipit-source-id: 8a6402910398db51e2f3e3262f07aabdf68fcf72
2019-04-15 12:02:36 -07:00
Panagiotis Vekris 5e44c08fa5 Deploy 0.97.0 to xplat
Summary:
https://our.intern.facebook.com/intern/wiki/Flow/Flow_Release_Process/#update-xplat-js

allow-large-files
bypass-lint

Reviewed By: dsainati1

Differential Revision: D14920747

fbshipit-source-id: db03f6cf73a4b3e9fad6b47e0e657490c45d06a3
2019-04-15 11:19:20 -07:00
Héctor Ramos d65daa0d3f Add react-native-oss-e2e job to Sandcastle, running JavaScript e2e tests from open source
Summary: Remove unused path variable from open source JavaScript test script.

Reviewed By: cpojer

Differential Revision: D14899083

fbshipit-source-id: 880102d404ca72c352a20654cb12263d98945a8b
2019-04-15 11:07:54 -07:00
David Aurelio 96cf6f821e Define all style getters/setters explicitely
Summary:
@public

For better grepping, we define all `YGNodeStyle...` accessors explicitely. This also replaces all macros with a set of templates that can easily be updated when we switch to style accessors on `YGNode`.

Transitioning to a consistent set of templates also allowed to end up with a single *needs update* / *do update* / *mark dirty* block.

The new template code also takes full advantage of the properties of `YGOptional` (constructor call with *not a number* creates an empty optional) and `detail::CompactValue` (conversions of *auto* and *undefined* are always well-formed) to get rid of some additional code:

Removed `NAN` check:
```
 _YGNodeStyleSetFlex:
 	pushq	%rbp
 	movq	%rsp, %rbp
 	movss	0x34(%rdi), %xmm1
 	ucomiss	%xmm0, %xmm1
 	jne	0x____
 	jnp	0x____
 	ucomiss	%xmm0, %xmm0
 	jnp	0x____
 	ucomiss	%xmm1, %xmm1
 	jnp	0x____
 	popq	%rbp
 	retq
-	ucomiss	%xmm0, %xmm0
-	movd	%xmm0, %eax
-	movl	$0x7fc00000, %ecx
-	cmovnpl	%eax, %ecx
-	movl	%ecx, 0x34(%rdi)
+	movss	%xmm0, 0x34(%rdi)
 	popq	%rbp
 	jmp	0x____
-	nopw	%cs:(%rax,%rax)
-	nop
+	nopw	(%rax,%rax)
```

Removed well-formedness check:
```
 _YGNodeStyleGetPosition:
 	pushq	%rbp
 	movq	%rsp, %rbp
 	movl	%esi, %eax
 	movl	0x68(%rdi,%rax,4), %ecx
+	xorl	%eax, %eax
 	movq	(%rip), %rcx
 	movl	(%rcx), %eax
 	movl	0x4(%rcx), %ecx
-	movq	%rcx, %rdx
-	shlq	$0x20, %rdx
+	shlq	$0x20, %rcx
 	movl	%eax, %eax
-	orq	%rdx, %rax
-	cmpl	$0x3, %ecx
-	je	0x____
-	testl	%ecx, %ecx
-	jne	0x____
-	movl	$0x7fc00000, %ecx
-	jmp	0x____
-	movq	%rax, %rcx
-	movabsq	$-0x100000000, %rdx
-	andq	%rax, %rdx
-	movl	%ecx, %eax
-	orq	%rdx, %rax
+	orq	%rcx, %rax
 	popq	%rbp
 	retq
 	nopw	(%rax,%rax)
```

Reviewed By: SidharthGuglani

Differential Revision: D14911973

fbshipit-source-id: db6eef65f8fdaf70875f7fe8799919ca88bd50ee
2019-04-15 10:53:50 -07:00
Estevão Lucas f70e58f355 - remove accessibilityComponentType and accessibilityTraits props (a11y) (#24344)
Summary:
Closes: https://github.com/facebook/react-native/issues/24016

React Native 0.57 introduced cross-platform `accessibilityRole` and `accessibilityStates` props in order to replace `accessibilityComponentType` (for android) and `accessibilityTraits` (for iOS). With #24095 `accessibilityRole` and `accessibilityStates` will increase, receiving more options, which seems to be a good moment to remove deprecated props.

Remove deprecated `accessibilityComponentType` and `accessibilityTraits` props.

[General] [Removed] - Remove accessibilityComponentType and accessibilityTraits props
Pull Request resolved: https://github.com/facebook/react-native/pull/24344

Reviewed By: rickhanlonii

Differential Revision: D14842214

Pulled By: cpojer

fbshipit-source-id: 279945e503d8a23bfee7a49d42f5db490c5f6069
2019-04-15 10:53:50 -07:00
Brian Zhao 57c1a7add2 Remove MissingNativeRCTNetworkingShim; revert MissingNativeAppStateShim (#24380)
Summary:
`setupDevtools.js` is accessing `AppState.currentState` without checking its availability. In environments where 1) `__DEV__ == true`, and 2) no `RCTAppState` native module is provided thus resorting to `MissingNativeAppStateShim`, this will result in an exception:

```Cannot use 'AppState' module when native 'RCTAppState' is not included in the build. Either include it, or check 'AppState'.isAvailable before calling any methods.```

(Interestingly, `MissingNativeAppStateShim.currentState` did have a [default `null` value](118e88393e (diff-305b5180aa6ccc876ede6767de1fbfc4R192)) that was [later removed](a93b7a2da0 (diff-305b5180aa6ccc876ede6767de1fbfc4R186)).)

**Update**: Following cpojer's suggestion of reverting a93b7a2da0. Title also updated to reflect this.

[General] [Fixed] - Remove MissingNativeRCTNetworkingShim; revert MissingNativeAppStateShim
Pull Request resolved: https://github.com/facebook/react-native/pull/24380

Differential Revision: D14932658

Pulled By: cpojer

fbshipit-source-id: aef7ca566b3b8660eaed74a8ba3b6b0117b1200c
2019-04-15 10:47:53 -07:00
Sidharth Guglani 21363add69 Use only 4 edges for margin, padding, border in YGLayout
Summary:
We were using four edges for margin, padding and border. This diff changes the array size in YGLayout for margin, padding, border to reduce YGNode size and corresponding changes while we are setting values in YGLayout.
Reduces the YGNode size by 24 bytes

Reviewed By: davidaurelio

Differential Revision: D14892666

fbshipit-source-id: 94013d5183ee869901267c4c9941fd94fa05d848
2019-04-15 05:42:20 -07:00
Valentin Shergin d99e657e39 Fixed incorrect opacity behaviour for <Text> component on iOS (#24435)
Summary:
This PR fixes #24229.
Seems currently `opacity` props for Text is being applied twice (one for text color and one for the whole view). This PR disables applying the prop to the text.

[CATEGORY] [TYPE] - Fixed double applying opacity prop for Text
Pull Request resolved: https://github.com/facebook/react-native/pull/24435

Differential Revision: D14932795

Pulled By: cpojer

fbshipit-source-id: f9280fc75f788424cb5f1e42d2e79efdb354d645
2019-04-15 02:41:45 -07:00
Lucas Bento 3273d23a26 Specify correct terminal to start the packager (#24436)
Summary:
This PR specifies the correct terminal to start the Metro bundler as stated in https://github.com/react-native-community/cli/issues/303.

[iOS] [Changed] - Start the packager on the correct terminal.
Pull Request resolved: https://github.com/facebook/react-native/pull/24436

Differential Revision: D14932703

Pulled By: cpojer

fbshipit-source-id: 4c9b5a380ff4f4767acbeb6872e11e03df5b160c
2019-04-15 02:14:38 -07:00
Joshua Gross bbd925cdd1 MountingManager can create views with props in one step instead of two
Summary: Create views with props in one call instead of two. Backwards-compatible.

Reviewed By: shergin

Differential Revision: D14846424

fbshipit-source-id: cb53225579089f7e51d4e9d1fc9fc2e331a994c1
2019-04-15 01:46:04 -07:00
zhongwuzw b60651dd09 Add indent for event emitter header generation of codegen (#24445)
Summary:
Part of #24438, add indent foe event emitter header codegen.
cc. cpojer rickhanlonii.

[General] [Fixed] - Add indent for event emitter header generation of codegen
Pull Request resolved: https://github.com/facebook/react-native/pull/24445

Differential Revision: D14930352

Pulled By: cpojer

fbshipit-source-id: 8bd03b8e12ccf9bd06546acdb744541fcb92eea1
2019-04-14 06:07:04 -07:00
zhongwuzw 2a4a9f86d4 Add indent for props generation of codegen (#24438)
Summary:
Add correct indent when run codegen.
Before:
<img width="686" alt="image" src="https://user-images.githubusercontent.com/5061845/56078952-41f43a80-5e20-11e9-998e-e386f54b0b95.png">
<img width="655" alt="image" src="https://user-images.githubusercontent.com/5061845/56078955-491b4880-5e20-11e9-9935-561039806e48.png">

After:
<img width="692" alt="image" src="https://user-images.githubusercontent.com/5061845/56078931-18d3aa00-5e20-11e9-9865-126b18fbeb58.png">
<img width="658" alt="image" src="https://user-images.githubusercontent.com/5061845/56078940-225d1200-5e20-11e9-9ec7-374cf5c83768.png">

cc. cpojer rickhanlonii

[General] [Fixed] - Add indent for props generation of codegen
Pull Request resolved: https://github.com/facebook/react-native/pull/24438

Differential Revision: D14930351

Pulled By: cpojer

fbshipit-source-id: ec144119f78dd9e6e6d49321184d7d996aae90aa
2019-04-14 05:43:48 -07:00
Valentin Shergin 792585fd48 Fabric: ContextContainer was moved to `utils` module
Summary: That allows avoiding circular deps and unnecessary deps on uimanager module.

Reviewed By: PeteTheHeat

Differential Revision: D14917227

fbshipit-source-id: fe7962ee528aa659d8bd23e3e46627722551d995
2019-04-12 15:14:48 -07:00
Ramanpreet Nara 108c4190ed Disable flaky RNTester test
Summary:
`[RCTBridge setUp]` and `[RCTBridge invalidate]` execute asynchronously and concurrently. Therefore, it's not safe to call one method after the other, as we do in `[RCTBridge reload]`.

In this test, we create a bridge, and immediately reload it. Initializing the bridge causes the JS bundle to execute. Invalidating the bridge causes the jsThread to be terminated. If circumstances are correct, we could end up trying to executing the JS bundle after the jsThread has been terminated, which can lead to these assertions being triggered:
1. `RCTAssert(_jsThread, @"This method must not be called before the JS thread is created");` in `ensureOnJavaScriptThread:`.
2. `RCTAssert(_jsMessageThread != nullptr, @"Cannot invoke completion without jsMessageThread");` in `enqueueApplicationScript:url:onComplete:`.

```
- (void)testUnderlyingBridgeIsDeallocated
{
  RCTBridge *bridge;
  __weak id batchedBridge;
  autoreleasepool {
    bridge = [[RCTBridge alloc] initWithBundleURL:_bundleURL moduleProvider:nil launchOptions:nil];
    batchedBridge = bridge.batchedBridge;
    XCTAssertTrue([batchedBridge isValid], @"RCTBridge impl should be valid");
    [bridge reload];
  }

  RCT_RUN_RUNLOOP_WHILE(batchedBridge != nil)

  XCTAssertNotNil(bridge, @"RCTBridge should not have been deallocated");
  XCTAssertNil(batchedBridge, @"RCTBridge impl should have been deallocated");

  // Wait to complete the test until the new bridge impl is also deallocated
  autoreleasepool {
    batchedBridge = bridge.batchedBridge;
    [bridge invalidate];
    bridge = nil;
  }

  RCT_RUN_RUNLOOP_WHILE(batchedBridge != nil);
  XCTAssertNil(batchedBridge);
}
```

To verify that this race is real, patch: P62410422. This adds an artificial delay in the `[RCTCxxBridge start]` method, which makes it so that the bridge is invalidated and the js thread is destroyed before we start executing the jsBundle.

I think a proper solution to this problem would require some bit of restructuring of `[RCTCxxBridge invalidate]` and `[RCTCxxBridge start]` to either:
1. Force `[RCTCxxBridge invalidate]` to wait for `[RCTCxxBridge start]` to complete and vice versa.
2. Make it safe to interleave execution of `[RCTCxxBridge start]` and `[RCTCxxBridge invalidate]`.

I tried the first approach using two semaphores: `_startSem(1)` and `_invalidateSem(0)`. When you start executing the code inside `[RCTCxxBridge start]`, you `semWait(_startSem)`. When you stop executing the code inside `[RCTCxxBridge start]` (which could happen in another thread at some later point in time), you `semSignal(_invalidateSem)`. Likewise, when you start executing `[RCTCxxBridge invalidate]`, you `semWait(_invalidateSem)` and when you stop executing the code inside `[RCTCxxBridge invalidate]` you `semSignal(_startSem)`. This way, invalidates always wait for starts to finish, and starts always wait for invalidates to finish. But considering all the concurrency involved in these methods, this is hard to get right.

The second approach seems possible. You could keep locks for the shared data, and create critical sections whever you want to access that data. I didn't actually try to implement this approach though.

Given that we're going to elminate the Bridge anyway, and that this race condition practically only occurs when you reload imediately after initializing the bridge (which can only really be done programmatically), I think it's fine to just disable the test for now. One other thing I considered was making the current thread sleep for some time after we created the bridge in the test. The reason why I'm hesitant to implement this approach is that it would slow down the execution of the test suite and still wouldn't guarantee that we don't hit this race condition. Ultimately, our infra might end up disabling these tests again.

Reviewed By: shergin

Differential Revision: D14909121

fbshipit-source-id: d7d441c3e2f0ad59182c8c7e23740be4ac4cf83c
2019-04-12 14:41:41 -07:00
Alexander Vasyuk a789ec6193 Revert D14875673: Add border properties to RCTImageView
Differential Revision:
D14875673

Original commit changeset: 594b2cd1ddff

fbshipit-source-id: a9cb74a6dea7bc61e16a146085d08754bdd4bd6e
2019-04-12 12:53:16 -07:00