Commit Graph

1273 Commits

Author SHA1 Message Date
Michał Gregorczyk 2ca507bf9e Remove supported platforms from JSC and all the things that depends on it
Reviewed By: bnham

Differential Revision: D4213580

fbshipit-source-id: 3830c15b0097030a4e4611aac814b12e1d6ae696
2016-11-21 16:43:31 -08:00
Michał Gregorczyk b1bdae99c0 Use jni int types rather than uint64/32/16_t in JSCPerfLogging.cpp
Reviewed By: bnham

Differential Revision: D4213497

fbshipit-source-id: 47e0e7d72891e1070c350a60fb7d3597e99d49a1
2016-11-21 16:43:31 -08:00
Emil Sjolander e1df3c8782 Add aspectRatio style property
Reviewed By: gkassabli

Differential Revision: D4211458

fbshipit-source-id: f8d0d318369c7b529ee29e61a52b17d0cf3b396d
2016-11-21 10:13:34 -08:00
Andy Street 48bb3648c5 Drop CSSNode pool on low memory when app is backgrounded
Summary:
Depends on D4189532

Drops the CSSNodePool when memory gets low.

Reviewed By: emilsjolander

Differential Revision: D4190264

fbshipit-source-id: 94cd36d877372e0d6ebdd989661af74bde41486d
2016-11-21 09:13:37 -08:00
Andy Street bd8745b1fd Recycle CSSNodes
Summary: Adds a pool to recycle CSSNodes within UIManager. A follow-up diff will hook this up to a memory pressure listener to drop the pool on memory pressure.

Reviewed By: emilsjolander

Differential Revision: D4189532

fbshipit-source-id: 46583546f71a8c59853e1dd124de31657b3c617b
2016-11-21 09:13:37 -08:00
Andy Street d63ba47b59 BREAKING [react_native] Move to new C-based implementation of css-layout in RN Android
Summary:
Moves from CSSNodeDEPRECATED to CSSNode. This has shown to be a huge performance win for layout time within FB.

This is BREAKING because CSSNode contains bug fixes that were not migrated to CSSNodeDEPRECATED which may change the way your layout appears. The most common of these by far involves `flex: 1`.

Previously, developers had to put `flex: 1` in many places it didn't belong in order to work around a bug in css-layout. Now `flex: 1` is treated properly and, unfortunately, this means that your layout may no longer look correct. Specifically, you may see that your layout looks collapsed, or children don't render. The fix is to simply remove `flex: 1` from those containers.

Reviewed By: emilsjolander

Differential Revision: D3992787

fbshipit-source-id: 7a3a2a34a8941c0524e6ba3c5379e434d3e03247
2016-11-21 06:28:30 -08:00
Emil Sjolander 15f848e8d8 Only skip updating computed flex basis within the same generation
Reviewed By: dshahidehpour

Differential Revision: D4207106

fbshipit-source-id: fc1063ca79ecf75f6101aadded53bca96cb0585d
2016-11-20 05:13:28 -08:00
Pieter De Baets 892231545b Remove duplicate definition of nativeLoggingHook
Reviewed By: lexs

Differential Revision: D4160267

fbshipit-source-id: 8e23ea355095f1f94610068010b7cdf385d69e40
2016-11-18 06:28:48 -08:00
leeight 1604f10889 Cleanup import *
Summary:
Cleanup import * from some java files.

**Test plan (required)**

manually run `./scripts/run-android-local-unit-tests.sh`
Closes https://github.com/facebook/react-native/pull/11009

Differential Revision: D4204415

Pulled By: javache

fbshipit-source-id: 52579c05f44471988671e7dcdcf6109203e20929
2016-11-18 05:58:25 -08:00
Kazuki Sakamoto 2af1de283c CSSNodeCopyStyle API for Java and C#
Reviewed By: emilsjolander

Differential Revision: D4189954

fbshipit-source-id: 10759fdb27bf67350d3151614f7815aa09bf7e04
2016-11-17 09:13:32 -08:00
Michał Gregorczyk 32670371e4 Evacuate unpacking logic from RN
Reviewed By: amnn

Differential Revision: D4186902

fbshipit-source-id: 02d8fe176940a678dc8f8d9c0bcf43732f45bde5
2016-11-17 03:13:44 -08:00
Emil Sjolander a07abe7188 Correctly translate nowrap -> NO_WRAP
Summary: The java enum was recently changed from NOWRAP -> NO_WRAP so the translation from js failed. This fixes that.

Reviewed By: limichaelc

Differential Revision: D4186869

fbshipit-source-id: fe35211a6632d80356d35a01a079279ef4bd7006
2016-11-15 18:58:37 -08:00
Andrew Jack c2a55baf80 Prevent hitslop crash on Android
Summary:
**Motivation**
Currently to use the `hitSlop` property on Android you must define the object properties `left`, `top`, `right`, and `bottom` or it will crash. iOS allows omitting object properties from the hitSlop.

This change guards and allows the `hitSlop` object properties to be optional like iOS.

**Test plan (required)**

Run the [example](f930270b00/Examples/UIExplorer/js/TouchableExample.js (L318)) and omit a hitslop property and check it does not crash.
Closes https://github.com/facebook/react-native/pull/10952

Differential Revision: D4182815

Pulled By: ericvicenti

