Commit Graph

13622 Commits

Author SHA1 Message Date
Valentin Shergin d94a9e2640 Fabric: Composing YGNode object inside ShadowNode to avoid memory allocation overhead
Summary:
Given that fact that life-time of YGNode and ShadowNode objects must be idential and that we always allocate ShadowNode on heap,
we can embed YGNode object right inside ShadowNode object and use pointer to it safely.
That allows us to save additional memory allocation for every single layoutable shadow node! Whoo-hoo!

Reviewed By: fkgozali

Differential Revision: D8070121

fbshipit-source-id: 6eefbca1b7ac0a8aad235513b4c4899d414835f2
2018-05-22 15:48:17 -07:00
Sean Nicolay b8f30db0ae Fix or mark enum conversions
Reviewed By: adamjernst

Differential Revision: D8077375

fbshipit-source-id: 804ef985a773c7e1af6b7aa690790f57b10368f7
2018-05-22 09:53:54 -07:00
Sebastian Markbage 91f2ffed37 Back out "[JSC] Expose new methods to Custom/System JSC"
Reviewed By: fkgozali

Differential Revision: D8003558

fbshipit-source-id: 0b90153518f849f66d7c713f99cb44c79b27ca19
2018-05-22 09:53:54 -07:00
Kevin Gozali 55724bcc62 make <Image> fallback to <View> temporarily
Summary: <Image> support isn't there, so fallback to <View> instead of crashing.

Reviewed By: shergin

Differential Revision: D8086403

fbshipit-source-id: 16d7fd8023f93cbe25f2bc0f7d0a03e32cd402ce
2018-05-22 01:31:57 -07:00
Kevin Gozali 54489b91ab Fabric: Implementation of ShimmeringView aka <Shimmer>
Reviewed By: shergin

Differential Revision: D8016962

fbshipit-source-id: 5ec598e606f8e4bbf9e5c1db082d6a0b29bed3ee
2018-05-22 01:31:57 -07:00
Kevin Gozali 0ed8461f6d iOS: disable deprecation warning for Xcode 9.3.1+ for now
Summary:
This is to unbreak builds due to deprecated methods.
Cocoapods build seems unaffected.

Reviewed By: mmmulani

Differential Revision: D8060139

fbshipit-source-id: a4302d649dd75d29d293aeffdcc352bf09b0c504
2018-05-22 01:16:45 -07:00
Kevin Gozali f50df4f5ec iOS OSS: deployment target 8.0 => 9.0
Summary: Moving target deployment to iOS 9.0+ from now on, removing customization for iOS 8.

Reviewed By: shergin

Differential Revision: D8053439

fbshipit-source-id: 292c58f15c6e6caf8b28d15c1521812d6ed675c5
2018-05-22 01:16:45 -07:00
Sebastian Markbage 5028d48382 Wire up event handler bindings
Reviewed By: mdvacca

Differential Revision: D8048409

fbshipit-source-id: 5706130607302b4be2287cc303def7c2fb398bc8
2018-05-22 00:12:35 -07:00
Valentin Shergin f180300606 Fabric: Support for object notation in dynamic-to-Point/Size/Edges converstions
Summary: Trivial.

Reviewed By: fkgozali

Differential Revision: D8086650

fbshipit-source-id: 0850c799811f7cda2dd6786aada6222dcc28a3e4
2018-05-21 20:03:59 -07:00
David Vacca 3bcfdc4b9f Add more fabric logging information
Reviewed By: fkgozali

Differential Revision: D8084526

fbshipit-source-id: f59c5e60b4814229835a9eaa64bbb45242d04211
2018-05-21 18:16:47 -07:00
Sebastian Markbage 18b8dbb9bb Wire up event handler bindings
Reviewed By: shergin

Differential Revision: D8068507

fbshipit-source-id: 26326416c0b04cd52dc53af5d91010a1b27e0ec7
2018-05-21 12:21:56 -07:00
Tim Yung e2ce22b823 RN: Fix Reponder Logic in Text
Summary:
Fixes a bug I accidentally introduced in the responder logic for `Text`.

I forgot that I was using arrow functions to preserve `context` while still relying on the creation of `arguments`. Oops.

