Commit Graph

179 Commits

Author SHA1 Message Date
Marc Horowitz 9a61628f13 Clean up the interface to the bridge
Summary: Change the following classes into interfaces, with a separate
Impl file:  CatalystInstance, ReactInstanceManager,
CatalystQueueConfiguration, MessageQueueThread.  This is done to help
isolate the interface between React Native and applications which use it.
This will also help some intrusive development work on a branch
such as porting parts of the bridge to common C++ code, without affecting
app reliability while this work is ongoing.
public

Reviewed By: astreet

Differential Revision: D2651277

fb-gh-sync-id: f04dc04a6e68df7acbc2bbf8b2529287d7b5b2ae
2015-11-20 12:30:30 -08:00
Marc Horowitz facf8a56d2 minor build cleanups
Summary: make DevSupportManager PUBLIC visibility, instead of adding
to it more; put private parts of OnLoad into an anonymous namespace,
and move NativeRunnable into it; don't make NativeArray depend on
MethodCall which it does not use.
public

Reviewed By: astreet

Differential Revision: D2651270

fb-gh-sync-id: d5262da79cbd60c4eb490d43d13cc625fa163cdf
2015-11-20 12:29:33 -08:00
Marc Horowitz c8f3b43984 Don't use the Bridge from CatalystInstance.
Summary: getBridge() is annotated VisibleForTesting, but still used
in DevSupportManager.  Instead, add the necessary methods to the
CatalystInstance interface.
public

Reviewed By: astreet

Differential Revision: D2651265

fb-gh-sync-id: 395893a961c32843871de4451eeccb33135b7ede
2015-11-20 12:29:27 -08:00
Marc Horowitz 5b6b5a64d1 Split JavaSJExecutor and ProxyExecutorException into their own file
Summary: This makes the exception a nested class of the interface,
which eliminates the dependency of DevSupportManager on
ProxyJavaScriptExecutor.
public

Reviewed By: astreet

Differential Revision: D2651252

fb-gh-sync-id: 99de1c308b9bce717ab749c4e239d2773a920e1f
2015-11-20 12:29:20 -08:00
Marc Horowitz 67209e6396 If fbsystrace is running when catalyst starts, it asserts
Summary: registering with systrace checks if the bridge is
initialized, which it's not yet in the ctor.  Defer registration until
after the bridge is created, and only unregister in that case.
public

Reviewed By: astreet, dreiss

Differential Revision: D2651244

fb-gh-sync-id: 8da1108e9d15fddde48d06f4ed61ee0f787016ad
2015-11-20 10:10:29 -08:00
Saurabh Aggarwal a7c4ed106b Adds stetho interceptor to the OSS react native networking module
Reviewed By: mkonicek

Differential Revision: D2669416

fb-gh-sync-id: d061711a412348b16ffb877e0178a05460fd95f2
2015-11-20 09:44:27 -08:00
Krzysztof Magiera 205a35ad37 View recycling in JS.
Summary: public
Native view recycling implementation based on limited pools of views.

In this diff I introduced new UIManager method: dropViews. Instead of removing views from tag->view maps when they are detached we keep them there until we get a call to dropViews with the appropriate tag. JS may keep a pool of object and selectively decide not to enqueue drop for certain views. Then instead of removing those views it may decide to reuse tag that has been previously allocated for a view that is no longer in use.