fbshipit-source-id: 07d7aca67b5739d5d1939b257476c24dcb10cbb0
2016-11-15 09:29:06 -08:00
Alexander Blom f571d28e68 Allow launching inspector from dev menu
Reviewed By: davidaurelio

Differential Revision: D4095356

fbshipit-source-id: 46e43578cdcd663316efb82dffde27b77294c5c0
2016-11-15 08:59:02 -08:00
Alexander Blom 18184a83f1 Make Android connect to the inspector proxy
Summary: Maintains a single persistent connection to the packager for the inspector. It supports getting the available pages and connecting to them.

Reviewed By: foghina

Differential Revision: D4088690

fbshipit-source-id: 0c445225f5a3de573b199e7868c8693b78f45729
2016-11-15 08:59:02 -08:00
Andy Street c94a71e5bd Sort BUCK deps in open source
Reviewed By: emilsjolander

Differential Revision: D4182733

fbshipit-source-id: 245982d8155a5c3676befc2b0f2056f43f648dbc
2016-11-15 08:59:01 -08:00
Emil Sjolander ffcdf25281 Autogenerate enum defenitions for all languages
Reviewed By: gkassabli

Differential Revision: D4174263

fbshipit-source-id: 478961a8f683e196704d3c6ea1505a05c85fcb10
2016-11-15 08:44:30 -08:00
Andy Street c04ab92192 Use -O3 to compile CSSLayout in open source
Summary: This is how we compile internally

Reviewed By: emilsjolander

Differential Revision: D4182691

fbshipit-source-id: 314b1a1ead7d299677ce7f71549c986e1b796b3b
2016-11-15 08:28:56 -08:00
Andy Street 3b20a39f7b Move ReactCommon/CSSLayout to ReactCommon/CSSLayout/CSSLayout
Reviewed By: emilsjolander

Differential Revision: D4182345

fbshipit-source-id: 05cb4f0b0e7971d4f66e656ea89d876264a61bd4
2016-11-15 06:28:45 -08:00
Andy Street 7cf27cfea6 Add jni-hack to RN OSS
Summary: See committed README.md. This is part of the migration to the jni implementation of CSSLayout.

Reviewed By: emilsjolander

Differential Revision: D4177009

fbshipit-source-id: f1860f5d4ffafa1375a9658227e0ac10b7df4845
2016-11-15 05:13:37 -08:00
Adam Comella e87e181998 Android: Expose Image's onError event to JavaScript
Summary:
iOS supports an Image onError event. Android was firing the event but it was never reaching JavaScript because Android didn't include this event in `getExportedCustomDirectEventTypeConstants`.

**Test plan (required)**

Verified that the `onError` event now fires in a test app.

My team uses this change in our app.

Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/10902

Differential Revision: D4180149

Pulled By: ericvicenti

fbshipit-source-id: 4bf0b9aa7dc221d838d7b6b3e88bb47196dcadef
2016-11-14 19:43:58 -08:00
Pete Huitsing 191db90345 Prevent null header value from raising exception
Summary:
In the wild, our app will occasionally crash with:
```
Fatal Exception: java.lang.NullPointerException
value == null
```

The stack trace brings it back to `okhttp3.Headers$Builder.checkNameAndValue (Headers.java:316)`:
```
if (value == null) throw new NullPointerException("value == null");
```

In the proposed fix, we simply continue the documented functionality of the `extractHeaders` method by returning "null" for invalid data.
Closes https://github.com/facebook/react-native/pull/10861

Differential Revision: D4178624

Pulled By: ericvicenti

fbshipit-source-id: 632e742196339639cb57ea47f9d0efbf04f090be
2016-11-14 19:43:58 -08:00
Adam Comella 9a8b5d9f4f Android: Disable debug menu when monkey is running
Summary:
When testing an app on Android using the monkey, the monkey shouldn't be able to open or interact with the dev menu.

**Test plan (required)**

My team uses this change in our app.

Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/10901

Differential Revision: D4176167

Pulled By: ericvicenti

fbshipit-source-id: 8eb64715ae7496cdf957ee963777f66ab358546c
2016-11-14 16:58:55 -08:00
Charles Chen 72b517049a Add a debug support to load js bundle from external URL
Summary: Code refactoring on the dev support class. The idea is to make the code more modular.

Reviewed By: mhorowitz

Differential Revision: D4164676

fbshipit-source-id: 0d29bdaf927cd0e9f399fe6f8e46a16dfa65fb69
2016-11-14 11:43:49 -08:00
Christian Brevik da4df3f12f Make ReactWebView & Client protected
Summary:
I'd like to make `ReactWebView` and `ReactWebViewClient` `protected` instead of `private`, inside the `ReactWebViewManager` class. The reason being that if you extend the `ReactWebViewManager` it'll be much easier to override existing logic.

In my specific case I'd like to be able to override [shouldOverrideUrlLoading](https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/views/webview/ReactWebViewManager.java#L120) inside `ReactWebViewClient` and handle custom URL schemes differently. See #10055.
Closes https://github.com/facebook/react-native/pull/10105

Differential Revision: D4168359

Pulled By: hramos

fbshipit-source-id: ff6cbcf1d56536f0db0d2eea937de2cc065a09f9
2016-11-14 11:28:47 -08:00
king6cong eeba5eb774 fix typo
Summary: Closes https://github.com/facebook/react-native/pull/10872