Differential Revision: D8077595

fbshipit-source-id: 1f7dc11ea90ca4d6bb2129823ba09c79fb5a32b0
2018-05-21 12:21:56 -07:00
Dmitry Zakharov 7c5845a5a2 Remove Native Extensions
Reviewed By: michalgr

Differential Revision: D8057885

fbshipit-source-id: 6af7f7729201d26a704adaadb15813979cd035f8
2018-05-21 12:21:56 -07:00
Dmitry Zakharov 782971f60e Move Native Extensions from JSContext layer to ContextFactory
Reviewed By: michalgr

Differential Revision: D8057886

fbshipit-source-id: 45a63d909169c9a40414de9cd54bdb411f9f595d
2018-05-21 12:21:55 -07:00
Oleg Lokhvitsky 33ffa79a51 Prevent RefreshControl from getting stuck when a parent is scrolled horizontally
Reviewed By: achen1

Differential Revision: D8044763

fbshipit-source-id: 8f3351de13eb17d2937f3b9e76500889398f9c59
2018-05-21 11:12:47 -07:00
Nurzhan Bakibayev 10814e2e61 Remove __fbUninstallRNGlobalErrorHandler
Reviewed By: pakoito

Differential Revision: D7831179

fbshipit-source-id: 6db9fe617d5a1a23a4aa46c9c3028db13a7a52a0
2018-05-21 11:12:46 -07:00
Miguel Jimenez Esun eba62803b5 Bump Metro to 0.37.1
Reviewed By: rafeca

Differential Revision: D8038396

fbshipit-source-id: 33fe5499825653f205bdb588ff4c7fa232602f24
2018-05-21 08:21:00 -07:00
Taras Tsugrii 1a7682b2a1 Re-format BUCK to use recommended style.
Reviewed By: yfeldblum

Differential Revision: D8073585

fbshipit-source-id: 12322aebc09b89d5af9cc257b16c1bc0fbb066c1
2018-05-20 23:24:51 -07:00
Spencer Ahrens 7d741d1119 Prettier
Reviewed By: bestander

Differential Revision: D8067792

fbshipit-source-id: 6ea8f46c3dce80afc3689ba55f348aa645af391e
2018-05-19 09:44:29 -07:00
Valentin Shergin 06b0dabaa7 Fabric: Deletion of unused files
Summary: We don't use them anymore.

Reviewed By: fkgozali

Differential Revision: D8048545

fbshipit-source-id: c92aa9ca13ac31eaead87a0982ed613710b7af57
2018-05-18 22:00:52 -07:00
Héctor Ramos 85fc98d437 Fix JUnit report location when running Jest
Summary:
We were incorrectly writing jest's junit output to ~/reports/ instead of ~/react-native/reports.

Run on Circle and confirm JUnit test results are rendered: https://circleci.com/gh/hramos/react-native/2208

[INTERNAL][MINOR][CI] - JUnit test collection

[skip ci]
Closes https://github.com/facebook/react-native/pull/19349

Differential Revision: D8062654

Pulled By: hramos

fbshipit-source-id: 72066270042dfae8afce62469fcfabb57bd405a6
2018-05-18 20:46:16 -07:00
Valentin Shergin caaea38ad9 Fabric: Using unique_ptr for storing YGNode inside YogaLayoutableShadowNode
Summary:
I recently realized (Thanks David!) that we should not use `shared_ptr` for storing YGNode*
because ShadowNode does not share ownership of the Yoga node with anybody.
So the lifecycle of shadow node and yoga node must be synchronized (this is already the case but changing to unique_ptr makes this explicit and a bit more performant).

Reviewed By: fkgozali

Differential Revision: D8030417

fbshipit-source-id: c7f85ea309598d2a5ebfed55b1d182d3fe1336ae
2018-05-18 20:34:18 -07:00
Sebastian Markbage 6cc597e6e4 Alternative Instance Handle Approach without JSWeakRef
Reviewed By: fkgozali

Differential Revision: D8003736

fbshipit-source-id: 597378555cc3f9c0ae95e8927460a3c813ebfb45
2018-05-18 20:22:45 -07:00
Sebastian Markbage f59e5a8d28 React sync for revisions de84d5c...c0fe8d6
Reviewed By: acdlite

