Commit Graph

1017 Commits

Author SHA1 Message Date
Andrei Coman 5cb8b97f3c Reverted commit D3751097
Summary:
Setting the line height with the help of Android-provided StaticLayout is incorrect. A
simple example app will display the following when `setLineSpacing(50.f, 0.f)`
is set: {F62987699}. You'll notice that the height of the first line is a few
pixels shorter than the other lines.
So we use a custom LineHeightSpan instead, which needs to be applied to the text
itself, and no height-related attributes need to be set on the TextView itself.

Reviewed By: lexs

Differential Revision: D3751097

fbshipit-source-id: 6c5a8d01a6dca4ff6eef9c3aadd1b550054432d2
2016-08-25 02:43:43 -07:00
Andrei Coman 483953dab3 Fix Text incorrect line height
Summary:
Setting the line height with the help of Android-provided StaticLayout is incorrect. A
simple example app will display the following when `setLineSpacing(50.f, 0.f)`
is set: {F62987699}. You'll notice that the height of the first line is a few
pixels shorter than the other lines.
So we use a custom LineHeightSpan instead, which needs to be applied to the text
itself, and no height-related attributes need to be set on the TextView itself.

Reviewed By: lexs

Differential Revision: D3751097

fbshipit-source-id: c3574a1080efec26436a5c61afbff89afa8679e7
2016-08-24 11:13:38 -07:00
Alexander Blom b4999fca0d Don't clear queue in ProxyExecutor
Reviewed By: mhorowitz

Differential Revision: D3757216

fbshipit-source-id: 5adda2dcdfb438b65fe668c52e0d2e35705eed9f
2016-08-24 03:43:44 -07:00
Aaron Chiu 288934398b remove all @ReactModule runtime annotation processing
Summary: Runtime annotation processing uses reflection which is slow. We'll use build time annotation processing instead and create at build time static ModuleInfo classes which have "name", "canOverrideExistingModule", "supportsWebWorkers", "needsEagerInit".

Reviewed By: lexs

Differential Revision: D3752243

fbshipit-source-id: 3518c6f38087d8799a61410864007041389c0e15
2016-08-23 18:58:55 -07:00
Chris Hopman 1557325e4a Use -std=c++1y for lambda capture initializers
Reviewed By: mhorowitz

Differential Revision: D3761975

fbshipit-source-id: 5500fd25864282409eb49737eef4f703cadadf70
2016-08-23 18:58:55 -07:00
Chris Hopman 9a5d3bacb9 Remove terrible ReadableNativeArray::getMap() hack
Reviewed By: mhorowitz

Differential Revision: D3753952

fbshipit-source-id: c8ea693d3a24adad9f907ad28b811cf69ab9e68d
2016-08-23 17:13:38 -07:00
Emil Sjolander e63a7ea7bd Implement flex properties in java version as well
Reviewed By: lucasr

Differential Revision: D3753231

fbshipit-source-id: ea41d887cd99d1f03d2bc876a2fd7141dbe48320
2016-08-23 04:43:32 -07:00
Konstantin Raev b59fde817f Fixes paths to robolectric when they are downloaded from maven into buck-out
Reviewed By: mmmulani

Differential Revision: D3751888

fbshipit-source-id: 2a70e8655f3c6e6dcc2de17e85289d9db18a2699
2016-08-22 11:13:39 -07:00
Alexander Blom 38a14ffc32 Make RN background drawable respect bounds
Reviewed By: astreet

Differential Revision: D3655395

fbshipit-source-id: c8c1b953337a3c5dfa0d905bc3d774db6b3f8271
2016-08-22 03:28:36 -07:00
Aaron Chiu 924187eb9a add more Systrace to native module / view manager constants
Reviewed By: lexs

Differential Revision: D3739966

fbshipit-source-id: 4ba31aade00852132e528f96252197b823bb58a3
2016-08-19 11:58:53 -07:00
Alexander Blom e4d5dcb15b Always log exception in DevSupportManager
Reviewed By: andreicoman11