Differential Revision: D4176240

Pulled By: ericvicenti

fbshipit-source-id: 3b3e9ccb3c456b9b76a1d34322cc12f795e36247
2016-11-14 10:43:38 -08:00
Andy Street 10e0aec62f Update ReactShadowNode to not add CSSNode children if parent has measure defined
Summary: See inline comment for rationale

Reviewed By: emilsjolander

Differential Revision: D4154168

fbshipit-source-id: 6d428d4e9f4a68c88bb994ded88c817bee744563
2016-11-14 07:13:54 -08:00
Andy Street 07ef5a8fe9 Build C-version of CSSLayout in open source
Summary: Builds and ships libcsslayout.so with Android builds. This is not used yet, but a follow up diff will shortly move us from CSSNodeDEPRECATED to CSSNode (which uses libcsslayout)

Reviewed By: emilsjolander

Differential Revision: D4168140

fbshipit-source-id: d72bded88df81e4d54df31a08e4b101834770a73
2016-11-14 06:13:48 -08:00
Andy Street 0df65bb7d4 BREAKING [react_native/css_layout] Update RN shadow nodes to hold CSSNode instead of extending CSSNode
Summary:
This diff makes it so ReactShadowNode holds a CSSNode instead of extending one. This will enable us to pool and re-use CSSNodes and will allow us to keep from breaking the CSSNode api assumption that nodes that have measure functions don't have children (right now, text nodes have measure functions, but they also have raw text children).

BREAKING
This diff makes ReactShadowNode no longer extend CSSNodeDEPRECATED. If you have code that depended on that, e.g. via instanceof checks, that will no longer work as expected. Subclasses that override getChildAt/addChildAt/etc will need to update your method signatures. There should be no runtime behavior changes.

Reviewed By: emilsjolander

Differential Revision: D4153818

fbshipit-source-id: 2836434dd925d8e4651b9bb94b602c235e1e7665
2016-11-14 04:43:40 -08:00
Emil Sjolander 307871e854 Implement standard interface for toggling experimental features
Reviewed By: gkassabli

Differential Revision: D4174260

fbshipit-source-id: ad3667183810c02833fba9a1276f89286e848fcd
2016-11-14 03:28:39 -08:00
Emil Sjolander a2cafb062e rename CSSWrapType to shorter CSSWrap matching java and csharp
Reviewed By: gkassabli

Differential Revision: D4174257

fbshipit-source-id: ba0bfab996ba158b07863d8c72cf2a41262c9592
2016-11-14 03:28:38 -08:00
Michał Gregorczyk c612c61544 Make UnpackingJSBundleLoader.prepare a public API.
Reviewed By: brosenfeld

Differential Revision: D4161585

fbshipit-source-id: b3b835610d11e043d2406cccff2da27f07878acc
2016-11-12 14:43:48 -08:00
Andy Street 974eec8264 Add CSSLayout to ReactCommon
Summary: First step to sharing CSSLayout code between iOS and Android.

Reviewed By: emilsjolander

Differential Revision: D4160286

fbshipit-source-id: 976f5820b19a7011e0a14317c858465f932e1f59
2016-11-11 10:58:55 -08:00
Emil Sjolander 867ea1bfaf Expose CSSLayoutSetLogger to java
Reviewed By: astreet

Differential Revision: D4153502

fbshipit-source-id: 630909d9d0d36d94d7cd3027476ddb52668b8cc0
2016-11-11 08:13:34 -08:00
Ryan Gomba 6f5433febe Proper NativeAnimated node invalidation on Android
Summary:
This diff attempts to fix a number of Android native animation bugs related to incomplete node invalidation, e.g. https://github.com/facebook/react-native/pull/10657#issuecomment-258297467.

For full correctness, we should mark any node as needing update when it is:

- created
- updated (value nodes)
- attached to new parents
- detached from old parents
- attached to a view (prop nodes)

cc/ janicduplessis
Closes https://github.com/facebook/react-native/pull/10837

Differential Revision: D4166446

fbshipit-source-id: dbf6b9aa34439e286234627791bb7fef647c8396
2016-11-11 01:13:36 -08:00
Rene Weber 868fbeaa00 Make sure to re-calculate step if not explicitly set
Summary:
This causes the step to be re-calculated on every update of min, max and step value,
to use the most up to date values for the calculation,
except if step is explicitly set to a non-zero value by the user.

Fixes #10253

**Test plan (required)**
1. Create example app
2. Create a view with a slider that has a `value`, `minimumValue` and `maximumValue` set, but no step value (or step value set to 0).

   For example:

   ```
   <Slider
       maximumValue={10}
       minimumValue={1}
       value={4}
       />
   ```
3. See slider working as expected
Closes https://github.com/facebook/react-native/pull/10343

Differential Revision: D4142646

Pulled By: hramos

fbshipit-source-id: a0df87bbdbbd4b2a291d89f5579f73f517a33dfc
2016-11-09 19:58:39 -08:00
Andrew Y. Chen 1e57d1156f Remove OnGenericMotionListener from ImmersiveReactFragment
Differential Revision: D4150394

fbshipit-source-id: 0ed3e42e1bda38283c9e66adde703ee9f9a96e61
2016-11-08 16:58:43 -08:00
Michał Gregorczyk 75d940d541 3 more `ReactMarker`s for unpacking bundle to disk.
Reviewed By: martinbigio