Differential Revision: D8066469

fbshipit-source-id: e228df105c3d9a887793595073ebfe8a1a1d4f3d
2018-05-18 20:22:45 -07:00
zhongwuzw 17982094e5 Fix typo
Summary: Closes https://github.com/facebook/react-native/pull/19317

Differential Revision: D8061509

Pulled By: hramos

fbshipit-source-id: 4a2a066d477b090ee1568df234cfda67d5bbd0f8
2018-05-18 20:22:45 -07:00
Kevin Gozali 0afc70b24a iOS: Introduced ComponentDescriptorFactory to provide app specific component registry
Summary: Each app has its own set of components to support, so this mechanism allows each of them to customize the set. Core library only provides the signature (.h file) without any impl.

Reviewed By: shergin

Differential Revision: D8065360

fbshipit-source-id: c123397afda678e84f1d1fa41a6393f25b2c15e1
2018-05-18 19:46:32 -07:00
Peter van der Zee 67ec8498f7 Bump rn babel preset to 5.0.1
Reviewed By: rafeca

Differential Revision: D8047460

fbshipit-source-id: b666266a5e9162383bc807d5bf2d7d3ffa7b19d6
2018-05-18 09:11:11 -07:00
Peter van der Zee fbd1beaf66 Add automated script to update the babelHelpers file
Reviewed By: cpojer

Differential Revision: D8025371

fbshipit-source-id: 4811f16d882196bc32be7471b6a3ab4d834651c2
2018-05-18 06:09:26 -07:00
Héctor Ramos 129690fad1 Migrate to new GitHub issue templates
Summary:
This will allow us to present a user with a different template depending on the type of help they need.

To do:

1. Update the bot so that it auto-closes any issue that contains text from `question.md` (i.e. tried to ask a question through GitHub).
2. In a separate PR: new template to handle feature requests (update the bot to allow these to remain open)
3. Allow multiple other types of issues, such as requesting a cherry pick, or reporting a regression vs. something that does not work as expected.
4. Link to Stack Overflow / Discuss directly if and when GitHub allows the 'Get Started' button to point to a URL.
Closes https://github.com/facebook/react-native/pull/19334

Differential Revision: D8051229

Pulled By: hramos

fbshipit-source-id: 9e8aea232688c53dcbb0c047e92799e68b8b7842
2018-05-17 20:28:51 -07:00
Valentin Shergin cc09d21e60 Fabric: Simplifying usage of `ConcreteComponentDescriptor`
Summary:
Now ConcreteComponentDescriptor can infer `ComponentName` from `ShadowNodeT` automatically,
so in the most cases we even don't need to create a subclass of that.

Reviewed By: fkgozali

Differential Revision: D8016965

fbshipit-source-id: d910597093c9f4c9f32ca06cb3ef1b12538b9543
2018-05-17 20:28:50 -07:00
Valentin Shergin 8f507280ac Fabric: Removing default arguments from ShadowNode's constructors
Summary: We don't use them at all; moreover they complicate adding/changing signatures of those methods (because arguments with defaults must be grouped at the end and some arguments cannot have defaults).

Reviewed By: fkgozali

Differential Revision: D7981456

fbshipit-source-id: d7dd098e83630d1ab3342d2ca52ade9c4e27b2c3
2018-05-17 20:28:50 -07:00
Valentin Shergin 15cb6540c1 Fabric: ScrollView, the native part
Summary: Note: not all scrollview props and features (especially event listeners and imperative calls) are supported yet.

Reviewed By: fkgozali

Differential Revision: D7961868

fbshipit-source-id: 5277674fe976e089fd963066f78e705ad846d78d
2018-05-17 20:28:50 -07:00
Valentin Shergin bd99d3a6f4 Fabric: ScrollView: xplat part (shadow node, props, localdata, descriptor)
Summary:
All the props of a scrollview, and local data.
LocalData part is probably the most interesting: with it we precompute content size which we use inside native scrollview. Previously we rely on some assumptions like "ScrollView must have only one subview" instead, and that was not so efficient and straight-forward.

Reviewed By: fkgozali

Differential Revision: D7961869