Differential Revision: D3741763

fbshipit-source-id: b4cc32e4d237955ec4a67af323024acd0d19106a
2016-08-19 07:13:45 -07:00
Felix Oghina 2a7f4be8f8 native decay animation
Summary: Add support for `useNativeDriver: true` to `Animated.decay`. Add example in Native Animated Example UIExplorer app.

Reviewed By: ritzau

Differential Revision: D3690127

fbshipit-source-id: eaa5e61293ed174191cec72255ea2677dbaa1757
2016-08-19 07:13:45 -07:00
Felix Oghina 37ab1c8844 Remove dependency on launcher from instrumentation tests
Reviewed By: bestander

Differential Revision: D3736847

fbshipit-source-id: d39a227fe8753f3766521fd23440933adba9e8c7
2016-08-19 06:58:43 -07:00
Michal Lowicki af14a5b489 Enable build file sandboxing in fbobjc
Reviewed By: darknoon

Differential Revision: D3655364

fbshipit-source-id: 0c7d37860d358a0768fe788b589e701964063092
2016-08-19 05:28:30 -07:00
Jennifer Wang 4b6af5fa63 Add wrapper class for async storage
Reviewed By: wsanville

Differential Revision: D3654554

fbshipit-source-id: bc21da4b5c46228136cc80592f84206d2deb541e
2016-08-18 10:43:32 -07:00
Emil Sjolander 805d06087b Fix border color
Summary: Border colors broke with recent change to default values in csslayout Spacing. This is a quick fix until we move react-native borders away from using Spacing.java which is a hack in the first place.

Reviewed By: lexs

Differential Revision: D3735435

fbshipit-source-id: 747c85798cb02e1a5139de038eb26b64ac4c5bf3
2016-08-18 10:28:38 -07:00
Emil Sjolander fd34c6d567 Move default spacing out of csslayout
Reviewed By: foghina

Differential Revision: D3709574

fbshipit-source-id: 6e0277bd97407a5c642d742f93ca2ac70d7307da
2016-08-18 03:28:34 -07:00
Don Yu a2a8d7f5da Fix onItemSelected firing for ReactPicker on initial layout.
Reviewed By: AaaChiuuu

Differential Revision: D3732557

fbshipit-source-id: ed031dbf205996dab8cb0555af972e6f26c0d202
2016-08-17 22:13:45 -07:00
Lukas Piatkowski 0b88dbf1a0 DevMenu option to control Sampling Profiler's sample interval
Differential Revision: D3722898

fbshipit-source-id: 7bf1528b26a1ac6ed81943144ca433a211cf7b35
2016-08-17 08:28:48 -07:00
Lukas Piatkowski fe1a39a8f2 DevMenu option to start the Sampling Profiler on init
Differential Revision: D3722550

fbshipit-source-id: 5a805753b4893a167df8bcf95c0e05ed22a15283
2016-08-17 08:28:48 -07:00
Andrei Coman db1b0e9be9 Reverted commit D3668840
Reviewed By: bestander

Differential Revision: D3668840

fbshipit-source-id: 553600a06c6a97c3a653815ba6fe61aaa1dad937
2016-08-17 02:58:30 -07:00
Connor McEwen 6df41d5184 Change Android Permission Module to use promises
Summary:
This is a follow-up to #9292 satya164
Closes https://github.com/facebook/react-native/pull/9325

Differential Revision: D3723568

fbshipit-source-id: d553a70bde53ed5d7c1f5f544c85c5c5935e3ca4
2016-08-16 12:58:39 -07:00
Emil Sjolander fc5bed8693 Support 64 bit platforms
Reviewed By: davidaurelio

Differential Revision: D3722479

fbshipit-source-id: c132f24c92c8476b328713861ad30670a43040c4
2016-08-16 08:58:53 -07:00
Felix Oghina af2bb20893 make main component name nullable
Summary: Sometimes the main component name is not known at activity construction time and depends on e.g. reading shared preferences. To support this use case, make `(Fragment)ReactActivity#getMainComponentName()` nullable and return `null` by default. In this case, the app will not be loaded in `onCreate` by default and the user has to call `loadApp` manually once the component name is known.