Differential Revision: D4147688

fbshipit-source-id: 44099bbfaa573cf9f187cc55438b56d929438efc
2016-11-08 13:28:39 -08:00
Emil Sjolander 81e4139edc Remove isTextNode optimization
Reviewed By: astreet

Differential Revision: D4146785

fbshipit-source-id: e20d780fbd5759b8f38b809e8cadf29cedee82a8
2016-11-08 09:13:43 -08:00
Thomas Beverley b6a38e80e0 Expose setAllowUniversalAccessFromFileURLs in Android WebView
Summary:
This pull request exposes the `setAllowUniversalAccessFromFileURLs` method of Android WebViewSettings as a property. The reason for this is when loading pages with a `file://` baseUrl it's sometimes desirable to allow loading other assets from a file base url. (For example loading an image into a canvas). More information on its use and purpose can be found [in the android docs here](https://developer.android.com/reference/android/webkit/WebSettings.html#setAllowUniversalAccessFromFileURLs%28boolean%29)

Usage example:

``` jsx
return (
  <WebView
    source={{ html: myhtml, baseUrl: 'file://' }}
    allowUniversalAccessFromFileURLs={true}
    javaScriptEnabled={true} />
)
```
Closes https://github.com/facebook/react-native/pull/8905

Differential Revision: D4147245

Pulled By: hramos

fbshipit-source-id: 7eaa884b8c0268de52b284954a34acec0fbd4061
2016-11-08 08:43:38 -08:00
Ryan Gomba 6535858c71 Add extractOffset to Animated
Summary:
`flattenOffset` has proven extremely useful, especially when dealing with pan responders and other gesture based animations, but I've also found a number of use cases for the inverse. This diff introduces `extractOffset`, which sets the offset value to the base value, and resets the base value to zero. A common use case would be to extractOffset onGrant and flattenOffset onRelease.
Closes https://github.com/facebook/react-native/pull/10721

Differential Revision: D4145744

fbshipit-source-id: dc2aa31652df0b31450556f611db43548180c7dd
2016-11-07 20:43:37 -08:00
Antoine Rousseau be4afdde37 Android WebSocket: include cookies in request
Summary:
This PR updates #6851 from srikanthkh, fixing coding conventions and javadoc, and adding a test plan.

Added testing functions into the WebSocketExample page of the UIExplorer, including a tiny http server to set a cookie on demand. Instructions included in the UIExplorer app.
Closes https://github.com/facebook/react-native/pull/9114

Differential Revision: D4140534

Pulled By: lacker

fbshipit-source-id: e020ad0c6d1d3ea09c0c3564c1795b4e1bc4517d
2016-11-07 10:43:44 -08:00
Andy Street 0089cd7630 Make CSSNode#measure final, cache more correct methodid
Summary:
In the JNI portion of CSSLayout, there's a subtle bug where we were caching the jmethodid of the 'measure' of the first object that had measure called on it. However, if that class had overriden measure, then the jmethodid would be specific to that subclass's implementation and would not work for other classes. Conversely, if a regular CSSNode had been called first, then the super method would be called on the subclass instead of the proper overriden method.

Since there's not really a reason to overriden measure anyway (since you can just provide a different measure function), it's safest to just mark it final and explicitly cache the appropriate methodid

Reviewed By: emilsjolander

Differential Revision: D4132428

fbshipit-source-id: 6fb51597d80f1c03681e6611153b52b73b392245
2016-11-07 06:14:28 -08:00
Andy Street a320b0ab19 Lazy create children list when first child is added
Summary: We don't need to allocate a list for every node since leaf nodes don't have children.

Reviewed By: emilsjolander

Differential Revision: D4130818

fbshipit-source-id: 80d3e98fce9d2daa0676fd1cbed0e81edcf7adb3
2016-11-07 05:43:40 -08:00
leeight b67c0c964e Breaking: Ignore StatusBarManager rejected state
Summary:
See #10236
Closes https://github.com/facebook/react-native/pull/10421

Differential Revision: D4045455

fbshipit-source-id: a4fd969b1ade5e1a44715c6aeebb12b58bbf8d0c
2016-11-04 07:58:37 -07:00
Andy Street 68aeffe01f Queue JS calls that come in before JS bundle has started loading instead of crashing
Summary: This mimics (some of) the behavior we have on iOS where if you call a JS module method before the JS bundle has started loading, we just queue up those calls and execute them after the bundle has started loading.

Reviewed By: javache

Differential Revision: D4117581

fbshipit-source-id: 58c5a6f87aeeb86083385334d92f2716a0574ba1
2016-11-03 09:44:58 -07:00
Ryan Gomba 9b4927c9c4 Implement NativeAnimated modulus node on Android
Summary:
This diff implements ModulusAnimatedNode on Android, bringing Android up to date with JS and iOS native animation APIs.
Closes https://github.com/facebook/react-native/pull/10681

Differential Revision: D4120162

fbshipit-source-id: 4e58e1b6309c1c7a12ef835547a3f3d321c20714
2016-11-02 14:58:52 -07:00
Ryan Gomba 8e81644f64 Implement NativeAnimated offsets on Android
Summary:
This diff implements NativeAnimation offsets on Android. Running the examples should show no change; however, calling `setOffset()` should offset the final value for any value node by that amount. This brings Android up to date with JS and iOS animation APIs.
Closes https://github.com/facebook/react-native/pull/10680