fbshipit-source-id: fa070b8423a3e7739aeb62220e51213683e1a223
2018-05-17 20:28:50 -07:00
Valentin Shergin e3a3999b75 Fabric: ScrollView: primitives and buck target
Summary: Trivial.

Reviewed By: fkgozali

Differential Revision: D7961870

fbshipit-source-id: 3cfd92bd441dbf516ade777e6428924e9634257a
2018-05-17 20:28:50 -07:00
Jose Pereira b805172034 Clear _handlers on RCTNetworking invalidation
Summary:
This PR fixes a bug where in `RCTNetworking` not all tasks/handlers were not being cleared when invalidating the class.

I came across this issue when writing some unit tests for my native plugins, sometimes a test would finish running (and the bridge invalidated), and only afterwards a callback from RCTNetworking would come, resulting in this exception:

```
2018-05-07 15:23:34.264494-0700 Guardian[73794:10710945] *** Assertion failure in -[RCTEventEmitter sendEventWithName:body:](), /Users/.../app/node_modules/react-native/React/Modules/RCTEventEmitter.m:41
2018-05-07 15:23:34.276505-0700 Guardian[73794:10710945] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error when sending event: didCompleteNetworkResponse with body: (
    2,
    cancelled,
    0
). Bridge is not set. This is probably because you've explicitly synthesized the bridge in RCTNetworking, even though it's inherited from RCTEventEmitter.'
*** First throw call stack:
(
	0   CoreFoundation                      0x000000010d5b21e6 __exceptionPreprocess + 294
	1   libobjc.A.dylib                     0x000000010be6f031 objc_exception_throw + 48
	2   CoreFoundation                      0x000000010d5b7472 +[NSException raise:format:arguments:] + 98
	3   Foundation                          0x000000010b94864f -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 165
	4   Guardian                            0x0000000106ff5227 -[RCTEventEmitter sendEventWithName:body:] + 567
	5   Guardian                            0x0000000106e9ebab __76-[RCTNetworking sendRequest:responseType:incrementalUpdates:responseSender:]_block_invoke.423 + 1115
	6   Guardian                            0x0000000106e8f48c __50-[RCTNetworkTask URLRequest:didCompleteWithError:]_block_invoke + 92
	7   Guardian                            0x0000000106e8ded1 -[RCTNetworkTask dispatchCallback:] + 113
	8   Guardian                            0x0000000106e8f37a -[RCTNetworkTask URLRequest:didCompleteWithError:] + 410
	9   Guardian                            0x0000000106ea1aa3 -[RCTHTTPRequestHandler URLSession:task:didCompleteWithError:] + 403
	10  CFNetwork                           0x000000010cf3a437 __51-[NSURLSession delegate_task:didCompleteWithError:]_block_invoke.207 + 80
	11  Foundation                          0x000000010b885363 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 7
	12  Foundation                          0x000000010b8851ca -[NSBlockOperation main] + 68
	13  Foundation                          0x000000010b8836b2 -[__NSOperationInternal _start:] + 766
	14  libdispatch.dylib                   0x0000000112457779 _dispatch_client_callout + 8
	15  libdispatch.dylib                   0x000000011245c931 _dispatch_block_invoke_direct + 317
	16  libdispatch.dylib                   0x0000000112457779 _dispatch_client_callout + 8
	17  libdispatch.dylib                   0x000000011245c931 _dispatch_block_invoke_direct + 317
	18  libdispatch.dylib                   0x000000011245c7d4 dispatch_block_perform + 109
	19  Foundation                          0x000000010b87f75b __NSOQSchedule_f + 337
	20  libdispatch.dylib                   0x0000000112457779 _dispatch_client_callout + 8
	21  libdispatch.dylib                   0x000000011245f1b2 _dispatch_queue_serial_drain + 735
	22  libdispatch.dylib                   0x000000011245f9af _dispatch_queue_invoke + 321
	23  libdispatch.dylib                   0x0000000112461cf8 _dispatch_root_queue_drain + 473
	24  libdispatch.dylib                   0x0000000112461ac1 _dispatch_worker_thread3 + 119
	25  libsystem_pthread.dylib             0x000000011297a169 _pthread_wqthread + 1387
	26  libsystem_pthread.dylib             0x0000000112979be9 start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
```