Reviewed By: andreicoman11

Differential Revision: D3722517

fbshipit-source-id: 062eed158798606e4160f1c142b23fd98ca618c8
2016-08-16 07:43:31 -07:00
Emil Sjolander 30847b2b35 Fix parameter order
Differential Revision: D3722391

fbshipit-source-id: 9adaf7b80d7bad93887a122c10eb06159a5189c2
2016-08-16 05:58:34 -07:00
Sriram Ramasubramanian dcef202aab Pass in the locale identifier from Android
Reviewed By: AaaChiuuu, achen1

Differential Revision: D3668583

fbshipit-source-id: f34b6e24d9ff4fa044d24f4133c9c85564a3f00f
2016-08-15 18:28:40 -07:00
Felix Oghina 5ee70415bc add oss-based fb activity and host classes
Reviewed By: andreicoman11

Differential Revision: D3655436

fbshipit-source-id: 3ca6535cd819171867c79f5e9801d9013676a80f
2016-08-15 09:43:40 -07:00
Emil Sjolander f7a22bc33c Use single function for margin, position, padding, and border
Reviewed By: lucasr

Differential Revision: D3715201

fbshipit-source-id: ea81ed426f0f7853bb542355c01fc16ae4360238
2016-08-15 09:28:41 -07:00
Mani Ghasemlou 8095707938 store borderColor in a non lossy way
Summary:
Fix for issue #3652 -

Converting from `int` to `float` is lossy for very large numbers, so storing `borderColor` as a single `Spacing` object (which uses `float`) was not working for certain colors.

So, this pull request splits `borderColor` into alpha and RGB components, and stores each of these as their own respective `Spacing` objects.

*Test Plan*

Check out cosmith sample code here that triggers the bug: https://rnplay.org/apps/l1bw2A

What currently looks like this:

<img width="548" alt="screen shot 2016-08-13 at 6 22 28 pm" src="https://cloud.githubusercontent.com/assets/1630466/17645965/9346f05e-6183-11e6-8d40-3e458b08fd9a.png">

Should look like this (with my fix applied):

<img width="543" alt="screen shot 2016-08-13 at 6 20 08 pm" src="https://cloud.githubusercontent.com/assets/1630466/17645968/9c26d1d0-6183-11e6-8759-75a5e99f498a.png">
Closes https://github.com/facebook/react-native/pull/9380

Differential Revision: D3716707

Pulled By: foghina

fbshipit-source-id: 1164378112e2a58d43c8f5fc671c2efdb64b412b
2016-08-15 09:13:28 -07:00
Felix Oghina fbd2e13910 Add Activity to onActivityResult listener interface
Summary:
The Android lifecycle is weird: turns out `onActivityResult` is called before `onResume`. This means `getCurrentActivity()` could return the wrong instance, or `null` if the activity was destroyed. To give developers access to the Activity receiving the result (which is also about to become the current activity), pass it as an argumento the listener.

Fixes github issue #8694.

Reviewed By: donyu

Differential Revision: D3704141

fbshipit-source-id: e7e00ccc28114f97415e5beab8c9b10cb1e530be
2016-08-13 08:44:12 -07:00
Don Yu d16c676262 Remove unused okhttp dependency from cxxbridge module
Summary: This dependency on okhttp is unused. Removing this to lower the method-count increase from including the core RN modules.

Reviewed By: AaaChiuuu

Differential Revision: D3711870

fbshipit-source-id: 54b92edb4a55140b33cc74a5e9270650ced56ab9
2016-08-12 16:28:28 -07:00
Aaron Chiu 705daabbb1 Reverted commit D3334273
Reviewed By: astreet

Differential Revision: D3334273

fbshipit-source-id: a3849604ea89db74900850c294685e7da9aeeacc
2016-08-12 15:58:31 -07:00
Emil Sjolander c2a41e42f2 Expose alignContent to java
Reviewed By: IanChilds