Differential Revision: D4119609

fbshipit-source-id: 96dccdf25f67c64c6787fd9ac762ec841cefc46a
2016-11-02 13:58:53 -07:00
Alexander Blom 788e2775f6 Add Java JNI bindings
Reviewed By: mhorowitz

Differential Revision: D4021520

fbshipit-source-id: dbaf2ebb7fa48f4efe6cf47a97c39bb079dda8d0
2016-11-02 12:29:15 -07:00
Andy Street f2d3113c1d Fix bug where ScrollView would stop overscrolled by a bit on fling
Summary: This bug was introduced with the bounce-back bug fix. We need to actually set the scroll position to the max scroll position if we've gone over otherwise it can get stuck.

Reviewed By: lexs

Differential Revision: D4118084

fbshipit-source-id: 41a927a40000c526414096c9385f8bd3cbd907f3
2016-11-02 10:58:34 -07:00
Andy Street 6a45f05872 Use whether react instance is accepting calls to determine whether instance is active
Summary:
There was previously a race condition where hasActiveCatalystInstance would return true, but calling a JS module call on it would result in a crash. Now, hasActivtyCatalystInstance will only return true once the instance is actually accepting calls.

I'll follow this up with a more risky diff that gets rid of hasActiveCatalystInstance and just queues JS calls until runJSBundle is called.

Reviewed By: javache

Differential Revision: D4117374

fbshipit-source-id: 60941f68b0906a8213571305c564bfe3d053f51b
2016-11-02 07:58:33 -07:00
Alexander Blom ddb8cb7cf0 Move JSCHelpers.h and Value.h into separate package
Reviewed By: javache

Differential Revision: D3950748

fbshipit-source-id: 6315ea07f3217b485aeb4374b5f6e36333957848
2016-11-01 11:44:10 -07:00
Ben Nham c089761f9b Use JSCExecutor to manage loading js script in JSContext
Reviewed By: jaegs

Differential Revision: D4021624