Bug can be reproduced by making a `XMLHttpRequest` (uses `RCTNetworking` internally) that takes a couple seconds to perform, and issuing a RCTBridge reload command in the meantime.

You can add the following code to the react-native template project,

```
  componentDidMount() {
    var oReq = new XMLHttpRequest();
    oReq.addEventListener("load", () => console.log('Finished'));
    oReq.open("GET", "https://www.dropbox.com/s/o01hz0chqvjafhv/file.bin?dl=1");
    oReq.send();
    console.log('Request is being performed...')
  }
```
In my case I download a 1MB file.
Run the project and reload the a couple times. Bug is triggered.

 [INTERNAL] [BUGFIX] [RCTNetworking] - Clear handlers and tasks on RCTNetworking invalidation
Closes https://github.com/facebook/react-native/pull/19169

Differential Revision: D8053070

Pulled By: hramos

fbshipit-source-id: d8af54fecd99173905363f962ffc638ef8b85082
2018-05-17 19:10:48 -07:00
Janic Duplessis ce3b7b8204 Bring back TextInput.State, deprecate focusTextInput and blurTextInput
Summary:
a275eac56e removed TextInput.State but we should keep it as it was a public-ish API and we don't have any migration plan off it. Also bring back `focusTextInput` and `blurTextInput` with a deprecation warning.

Tested TextInput.State is back

[GENERAL][ENHANCEMENT][TextInput] - Bring back TextInput.State, deprecate focusTextInput and blurTextInput
Closes https://github.com/facebook/react-native/pull/18936

Differential Revision: D8044439

Pulled By: hramos

fbshipit-source-id: fde145f04bb1d46ef58b5954cb7963adf495b21c
2018-05-17 11:26:22 -07:00
David Vacca 4e1453eb01 Add RTL support for Fabric android rendering
Reviewed By: fkgozali

Differential Revision: D8035223

fbshipit-source-id: 22d702e487fd2c20cd03e5004d904ddfcfbdb55a
2018-05-17 10:22:40 -07:00
Dulmandakh 8dad3e4132 add google maven repo required by appcompat-v7 26
Summary:
add google maven repo required by appcompat-v7 26

CI will download appcompat-v7 version 26.0.2

[GENERAL][MINOR][Android] - add google maven repo required by appcompat-v7 26
Closes https://github.com/facebook/react-native/pull/19316

Differential Revision: D8039324

Pulled By: hramos

fbshipit-source-id: 3e9f4dd20560f4337e81967ee9b5c30ec61016de
2018-05-16 22:45:47 -07:00
Héctor Ramos 1e8a45f206 Remove checksum fallbacks to ensure clean installs
Summary:
If `package.json` has changed, let's throw away the cache and let yarn install do its thing.

Circle CI.

[INTERNAL][MINOR][CircleCI] - Remove checksum fallbacks
Closes https://github.com/facebook/react-native/pull/19303

Differential Revision: D8029286

Pulled By: hramos

fbshipit-source-id: 528681e4da9f0215bf63f9f8b3920a95036badca
2018-05-16 20:16:59 -07:00
David Vacca b1d646a7cd Add extra logging information for ReactShadowNode
Reviewed By: achen1

Differential Revision: D8020040

fbshipit-source-id: c0606eeeb14e89e52f2a0b5537418d88387e4e0a
2018-05-16 18:21:49 -07:00
Héctor Ramos 86b3865bfe Omit Fabric Yoga dependency in OSS
Reviewed By: achen1

Differential Revision: D8036707

fbshipit-source-id: 33c02ae28cecd7d470d0cd968589c65485857f6c
2018-05-16 17:54:59 -07:00
Kevin Gozali 128c9343c4 iOS: fix up RNTesterPods
Summary:
A few fixes:
* missing include: folly/Optional.h
* switch folly::Optional's `has_value()` to `hasValue()` for now until folly is upgraded to newer version
* fix up import for RCTTextAttributes.h
* fix up includes for "conversions.h" to use namespaced includes

Reviewed By: mmmulani

Differential Revision: D8021149