Differential Revision: D3709071

fbshipit-source-id: 421d75924ecc12d6d0975e342f3862cf5592f65f
2016-08-12 04:28:34 -07:00
Aaron Chiu c64213653e Convert modules to use @ReactModule instead of getName()
Reviewed By: astreet

Differential Revision: D3334273

fbshipit-source-id: a33bf72c5c184844885ef3ef610a05d9c102c8ea
2016-08-11 15:58:43 -07:00
Don Yu 031fe4d797 Move JSPackagerWebSocketClient and JSDebuggerWebSocketClient to react/devsupport module
Summary: This move lets us remove the dependency on okhttp3 from react/bridge. The classes I moved are all strictly related to dev support features and don't need to go into the core bridge module that gets shipped to production.

Reviewed By: AaaChiuuu

Differential Revision: D3698977

fbshipit-source-id: 6ba1517377061690cef289a544ec1622122cef85
2016-08-11 09:58:42 -07:00
Don Yu 6e60b1763c Strip out okhttp3 dependency from react/common module
Reviewed By: AaaChiuuu

Differential Revision: D3698882

fbshipit-source-id: 15a123b42382f11b6f88d7b0c1e12c463bb6a740
2016-08-11 09:58:42 -07:00
Aaron Chiu 541eaef4be Convert most packages to use LazyReactPackage
Reviewed By: astreet

Differential Revision: D3334261

fbshipit-source-id: 8533e3dd9395ffb2fd8c9b71a0d352fe475d1cb9
2016-08-11 08:58:36 -07:00
Felix Oghina 96e41218ed forward ThemedReactContext#has/getCurrentActivity calls to wrapped context
Summary:
`ThemedReactContext` wraps the actual `ReactContext` but doesn't actually receive any lifecycle events, which would set `mCurrentActivity`, so that's always stuck as `null`. To fix, we override `has/getCurrentActivity` and forward the call to the wrapped context, which actually has the correct lifecycle status.

Fixes issue #9310 on github.

Reviewed By: mkonicek

Differential Revision: D3703005

fbshipit-source-id: 363e87ac91d50516899b413e823d5312cbb807f4
2016-08-11 07:28:50 -07:00
Konstantin Raev f76f4cf432 Fixed trunk: added jsr-330
Summary: Closes https://github.com/facebook/react-native/pull/9346

Differential Revision: D3702977

Pulled By: foghina

fbshipit-source-id: b9c1285b6cc84daf31a883aef0a30282ad052fbd
2016-08-11 04:43:38 -07:00
Aaron Chiu 1feb462f44 Add LazyReactPackage
Summary:
LazyReactPackage is an extension of ReactPackage that allows us to lazily construct native modules.
It's a separate class to avoid breaking existing packages both internally and in open source.

Reviewed By: astreet

Differential Revision: D3334258

fbshipit-source-id: e090e146adc4e8e156cae217689e2258ab9837aa
2016-08-10 17:13:27 -07:00
Mani Ghasemlou dba1ce46bf Android: Setting numberOfLines to 0 behaves differently than on iOS.
Summary:
**Motivation**

For the `Text` component, if `numberOfLines` is set to `0`, the behavior on iOS is such that there is no limit.

On Android, the behavior is such that `numberOfLines={0}` will not render the `Text` component.

Since we want behavior to be the same across platforms, this change will make sure Android behaves the same as iOS.

**Test Plan**

Create a `Text` component specifying `numberOfLines={0}` on an Android project.

Expected:
- `Text` component displays, with no limit to number of lines.

Result:
- `Text` component does not appear at all.
Closes https://github.com/facebook/react-native/pull/9188

Differential Revision: D3697115

fbshipit-source-id: c1768ac22bab3c0e41a9df38b7314f3201512eb2
2016-08-10 14:58:31 -07:00
Emil Sjolander c74938e72e Use spacing for position
Differential Revision: D3690235