fbshipit-source-id: 8e46052ad246e842a88715d55059a233196a4a6b
2016-10-31 15:13:49 -07:00
Howard Yeh d4b8ae7a8a Android shouldn't dispatch onLayout if frame didn't change
Summary:
Fixes [#7202 Android Redundant onLayout event](https://github.com/facebook/react-native/issues/7202)
Closes https://github.com/facebook/react-native/pull/7250

Differential Revision: D4104066

Pulled By: mkonicek

fbshipit-source-id: 383efdb4b4881aa7d7e508d61c9c01165bcf7bb6
2016-10-31 10:58:49 -07:00
Michał Gregorczyk afe1619eb8 Do not block RN start path with fsync calls
Reviewed By: bnham

Differential Revision: D4097184

fbshipit-source-id: b3a7aeac7f4196a510efe650194eebdc797b5ec9
2016-10-28 19:43:34 -07:00
Fabian Köster 55ebb89916 Enable TLS 1.1 and TLS 1.2 on Android 4.1-4.4
Summary:
This is a proposed patch for issue #7192.

Android 4.1-4.4 has support for TLS 1.1 and 1.2 but it is disabled by default. Because of the known security issues and more and more servers switching to TLS 1.2 only, it would be nice for react-native to enable this support.

I demonstrated a demo application which showcases the problem and can be used to test this patch. All sources and documentation for it can be found here:

https://github.com/bringnow/react-native-tls-test

Credits to Alex Gotev (gotev) for the nice implementation.
Closes https://github.com/facebook/react-native/pull/9840

Differential Revision: D4099446

Pulled By: lacker

fbshipit-source-id: 94db320dce6d27f98169e63f834562360c00eef7
2016-10-28 17:14:00 -07:00
Ovidiu Viorel Iepure 4cff039d78 Circle CI releases now work with Java 8
Reviewed By: bestander

Differential Revision: D4095313

fbshipit-source-id: 1806db054bbca86f6394af077baeccac4e7efbe1
2016-10-28 07:58:52 -07:00
Emily Janzer 3580de541d fix notification task timeout crashing
Reviewed By: hedgerwang

Differential Revision: D4088570

fbshipit-source-id: e2a217564d9325815e396daafbef2b7f06e84b33
2016-10-27 17:28:40 -07:00
Emil Sjolander 844cafd883 Set layout outputs on java object from C
Reviewed By: lexs

Differential Revision: D4077968

fbshipit-source-id: bce86ba610cd5ae36cfb45d78b2609c63a14cfa3
2016-10-27 10:58:42 -07:00
Emil Sjolander 553f4371e0 BREAKING - Change measure() api to remove need for MeasureOutput allocation
Reviewed By: splhack

Differential Revision: D4081037

fbshipit-source-id: 28adbcdd160cbd3f59a0fdd4b9f1200ae18678f1
2016-10-27 10:58:42 -07:00
Martin Konicek b28c0bb7db Followup: Apply the User-Agent header correctly to Android WebView
Summary:
Followup for #5822, addressing nits.

**Test Plan**

Travis CI (the author of #5822 tested the change).
Closes https://github.com/facebook/react-native/pull/10563

Differential Revision: D4081826

fbshipit-source-id: f3a2e1996bf02f81fecea6e53fe1c522b8c85689
2016-10-26 10:13:40 -07:00
Giuseppe Ottaviano dc02907039 Fix a folly::dynamic deprecated pattern
Reviewed By: javache

Differential Revision: D4075622

fbshipit-source-id: 4a6b6c4068d762dce2b1535bfd9630e185f5489f
2016-10-26 09:43:56 -07:00
Emil Sjolander d8e77f0c76 Reset java state in jni reset method
Differential Revision: D4081049

fbshipit-source-id: 0b9ad70339ad906ad5219ad2679329cfe2fd7abc
2016-10-26 07:28:48 -07:00
Nikhilesh Sigatapu c67225818d Add a way to access the underlying JavaScriptCore context
Summary:
**Motivation**

I'm working on a project that uses React Native and needs to add direct synchronous bindings to native stuff through the JavaScriptCore C API. This is because it's performance-sensitive and would benefit from the quickest JS->C path. It does this using cross-platform C++ code that works on both iOS and Android. Most of the infrastructure for getting access to the JSC context is already in React Native actually, just had to add a few more things.

(lexs you mentioned to tag you in this pull request)

**Test plan**

Modify the JavaScriptCore context through the `JSContextRef` returned (eg. add an object at global scope) and verify that it exists in JavaScript.
Closes https://github.com/facebook/react-native/pull/10399

Differential Revision: D4080945

Pulled By: lexs

fbshipit-source-id: 6659b7a01e09fd84475adde183c1d3aca2d4cf09
2016-10-26 03:43:44 -07:00
Emil Sjolander 2df4faaf15 Dont go down through JNI to figure out that no margin/padding/border/position was set
Differential Revision: D4080909

fbshipit-source-id: 7eb1885c615191055aa21e3435c6fbc652b883ae
2016-10-26 02:58:40 -07:00
Andrew Y. Chen 3af104fbd3 Fix memory leak in HeadlessJsTaskContext
Reviewed By: foghina, AaaChiuuu

Differential Revision: D4068078

fbshipit-source-id: a45ad83e9ecd8455558968089d80f94ec104c2ef
2016-10-25 07:13:51 -07:00
Michał Gregorczyk cfebad97b2 Synchronize before acquiring file lock
Reviewed By: dcaspi

Differential Revision: D4071662

fbshipit-source-id: 3458ff103fddb82a7588d7890f8bc931c0e19e14
2016-10-24 23:14:08 -07:00
Emil Sjolander 6664b816d7 Dont create a spacing object for returning margin, padding, border, and position
Differential Revision: D4050773

fbshipit-source-id: 3fd04c27f887a36875e455b5404a17154ac18f91
2016-10-24 10:43:43 -07:00
Emil Sjolander 58b5e28e71 Simplify memory model between managed and unmanaged memory
Differential Revision: D4051454

fbshipit-source-id: 8f5d010be520b3d1c981a7f85e5e6d95773ea6c1
2016-10-24 10:43:43 -07:00
Benoit Lemaire a7e333402d Add a few devsupport unit tests
Summary:
This PR adds a few unit tests to two devsupport classes, repectively

- JSDebuggerWebSocketClient
and
- JSPackagerWebSocketClient

Unit tests do not cover all methods / branches of the code. I solely focused on testing things having to do with JSON serialization as I am considering some quick refactoring to get rid of Jackson. Just prepping safety net with these few tests before starting.
Closes https://github.com/facebook/react-native/pull/10516

Differential Revision: D4067433

Pulled By: bestander

fbshipit-source-id: 97dc356c5eca5965914be074a7175cb48f038c4c
2016-10-24 03:58:33 -07:00
Emil Sjolander ea6458b63e Remove flex shorthand getter because it doesnt make a lot of sense
Reviewed By: gkassabli

Differential Revision: D4064674

fbshipit-source-id: 69935b85042020b4e8c61a393c1be8f4d42a6674
2016-10-24 03:44:22 -07:00
Aaron Chiu ed0e8f3360 Alphabetize CoreModulesPackage
Reviewed By: fkgozali

Differential Revision: D4058503

fbshipit-source-id: d0665b19ebf1d2991bcb13ee7d62311eed516946
2016-10-21 10:28:36 -07:00
Aaron Chiu c6330a2081 make HeadlessJsTaskSupportModule lazifiable
Reviewed By: achen1

Differential Revision: D4051137

fbshipit-source-id: 611b3cc36de040cf803b11a8a06ae13c0d9b044c
2016-10-21 05:28:41 -07:00
Kevin Gozali 150c522be9 allow fetching any resource under js folder via packager
Summary: This is a simple hook to allow native side to fetch any file under the js root folder via packager. Historically, only the `main.jsbundle` is fetched via the packager. This then allows fetching local file like a json file that lives under the same root js folder

Reviewed By: yungsters

Differential Revision: D4037730

fbshipit-source-id: a2d6eb5e30d148fee573d413fc4036d0189f4938
2016-10-20 11:43:44 -07:00
Aaron Chiu ffe06d3cfa annotate FB4A's view managers with @ReactModule
Reviewed By: achen1

Differential Revision: D4044730

fbshipit-source-id: c80c23c524b2d9366c51c52cbcdee8a2a4f26f75
2016-10-20 05:43:50 -07:00
Aaron Chiu e16251b46d don't allow fallback implementation when Lazy Native modules is enabled
Reviewed By: achen1

Differential Revision: D4019360

fbshipit-source-id: af5fffd1e80cdf99ff9af743eafff1412cac8e58
2016-10-20 05:43:50 -07:00
Yoshiya Hinosawa 71676809d6 Fix indent of .gradle files
Summary:
In most .gradle files, lines are indented with 4 spaces, but in some places they are indented with 2 spaces. This PR fixes them and enforce it by adding .editorconfig settings.
Closes https://github.com/facebook/react-native/pull/10267

Differential Revision: D4048335

Pulled By: lacker

fbshipit-source-id: df2f2556380f56672cf85690eb1c80e640a6aedf
2016-10-19 16:58:36 -07:00
Dmitry Petukhov d294e15c43 Two ReactART TODOs implemented on Android
Summary:
Implemented 2 TODOs from ReactART for Android:
- TODO(7255985): Use TextureView and pass Surface from the view to draw on it asynchronously instead of passing the bitmap (which is inefficient especially in terms of memory usage)
- TODO(6352067): Support dashes in ARTShape

We use ReactNativeART in our Android project.
1. Our app crashes sometimes on large screen smartphones with OutOfMemoryError. Crashes happen in ARTSurfaceShadowNode where TODO(7255985) was suggested in a comment in order to use memory more efficiently.
2. We needed dashes for drawing on ARTSurface.

**Test plan (required)**

I attach a screenshot of our app which shows dashed-lines and two ARTSurfaces on top of each other rendering exactly the same as in the pervious implementation of ARTSurface.
![screenshot_2016-08-19-16-45-43](https://cloud.githubusercontent.com/assets/18415611/17811741/cafc35c4-662c-11e6-8a63-7c35ef1c5ba9.png)
Closes https://github.com/facebook/react-native/pull/9486

Differential Revision: D4021303

Pulled By: foghina

fbshipit-source-id: 880175e841e3c598013982a7748b6fc691c7e8d6
2016-10-18 12:28:48 -07:00
Jacob Parker abb8ea3aea Implement a postMessage function and an onMessage event for webviews …
Summary:
JS API very similar to web workers and node's child process.

Work has been done by somebody else for the Android implementation over at #7020, so we'd need to have these in sync before anything gets merged.

I've made a prop `messagingEnabled` to be more explicit about creating globals—it might be sufficient to just check for an onMessage handler though.

![screen shot 2016-09-06 at 10 28 23](https://cloud.githubusercontent.com/assets/7275322/18268669/b1a12348-741c-11e6-91a1-ad39d5a8bc03.png)
Closes https://github.com/facebook/react-native/pull/9762

Differential Revision: D4008260

fbshipit-source-id: 84b1afafbc0ab1edc3dfbf1a8fb870218e171a4c
2016-10-16 06:43:46 -07:00
Tim Yung 331c13d4dc RN: Require {react/lib/ => }ReactNative
Reviewed By: sebmarkbage

Differential Revision: D4024375

fbshipit-source-id: cd2226a3580a7a4ff319d6a93b67b68f2942eb00
2016-10-14 18:59:10 -07:00
Felix Oghina 9df93c1071 Fix and re-enable TimingModuleTest
Summary:
For some reason the transitive dependency isn't picked up in OSS, so make it hard.

bestander
Closes https://github.com/facebook/react-native/pull/10397

Differential Revision: D4024350

Pulled By: bestander

fbshipit-source-id: 32182857dcc88744ebf6ce0e5cf8eaee390bf067
2016-10-14 15:28:43 -07:00
Konstantin Raev 82d6ac1a51 disabled broken test in jdk8
Summary:
Disabled test

cc kentaromiura
Closes https://github.com/facebook/react-native/pull/10395

Differential Revision: D4022410

Pulled By: kentaromiura

fbshipit-source-id: 9084badb457b18c146dca3853137e40c5b53b576
2016-10-14 11:13:54 -07:00
Connor McEwen 9c3bfe0cbb Prevent app from crashing when getCurrentActivity is null
Summary:
We're seeing a lot of crashes from `PermissionsModule` not being able to access the current activity, mentioned in #10009 and here: https://github.com/facebook/react-native/issues/9310#issuecomment-245657347

As far as I can tell, there is no way to ensure the Activity exists since the `ReactContext` holds a `WeakReference` to the current Activity and it appears that the lifecycle calls are happening in the right order (so not the same as #9310).

This will at least allow people to catch the error in JS and update the UI or try again as opposed to crashing the app.

I'm working on some bigger changes in #10221 but this is a smaller change and important to get fixed I think.
Closes https://github.com/facebook/react-native/pull/10351

Differential Revision: D4010242

fbshipit-source-id: 7a76973bb2b3e45817d4283917740c89a10ec0b0
2016-10-12 12:58:49 -07:00
Emil Sjolander 1f36d98874 Add tests for java jni bindings
Reviewed By: lucasr

Differential Revision: D4008411

fbshipit-source-id: c896a3925ff3f7fa368176a3d03c84eb7188ef60
2016-10-12 09:58:37 -07:00
Emil Sjolander fb245cca83 Rename init() -> reinit() to be more in line with what it now does
Reviewed By: lucasr

Differential Revision: D3992811

fbshipit-source-id: 61a10acc873ec028b2789007a400d89e62cf31d6
2016-10-12 03:58:45 -07:00
Emil Sjolander 64455ced5d Rename reset() -> free() to be more in line with what it now does
Reviewed By: lucasr

Differential Revision: D3992808

fbshipit-source-id: 8428ae33268d1417ce8642b741e47150a17bf077
2016-10-12 03:58:44 -07:00
Emil Sjolander 38bd937b40 Automatically init native memory when allocating java wrapper
Reviewed By: lucasr

Differential Revision: D3992802

fbshipit-source-id: 06d65821f1802ed8f2b2db651cef69f6851803f2
2016-10-12 03:58:44 -07:00
Emil Sjolander 6dae68306e JNI version is the default, its name should reflect that
Reviewed By: lucasr

Differential Revision: D3992777

fbshipit-source-id: cdd4cc58f3c15b5db1158f6f794394eb5c44a44d
2016-10-12 03:58:44 -07:00
Emil Sjolander 5c728a47b9 Clearly mark java CSSNode as deprecated. It will go away very soon
Reviewed By: lucasr

Differential Revision: D3992775

fbshipit-source-id: b3ceca277e5c7426eb51f8cbeacf5e2fe451c6ec
2016-10-12 02:59:18 -07:00
Satyajit Sahoo fa5ad85252 Remove deprecated APIs and modules
Summary:
We've deprecated these APIs for quite a few releases and we should be able to get rid of them now.

Remove following deprecated modules/components
 - AppStateIOS
 - ActivityIndicatorIOS
 - IntentAndroid
 - SliderIOS
 - SwitchAndroid
 - SwitchIOS
 - LinkingIOS

Update following modules to remove callback support
 - Clipboard
 - NetInfo

cc bestander
Closes https://github.com/facebook/react-native/pull/9891

Reviewed By: bestander

Differential Revision: D3974094

Pulled By: javache

fbshipit-source-id: 9abe32716bd85d0cea9933894f4447d53bdd5ee7
2016-10-11 07:43:52 -07:00
Pieter De Baets 9ed9bca0bf Lazily instantiate native modules
Summary: Instead of sending a list of modules over to JS on startup (and actually blocking script execution) instead provide a proxy object that constructs each of these lazily.

Reviewed By: lexs

Differential Revision: D3936979

fbshipit-source-id: 71bde822f01eb17a29f56c5e60e95e98e207d74d
2016-10-11 07:28:42 -07:00
Emil Sjolander 08e715bc9c Add finalizer to release any unreleased native memory
Reviewed By: lucasr

Differential Revision: D3992759

fbshipit-source-id: f648b72ead5bdb7257a5197496b19795f71f3788
2016-10-11 04:58:30 -07:00
Andrew Y. Chen 8e91843cc7 Fix crash when resolveView fails to find a view
Reviewed By: yungsters

Differential Revision: D3997107

fbshipit-source-id: 7bf03ff06a6b56d192bab7fa567a11a38148f076
2016-10-10 14:43:40 -07:00
Emil Sjolander b7ded130df Dont use explicit .so file name to support more platforms
Reviewed By: dreiss

Differential Revision: D3981166

fbshipit-source-id: 0b19f73e6de48a30613419ccc54735c968701532
2016-10-08 09:28:42 -07:00
Aaron Chiu 24a83fae2f make view managers native modules
Reviewed By: achen1

Differential Revision: D3973591

fbshipit-source-id: 44886f3bf045ed64585c92eb2e291627eed86c92
2016-10-07 05:43:45 -07:00
Aaron Chiu 1296cb29eb add flag to enable lazy view managers
Reviewed By: achen1

Differential Revision: D3981171

fbshipit-source-id: 2f6b8370064a5835e2e3636d4c1a7f42cc28ccaf
2016-10-07 05:43:45 -07:00
Emil Sjolander d89f59d94a Resolve some differences between CSSNode and CSSNodeJNI
Reviewed By: lucasr

Differential Revision: D3960755

fbshipit-source-id: 3e13a9435208851a96a619c07625ef2a5402f5ec
2016-10-07 05:28:37 -07:00
Aaron Chiu 8708c8bb82 make ViewManager extend BaseJavaModule
Reviewed By: achen1

Differential Revision: D3950323

fbshipit-source-id: 91fda89a9a457e0e5b6952b744eeba5e31c46a9a
2016-10-06 15:58:38 -07:00
Mike Lambert 1502e66c31 Allow code to check android permissions when run from a Service as well as Activity
Summary:
This allows the React JS code that's running from a Service (ie GcmListenerService) to check permissions (ie check for VIBRATE permissions before delivering notifications)

**Test plan (required)**

I've run this code from a GcmListenerService subclass, and it works correctly.
Closes https://github.com/facebook/react-native/pull/10229

Differential Revision: D3980853

fbshipit-source-id: 026b1f0c953d7093b5af2bec0b4a93ebd228f62e
2016-10-06 04:28:35 -07:00
Felix Oghina f7cbd56d8e pass EventDispatcher to UIImplementation constructor
Summary: This way `UIImplementation` can hold on to it and use it outside of calls from the `UIManagerModule`.

Reviewed By: lexs

Differential Revision: D3899774

fbshipit-source-id: 01e4956c4540bcdf30774a3f40a625e934714ee9
2016-10-04 12:29:13 -07:00