Special handling is required for layout-only nodes as they only can transition from layout-only to non-layout-only (reverse transition hasn't been implemented). Because of that we'd loose benefits of view flattening if we decide to recycle existing non-layout-only view as a layout-only one.

This diff provides only a simple and manual method for configuring pools by calling `ReactNativeViewPool.configure` with a dict from native view name to the view count. Note that we may not want recycle all the views (e.g. when we render mapview we don't want to keep it in memory after it's detached)

Reviewed By: davidaurelio

Differential Revision: D2677289

fb-gh-sync-id: 29f44ce5b01db3ec353522af051b6a50924614a2
2015-11-20 08:11:36 -08:00
Krzysztof Magiera 0c8850f3a7 Only send layout update operation to nativehierarchymanager when layout actually changes.
Reviewed By: andreicoman11

Differential Revision: D2679408

fb-gh-sync-id: 7f0a972e9e12f70402e2d285edef458a61ca1c39
2015-11-20 08:04:29 -08:00
Krzysztof Magiera 1195f9c8e8 Further improvements in RecyclerViewBackedScrollView.
Summary: public
Changed ListView to use onLayout and onContentSizeChange (new) events instead of measure. Updated ScrollView implementation to support contentSizeChange event with an implementation based on onLayout attached to the content view. For RecyclerViewBackedScrollView we need to generate that event directly as it doesn't have a concept of content view.
This greatly improves performance of ListView that uses RecyclerViewBackedScrollView

Reviewed By: mkonicek

Differential Revision: D2679460

fb-gh-sync-id: ba26462d9d3b071965cbe46314f89f0dcfd9db9f
2015-11-20 07:44:31 -08:00
Krzysztof Magiera 7cd7591f04 Use requireNativeComponent in View.js.
Summary: public
In a previous diff I've removed a need for using View attributes in requireNativeComponent. Thanks to that we can now use requireNativeComponent in View module. In a follow up diff I'll be getting rid of ReactNativeViewAttributes.

Reviewed By: sahrens

Differential Revision: D2676088

fb-gh-sync-id: d5d6e50f4629bd7982b90f3496e1fd22078e96a8
2015-11-20 02:09:38 -08:00
Mike Armstrong 3e7db56445 Fix multiple calls to createReactContextInBackground
Reviewed By: astreet

Differential Revision: D2674440

fb-gh-sync-id: f842826516d2b03291ad0c4bf5c8dcbf8ec0f3a9
2015-11-19 08:20:26 -08:00
Mike Armstrong 2a9a5fc9e8 css layout systrace markers
Reviewed By: astreet

Differential Revision: D2668741

fb-gh-sync-id: 043ff740f8cc7c687a79c50c933db99ed67b60e4
2015-11-19 06:52:27 -08:00
Andy Street 530ee3eeac Initialize JS executor and context at loadApp time
Summary: Automatically starts loading the RN instance as soon as loadApp is called instead of waiting for the UI to be constructed and attached to the window. This saves ~75ms of cold start time on GN 2011 phones.

Also, updates the contract for createReactContextInBackground such that it is only called once (so that people don't accidentally initialize more than once).

See http://imgur.com/a/d7qVm for systrace visualization.

public

Reviewed By: kmagiera

Differential Revision: D2652279

fb-gh-sync-id: 6e7b1fa5dea091af0d568834e11ed23eb1a7860e
2015-11-18 12:40:27 -08:00
Martin Konicek 494930afb2 Open source the Android Location module
Reviewed By: foghina

Differential Revision: D2658581

fb-gh-sync-id: e95b21c5c7c06f3332d2a7c9fab8be9a2e6441cb
2015-11-18 10:15:21 -08:00
Krzysztof Magiera 9e670a64fc Fix resetting margins and borders on android.
Summary: public

Instead of using 0 as a default we should use UNDEFINED values. That is because setting 0 for left border in case when the property was deleted will interfere with horizontal border (or margin) value. Setting UNDEFINED makes CSSLayout nodes behave correctly in that case.

Reviewed By: andreicoman11

Differential Revision: D2668669

fb-gh-sync-id: 61ce62081583fc39864268333ac8c1409c276cad
2015-11-18 08:41:28 -08:00
Krzysztof Magiera e6093cff04 Use requireNativeComponent with propTypes for Android components.
Reviewed By: davidaurelio

Differential Revision: D2663502

fb-gh-sync-id: 550e7b7c783ec0463a6beb052c09a768a8086056
2015-11-18 06:36:28 -08:00
Andrei Coman 32c19c1994 Fix setting js responder for null react view for tag
Reviewed By: kmagiera

Differential Revision: D2637015

fb-gh-sync-id: 03af870cee82519ed34a4bbbcbd2c72146fcf00f
2015-11-18 04:28:27 -08:00
Felix Oghină e22fb312d2 reorder dev menu, surface live reload and perf monitor
Differential Revision: D2663707

fb-gh-sync-id: 42663a14e1bda7896867692473ae0bf3753aafe2
2015-11-17 08:14:27 -08:00
Felix Oghină 8491b579c8 fix inspecting text elements
Differential Revision: D2663651

fb-gh-sync-id: 2b583fecf5fa7a88f071a7441d03b95d21b8620f
2015-11-17 07:58:26 -08:00
Andrei Coman fc511f0730 Don't send same text changes from text input
Differential Revision: D2663576

fb-gh-sync-id: 259040eda54982c10374f9f1ee89f67a459937d0
2015-11-17 07:30:31 -08:00
Alexander Blom 532c9112b4 Send HEADERS_RECEIVED and LOADING events on Android
Summary: Send part of the response body every 100 ms if the client has set onreadystatechange. This
is done by using the same events as the iOS code and removing the callback that Android previously
used.

Reconsolidate iOS and Android implementations.

Closes #3772

(The previous commit was reverted)

public

Reviewed By: astreet

Differential Revision: D2658153

fb-gh-sync-id: b1a32d22db7cc2995c673edd31f4bbaf16ca36cb
2015-11-17 06:31:31 -08:00
Krzysztof Magiera 337dc7e093 Cleanup mNativeChildren on react node cleanup.
Differential Revision: D2663443

fb-gh-sync-id: 7e6e7212103b738f6b6f535e54cc8b86e5def685
2015-11-17 05:47:25 -08:00
Krzysztof Magiera bd1885b5d4 Cleanup native view hierarchy when view is dropped.
Differential Revision: D2659738

fb-gh-sync-id: 1c14b8c3c6fabbd0e580777bb94221df6dd98f71
2015-11-17 02:06:28 -08:00
olivier notteghem e4f0971a55 Re-land D2656590 in iOS repo which is the source of truth
Reviewed By: newobj

Differential Revision: D2660019

fb-gh-sync-id: 7cc183888f88d9971f59b23f45a86b5aa0391909
2015-11-16 13:54:30 -08:00
Mike Armstrong 619da521f3 Enable javascript systrace markers via js module
Differential Revision: D2658662

fb-gh-sync-id: 042377551f9dacc0a9d12728edfa54a57c617cf4
2015-11-16 09:46:34 -08:00
Mike Armstrong 2f9e7be04b fix output leaving bad characters in systrace output buffer due to overstepping bytes written
Differential Revision: D2658628

fb-gh-sync-id: e4c9dc66746177d371331d79972f1322239b4ea7
2015-11-16 09:39:31 -08:00
Nathan Spaun 39ec693866 revert D2631410
Differential Revision: D2655673

fb-gh-sync-id: 115247373767690e63a0d6ce812a578d26b47289
2015-11-13 17:51:30 -08:00
Dave Miller a0268a7bfc Initial checkin for Image within Text nodes
Summary: This adds the basic support for embedding an image in a TextView.

Implementation details :

We create a ReactTextInlineImageShadowNode whenever an Image is embedded within a Text context.
That uses the same parsing code as ReactImageView (copied, not shared) to parse the source property to figure out the Uri where the resource is.

In ReactTextShadowNode we now look for the ReactTextInlineImageShadowNode and place a TextInlineImageSpan so that we can layout appropriately

Later at the time we go to setText on the TextView, we update that TextInlineImageSpan so that the proper Drawable (downloaded via Fresco) can be shown

public

Reviewed By: mkonicek

Differential Revision: D2652667

fb-gh-sync-id: 8f24924d204f78b8bc4d5d67835cc73b3c1859dd
2015-11-13 11:16:27 -08:00
Brent Vatne 50b8b00768 Add setPageWithoutAnimation
Summary: In some cases it's desirable to set the page in the ViewPager without animating it -- we have this in ScrollView with `scrollWithoutAnimationTo`. This PR adds `setPageWithoutAnimation` on ViewPager.

cc ide kmagiera
Closes https://github.com/facebook/react-native/pull/3621

Reviewed By: svcscm

Differential Revision: D2652056

Pulled By: mkonicek

fb-gh-sync-id: 6f1f38558c41ffdd863c0ebb2f046c75b5c0392c
2015-11-13 08:05:27 -08:00
Alexander Blom 4d4c48d32b Send HEADERS_RECEIVED and LOADING events on Android
Summary: Send part of the response body every 100 ms if the client has set onreadystatechange. This
is done by using the same events as the iOS code and removing the callback that Android previously
used.

Reconsolidate iOS and Android implementations.

Closes #3772

public

Reviewed By: mkonicek

Differential Revision: D2647005

fb-gh-sync-id: d006e566867fa47d5f8dff71219cb390bcb8e15a
2015-11-13 07:28:28 -08:00
Martin Konicek ab7b3b2dea Open source IntentAndroid
Summary: Move the code to the github folder, add more docs and improve the example.

We might want to merge this with `LinkingIOS` later (it has the same functionality
plus support for deep links) but want to see how people use the `IntentAndroid`
API first (and what other methods we should add) to have more data points.

public

Reviewed By: lexs

Differential Revision: D2646936

fb-gh-sync-id: 751f35784d387efcd031f9b458821cdfde048a54
2015-11-12 12:41:32 -08:00
Andrei Coman 8ca22fc2df Fix typeface getting applied recursively without new style
Differential Revision: D2643562

fb-gh-sync-id: 0db52c223d4941c89f2253bb3f4b2a5af8341ecf
2015-11-11 13:11:28 -08:00
Krzysztof Magiera d8032b1c7d Upgrading okio and fresco.
Reviewed By: foghina

Differential Revision: D2636757

fb-gh-sync-id: 82dee46232ac2654870f727633604c86d569005e
2015-11-11 01:55:30 -08:00
Krzysztof Magiera 5695ebdcf4 Perf improvements to RecyclerViewBackedScrollView.
Differential Revision: D2641500

fb-gh-sync-id: 7ec6e2863bccebc98f75f586c0f17d509808d46b
2015-11-11 01:21:26 -08:00
Andy Street f00e748ebd Cleanup for inlines in D2595474
Differential Revision: D2637224

fb-gh-sync-id: 6947a06e2f2b9606fff84addec69dbc51cee84da
2015-11-10 10:24:29 -08:00
Krzysztof Magiera caf111eb23 Update okhhtp version to 2.5
Reviewed By: andreicoman11

Differential Revision: D2636394

fb-gh-sync-id: 1f4df9ae879e16f13c5343baed85a91469d88cff
2015-11-10 03:20:29 -08:00
Felix Oghină 0c27c3fde9 A bit of JavaClass refactoring
Differential Revision: D2636047

fb-gh-sync-id: 72e06634ca94f03a6ec6d4aa733be38e7157cf8a
2015-11-09 22:05:29 -08:00
Felix Oghină dd8ee4ad75 remove extraneous dimension conversion
Differential Revision: D2635753

fb-gh-sync-id: dd7d965ceb90c2c4771d4d28bbc6ec9ef97eca0c
2015-11-09 19:47:29 -08:00
Peter Lai de4cb7d403 Fix crash when double launching activity
Reviewed By: AaaChiuuu

Differential Revision: D2633573

fb-gh-sync-id: c47bec903d54c12f4d9e576ad1aaf16d4bd68f30
2015-11-09 14:56:27 -08:00
Krzysztof Magiera c6532a94a6 Fix default values for translateX/Y props.
Reviewed By: andreicoman11

Differential Revision: D2631186

fb-gh-sync-id: 8f898b11be31b253780474d1cf328d7d109decbb
2015-11-09 07:55:27 -08:00
Dmitry Gladkov b12117a038 Fix View translations in Android
Summary: Fixes regression in bf59864

Closes #3773
Closes https://github.com/facebook/react-native/pull/3954

Reviewed By: svcscm

Differential Revision: D2631180

Pulled By: kmagiera

fb-gh-sync-id: 09a1a2e48fd6fff37d1491c120a28221cdc1b163
2015-11-09 00:02:19 -08:00
Pasquale Anatriello bfeaa6a4f5 Custom fonts support added
Reviewed By: andreicoman11

Differential Revision: D2629077

fb-gh-sync-id: 8d647aff13f97d90c5047ad0ddbcae90215ca4ca
2015-11-06 18:15:31 -08:00
Andy Street 853d249468 Add Systrace support for API 18+ in OSS
Differential Revision: D2627757

fb-gh-sync-id: a01347800d8e9ffda8759cc17df04f7cd139b17c
2015-11-06 14:02:35 -08:00
Adrov Igor b6340ee2b0 implement android maxlength prop
Summary: Fixes https://github.com/facebook/react-native/issues/3864
But I don't sure that this code is correct.

But it works and works same as in iOS.
Closes https://github.com/facebook/react-native/pull/3873

Reviewed By: mikearmstrong001

Differential Revision: D2626122

Pulled By: andreicoman11

fb-gh-sync-id: 316915c99b218ed5f32ca90fd72ce9810571383a
2015-11-06 13:25:34 -08:00
Alexander Blom 527d11ce01 Support progress in ProgressBarAndroid
Differential Revision: D2626321

fb-gh-sync-id: a358a1db8c8f3b4a41dc9a600ee691e6e60310f3
2015-11-06 12:08:29 -08:00
Felix Oghină 9647c5a257 show script eval errors in redbox
Differential Revision: D2624801

fb-gh-sync-id: 48741a8caf029415753a4c616a07f18d3660e6fb
2015-11-06 11:43:30 -08:00
Andrei Coman de586bfa18 Fix text input spans
Differential Revision: D2626072

fb-gh-sync-id: 35087d65b8f4a52e44fedc229058c3f88827e539
2015-11-06 08:23:29 -08:00
Pieter De Baets 9d76acc3d6 Fix android log level offset
Reviewed By: andreicoman11

Differential Revision: D2625742

fb-gh-sync-id: a373e85b7dd2e0fcb904b61a7728b16f4836c742
2015-11-06 05:02:45 -08:00
Alexander Blom a797be6ffd Support 'color' attribute in ProgressBarAndroid
Differential Revision: D2625690

fb-gh-sync-id: 34ef656be7ce3304add3fae3e697c6b39b866af1
2015-11-06 02:34:32 -08:00
Krzysztof Magiera 6a656a1491 Speedup gradle builds by setting explicit deps on prepareBoost task.
Differential Revision: D2625574

fb-gh-sync-id: db0887e184a6d098699c9f84a2c3cb0d3b7e7b0f
2015-11-06 00:22:28 -08:00