fbshipit-source-id: 4c04952e6ded32fd5fbfdccf63736cf025ae470e
2016-08-10 05:13:30 -07:00
Mengjue Wang 380830e4aa Add `isPrefSet` and `setPref` to make I18nUtil cleaner
Summary: Add `isPrefSet` and `setPref` function to make I18nUtil cleaner

Reviewed By: fkgozali

Differential Revision: D3684958

fbshipit-source-id: 96f51d495d700d46096dc162c7599bc51a0b37cd
2016-08-09 18:58:47 -07:00
Rickard Ekman 8e2906ae89 Android: Implement cancelable option for Alerts
Summary:
**Motivation**
In iOS you cannot dismiss alerts by clicking outside of their box, while on Android you can. This can create some inconsistency if you want to have identical behavior on both platforms. This change makes it possible for Android apps to have irremovable/required alert boxes just like in iOS.

This adds an additional parameter to the Alert method. The way to use it is by providing an object with the cancelable property. The cancelable property accepts a boolean value.

This utilizes the Android DialogFragment method [setCancelable](https://developer.android.com/reference/android/app/DialogFragment.html#setCancelable(boolean))

**Usage example**
```js
Alert.alert(
   'Alert Title',
   null,
   [
     {text: 'OK', onPress: () => console.log('OK Pressed!')},
   ],
   {
     cancelable: false
   }
);
```

**Test plan (required)**

I added an additional alert to the UIExplorer project where it can be tested. I also added a part in the Dialog Module test to make sure setting canc
Closes https://github.com/facebook/react-native/pull/8652

Differential Revision: D3690093

fbshipit-source-id: 4cf6cfc56f464b37ce88451acf33413393454721
2016-08-09 06:13:48 -07:00
Felix Oghina 750a46a12e remove extraneous warning
Reviewed By: astreet

Differential Revision: D3690014

fbshipit-source-id: 353a40aafc6a6e9f777ac80937713e1abb9cecc5
2016-08-09 05:29:16 -07:00
Emil Sjolander 1227675e0a Expose methods to set position Start|End
Differential Revision: D3669177

fbshipit-source-id: b06f382cb89546e817a2475298cf2cad17d95a2c
2016-08-09 04:28:53 -07:00
Aaron Chiu 0561336ae4 Add @ReactModule annotation
Reviewed By: astreet

Differential Revision: D3310686

fbshipit-source-id: ec2dc7fdf2dfbb3eedde667d7228fc3241860e35
2016-08-09 01:58:55 -07:00
Felix Oghina 3c4fd42749 add ReactFragmentActivity, share delegate with ReactActivity
Summary: Add FragmentActivity-based ReactFragmentActivity to support apps using the v4 support lib. Add delegate class to share implementation details between the new class and ReactActivity.

Reviewed By: astreet

Differential Revision: D3655428

fbshipit-source-id: d3ff916538e13b6f0d594bbb91555e322645e954
2016-08-08 09:13:53 -07:00
Felix Oghina 0b5c61250b check lifecycle event is coming from current activity
Summary:
If a paused activity is destroyed (e.g. because of resource contention), we send onHostDestroyed to all modules even if there's an on-screen, resumed activity using the current react instance.

This diff adds a check to make sure lifecycle events come from the current activity, and ignores ones that don't.

Reviewed By: astreet

Differential Revision: D3655422

fbshipit-source-id: 0f95fda124df3732447853b9bc34c40836a4b1da
2016-08-08 09:13:53 -07:00
Felix Oghina 46dc46a3b3 clear mCurrentActivity in onHostDestroy
Summary: It doesn't make sense to clear mCurrentActivity in onHostPause -- we're not going to leak a paused activity. Only keeping it around after onDestroy could lead to leaks. This allows us to check the source of lifecycle events and only send them if they come from the current activity (upcoming diff).

Reviewed By: astreet

Differential Revision: D3655370

fbshipit-source-id: f54b04a95c5c090636219832e63a348f3ae5a5c3
2016-08-08 09:13:53 -07:00