fbshipit-source-id: d3955986d3ab6b1d9b61ac1e385767893ce57e5e
2018-05-16 14:14:41 -07:00
Héctor Ramos 8c74864d7b Update Android packages cache key
Summary:
Packages are now defined in `scripts/.tests.env`, so the checksum is updated accordingly.

We also throw away the cache if the checksum fails as not doing so may prevent us from picking up new packages due to the filesystem check in `scripts/android-setup.sh`#getAndroidPackages(), as the presence of the `installed-dependencies` file restored from cache will incorrectly flag all deps as being installed.
Closes https://github.com/facebook/react-native/pull/19298

Differential Revision: D8025918

Pulled By: hramos

fbshipit-source-id: 189492baac2fea39280884ea20e376a368e23c2e
2018-05-16 08:57:01 -07:00
Valentin Shergin 48dccf18b8 Fabric: Making logging in FabricUIManager optional
Summary: Trivial.

Reviewed By: fkgozali

Differential Revision: D7961186

fbshipit-source-id: 703fa3b336e093c430d32ab08eafc42b1f590f32
2018-05-15 23:58:59 -07:00
Valentin Shergin 30d08ea8a4 Fabric: `EdgeInsets` from `dynamic` conversion
Summary: We will need this for several components, first of all for ScrollView.

Reviewed By: fkgozali

Differential Revision: D7958246

fbshipit-source-id: 364b939abe8f0734376448149bbdc735abd00189
2018-05-15 23:58:59 -07:00
Valentin Shergin 545f087b46 Fabric: Several helper functions for `react::Rect`
Summary: Trivial. We will need them soon at least for ScrollView.

Reviewed By: fkgozali

Differential Revision: D7958244

fbshipit-source-id: ce92c6e6181181ac17d817292af18ffa46a4d975
2018-05-15 23:58:59 -07:00
Valentin Shergin 57d69772b7 Fabric: Improved signature of `calculateMutationInstructions`
Summary: Apparently, `calculateMutationInstructions` must also produce mutation instructions for root node as well. To make it possible we have to change the signature of the function and weak some restrictions in TreeMutationInstruction.

Reviewed By: fkgozali

Differential Revision: D7958248

fbshipit-source-id: 4109a6bce3a77f7eb89157201fd0e80f98487dbd
2018-05-15 23:58:59 -07:00
Valentin Shergin 10c5368c37 Fabric: Fixed issue where root shadow node does not layout itself
Summary: Conceptually, it always must be node owner's responsibility, but for the root node, we have to make an exception because there is no another parent node and there is no another component which has access to YogaNode.

Reviewed By: fkgozali

Differential Revision: D7958251

fbshipit-source-id: 0bdaea87adbd323c758bc3c28f325be615aa90f3
2018-05-15 23:58:59 -07:00
Héctor Ramos 274c1757e6 Make Android build tools 26.0.3 available to CI
Summary:
a3931e9531 bumped buildToolsVersions to 26.0.3, and `test_android` started failing because that particular build tools version was not getting installed in CircleCI.
Closes https://github.com/facebook/react-native/pull/19276

Differential Revision: D8020664

Pulled By: hramos

fbshipit-source-id: 561aa8186ed165b3652923a9bcaf56134acfd90b
2018-05-15 23:12:53 -07:00
Héctor Ramos 2472d915ab Consolidate CI/local test scripts
Summary:
Update `scripts/run-android-emulator.sh` to use same settings as Circle CI when creating and launching an AVD. This helps provide a known good configuration, useful for running Android tests locally.

Run `scripts/run-android-emulator.sh` and confirm AVD is created && launched
Run `scripts/run-android-emulator.sh` again and see message about AVD already running
Run `test_android` on CI and observe AVD is launched.

Run `runXcodeTests.sh` and confirm unit tests run.
Run CI and confirm iOS unit tests run.

[GENERAL][MINOR][`scripts`] - Consolidate CI/local test scripts
Closes https://github.com/facebook/react-native/pull/19228

Differential Revision: D8019888

Pulled By: hramos

fbshipit-source-id: 28b12c2e781ee80bcc90c22e691a5acb16232369
2018-05-15 17:27:52 -07:00