Commit Graph

7407 Commits

Author SHA1 Message Date
nuhbye 55b76b1798 Update example link to new link.
Summary:
Thanks for submitting a pull request! Please provide enough information so that others can review your pull request:

> **Unless you are a React Native release maintainer and cherry-picking an *existing* commit into a current release, ensure your pull request is targeting the `master` React Native branch.**

Explain the **motivation** for making this change. What existing problem does the pull request solve?

Prefer **small pull requests**. These are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it.

**Test plan (required)**

Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI.

Make sure tests pass on both Travis and Circle CI.

**Code formatting**

Look around. Match the style of the rest of the codebase. See also the simple [style guide](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#style-guide).

For more info, see
Closes https://github.com/facebook/react-native/pull/9289

Differential Revision: D3684467

Pulled By: hramos

fbshipit-source-id: 625b01f1e21c526048832d2c4af0d37f02fed44e
2016-08-08 10:28:27 -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
Felix Oghina baf5a5b99a add RedBoxHandler & UIImplementation to ReactNativeHost
Summary: Allow overriding RedBoxHandler and UIImplementation in custom ReactNativeHost implementations.

Reviewed By: astreet

Differential Revision: D3655354

fbshipit-source-id: cc168613c75a8540e8a802ce33576b3b6a97749c
2016-08-08 09:13:52 -07:00
Pierre-Yves Desnoues deb0d60c09 Update PlatformSpecificInformation.md
Summary:
Fix internal anchor ref links
Closes https://github.com/facebook/react-native/pull/8946

Differential Revision: D3683755

fbshipit-source-id: 5b145e751460ba24e058430b325558405fa323bf
2016-08-08 04:58:30 -07:00
ymmuse 7b02c1de3f fix CSSNodeList memory leak
Summary:
CSSNodeListFree does not free the list->items memory
Closes https://github.com/facebook/css-layout/pull/214

Differential Revision: D3683643

Pulled By: emilsjolander

fbshipit-source-id: 7f9ef19f4603d5558cc2f8302756b3bcec2f6c12
2016-08-08 04:58:30 -07:00
Charles Dick 54f867f0d6 Process heap capture into trace html
Reviewed By: bestander

Differential Revision: D3642188

fbshipit-source-id: c9a4699b2a0d60eb5961333dec45941085e19324
2016-08-08 04:28:32 -07:00
Pieter De Baets cb59264e73 Specify React dependency correctly
fbshipit-source-id: c25ad1b942e75d9a631134fc277306931c7bc859
2016-08-08 04:28:32 -07:00
Pieter De Baets 631b1beeb6 Unbreak upgrade to React 15.3.0
fbshipit-source-id: 0373b4dd11895f3b1c76a904a0a59b70aaa845f9
2016-08-08 03:58:29 -07:00
Pieter De Baets f35b372883 Make sure layout happens after setFrame:forView:
Reviewed By: majak

Differential Revision: D3682745

fbshipit-source-id: 108ff292aa79765d8e5bb7fc364717eba662c0ea
2016-08-08 03:43:23 -07:00
James Ide 02b71cb7b5 Use React 15.3.0 instead of 15.3.0-rc.2
Summary:
React 15.3.0 was officially released. We especially should try not depend on RCs in RN releases and npm doesn't handle RC versions well.
Closes https://github.com/facebook/react-native/pull/9279

Differential Revision: D3683587

fbshipit-source-id: fc4f8a030769232b7697434a419e1e07e482e308
2016-08-08 02:28:30 -07:00
Ryan Gomba bf82a8d1a8 Move RCTNativeAnimatedModule onto the main queue
Summary:
We're mutating dictionaries on one thread for bookkeeping (anytime we receive a call over the bridge) and iterating over them on the main thread each frame (in `updateAnimations`). Seems like this can all happen on the main thread without issue. Am I missing something?

**Test plan (required)**

Run UIExplorer NativeAnimated examples before and after - compare the results. Nothing should have changed.
Closes https://github.com/facebook/react-native/pull/9049

Differential Revision: D3682871

fbshipit-source-id: c6de62063e724b15b9678a9ef0290284e928b31b
2016-08-07 12:58:20 -07:00
Pieter De Baets 6b9406ed5a Fix missing font constants on iOS7
Reviewed By: dinhviethoa

Differential Revision: D3682528

fbshipit-source-id: 7e3a0b7c2c043a869f2f5dfe9aaf404897076d0b
2016-08-07 11:58:30 -07:00
Nam Se Hyun 20c6d11f84 Edit Docs Making Offline iOS Bundle
Summary:
via commit 8c29a52c54 , the way has changed building offline bundle. So this commit update the docs about that.
Closes https://github.com/facebook/react-native/pull/9186

Differential Revision: D3682643

Pulled By: JoelMarcey

fbshipit-source-id: 3e4127ca0c00f254dc3464e73c1c2496c0710b85
2016-08-07 09:28:38 -07:00
Janic Duplessis df05311777 Add transform support for native animated on Android
Summary:
This adds support for the `transform` animated node. This brings feature parity with the iOS implementation and allows running the NativeAnimated UIExplorer example that was created with the iOS implementation on Android. This is based on some work by kmagiera in the exponent RN fork.

This also adds support for mixing static values with animated ones in the same transform as well which is not supported on iOS at the moment. It is also implemented in a way that rebuilds the transform matrix the same way as we build it in JS so it will be easy to remove some of the current limitations like forcing the transforms order and only supporting one of each type.

**Test plan (required)**

Tested with the NativeAnimated example on Android and iOS. Also tested mixing in static values in a transform (`[{ rotate: '45deg' }, { translateX: animatedValue }]`).
Closes https://github.com/facebook/react-native/pull/8839

Differential Revision: D3682143

fbshipit-source-id: 5e6fd4b0b8be6a76053f24a36d1785771690a6f8
2016-08-07 00:58:36 -07:00
Geoffrey Goh 1168d0db45 Should be R.string, not R.strings
Summary:
Fix regression of https://github.com/rnpm/rnpm-plugin-link/pull/88.
Closes https://github.com/facebook/react-native/pull/9252

Differential Revision: D3680785

fbshipit-source-id: a6ea63295ae8f61b17c0a1b2ca5e6a5f5da7437a
2016-08-06 07:28:28 -07:00
Nikhilesh Sigatapu a2417065b1 Fix off-by-one error in range requests
Summary:
https://github.com/facebook/react-native/pull/8219 adds range requests to the asset server, but there was an off-by-one-error that made responses end prematurely. This made (for example) react-native-video not work for video assets. This change fixes the off-by-one error and react-native-video works with assets.

**Test plan (required)**

Try the test in the original pull request for range requests: https://github.com/facebook/react-native/pull/8219
Closes https://github.com/facebook/react-native/pull/9254

Differential Revision: D3680070

fbshipit-source-id: 3f2a18ba9f35b45b340f4a1046bc099b8444eb7d
2016-08-06 03:28:32 -07:00
Cameron Hunter bdf5adc40b Ensure that existing properties are configurable before redefining
Summary:
`Libraries/JavaScriptAppEngine/Initialization/InitializeJavaScriptAppEngine.js` attempts to setup global variables typical in most JavaScript environments. It finds the previous property value using `Object.getOwnPropertyDescriptor` and preserves it as `original[PropertyName]` (if it existed), it then redefines the property using `Object.defineProperty`.

Properties may only be redefined if the property descriptor specifies that it is configurable ([MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor)). Attempting to redefine an non-configurable property will result in an error: `TypeError: Cannot redefine property: [PropertyName]`.

Not all properties being setup in `InitializeJavaScriptAppEngine.js` are necessarily configurable in the target environment.
Closes https://github.com/facebook/react-native/pull/9244

Differential Revision: D3679683

fbshipit-source-id: cd3398ef2cdf38e58c58862e64b159951c2b22c2
2016-08-05 21:58:29 -07:00
Janic Duplessis 12fb313e54 Fix scale transform on Android
Summary:
cc kmagiera astreet
Closes https://github.com/facebook/react-native/pull/9251

Differential Revision: D3679466

Pulled By: astreet

fbshipit-source-id: bd4262169827151ed584f7f8d167f9e6b8d533af
2016-08-05 17:43:31 -07:00
Andrew Y. Chen 3feef3ff72 Move JavascriptException from react/modules/core to react/common
Reviewed By: jingc

Differential Revision: D3675858

fbshipit-source-id: 6e1fd4f9476afb28f9c24978be3a7a7cc50afaba
2016-08-05 14:28:30 -07:00
Sreejumon a4bff46791 Update Upgrading.md
Summary:
Updating the RN version 0.31, so that doc is also upto date with latest version.
Closes https://github.com/facebook/react-native/pull/9247

Differential Revision: D3677606

fbshipit-source-id: 8ec5999dfaa243377d85a533935ccfe2d4c97fae
2016-08-05 13:43:35 -07:00
Mengjue Wang 9de0b79e87 Provide forceRTL for LTR language to test
Summary:
Provide forceRTL function for developer to test RTL layout in LTR language bundle in I18nUtil and expose it in I18nManager.
Rename allowRTL and setAllowRTL functions

Differential Revision: D3673601

fbshipit-source-id: 98f9c99e8a6948336fb918c24566dc9e5c0a3a3e
2016-08-05 13:28:40 -07:00
Pieter De Baets f571f016d9 Improve types in RCTFont API
Reviewed By: majak

Differential Revision: D3662880

fbshipit-source-id: f54e1ac164373337460047eb3708a588f578b5fc
2016-08-05 12:44:21 -07:00
Pieter De Baets 3d6240f9a6 Implement system font caching in RCTFont
Reviewed By: majak

Differential Revision: D3662848

fbshipit-source-id: 7135c0a80c6781669e43ae9a58a26a2c85f2c827
2016-08-05 12:44:21 -07:00
Pieter De Baets c5a44b7ca3 Move font helpers to RCTFont
Reviewed By: majak

Differential Revision: D3662804

fbshipit-source-id: 2c03a094a74c617c0d6172e327bd77d23d0d44c2
2016-08-05 12:44:20 -07:00
Pieter De Baets e30327cb13 Fix styling of system fonts
Summary:
When you call `-[RCTConvert UIFont:withFamily:...]` with a non-nil font object, we'll try to use the existing font object for system information. On iOS9+ which uses the San Francisco font, `[UIFont fontNamesForFamilyName:]` doesn't return anything useful, so we need to make sure that we detect this as a system font and use the appropriate methods. This issues is made worse by the fact that RCTTextView and friends recreate the font property for every attribute that is set (pretty horrible perf-wise).

This fixes https://github.com/facebook/react-native/issues/2140

Reviewed By: sahrens

Differential Revision: D3662751

fbshipit-source-id: c528e8945ed361a922c03f861d3c0b584658573b
2016-08-05 12:44:20 -07:00
Krzysztof Magiera 8f75d7346f Support for spring animations
Summary:
This change adds support for spring animations to be run off the JS thread on android. The implementation is based on the android spring implementation from Rebound (http://facebook.github.io/rebound/) but since only a small subset of the library is used the relevant parts are copied instead of making RN to import the whole library.

**Test Plan**
Run java tests: `buck test ReactAndroid/src/test/java/com/facebook/react/animated`
Add `useNativeDriver: true` to spring animation in animated example app, run it on android
Closes https://github.com/facebook/react-native/pull/8860

Differential Revision: D3676436

fbshipit-source-id: 3a4b1b006725a938562712989b93dd4090577c48
2016-08-05 12:14:06 -07:00
Pieter De Baets 0222107170 Customize main thread initialization of native modules (2nd try)
Reviewed By: majak

Differential Revision: D3671197

fbshipit-source-id: e8df7669be79303d335f2c881e97310b5fed47f9
2016-08-05 11:28:32 -07:00
Krzysztof Magiera 68b9a36858 Accept transforms list instead of matrix for transform view parameter.
Summary:
In #7916 I moved transform matrix decomposition logic from JS to java. The next step is to accept list of transforms instead oftransform matrix as a transform ReactProp. This way there is no extra processing required on JS side for the transform param (at least for android now) and this on the other hand allow us to execute transform updates (through offloaded animation) solely on the UI thread.

After this change there is a whole bunch of stuff from `Libraries/Utilities/MatrixMath.js` that can be deleted (methods like: determinant, inverse, transpose). Although astreet mentioned under one of my previous commits that the code is still being referenced internally at fb, so I decided not to delete it here.

**Test plan (required)**
Run UIExplorer Transform example before and after - compare the results
Run android unit test: com.facebook.react.uimanager.MatrixMathHelperTest
Closes https://github.com/facebook/react-native/pull/8892

Differential Revision: D3676017

Pulled By: astreet

fbshipit-source-id: 5275e30805a85c12c89bea44e8b3a2b2ec7b33fa
2016-08-05 10:58:42 -07:00
Gant eba6c379c3 - Update remote image example
Summary:
I've seen quite a few newbs trip on this, so I'm fixing it.

First - you have to set the width/height on a remote image, otherwise nothing shows.  This is [even on stack overflow](http://stackoverflow.com/questions/30091398/unable-to-display-image-with-react-native-with-uri).

Second - with the addition of ATS in iOS most people who copy/paste this example will not be able to load an insecure image, so I changed it to the `https`.

**RESULT** this doc becomes copy/paste friendly again for beginners.
Closes https://github.com/facebook/react-native/pull/9235

Differential Revision: D3675478

Pulled By: JoelMarcey

fbshipit-source-id: 5b414caa40cda72dec4eace686278c26c251c4bb
2016-08-05 08:58:32 -07:00
James Ide f8f7a1540d Prefix isUndefined with "CSS"
Summary:
Consistently namespace all of css-layout's public C API with "CSS". The only function that needed to be renamed was isUndefined, which I renamed to CSSValueIsUndefined.

Fixes #210.
Closes https://github.com/facebook/css-layout/pull/211

Reviewed By: lucasr

Differential Revision: D3674922

Pulled By: emilsjolander

fbshipit-source-id: 1752f477bde45586db112fe2654d0404cc52e1d1
2016-08-05 06:28:38 -07:00
Lukas Piatkowski 4e3b484631 Put "file:line" when we can't resolve function name
Reviewed By: michalgr

Differential Revision: D3670558

fbshipit-source-id: 2a60babf16ac6e6be77ebb6e76f5179b024a77c6
2016-08-05 06:13:41 -07:00
leeight 53c1da0047 InterpolationAnimatedNode fromDoubleArray should support the string type
Summary:
The `NativeAnimationsExample` in Android can not work due to inputRange and outputRange were limited to double array type, which is different from iOS.

So we need let android version to support string array type.
Closes https://github.com/facebook/react-native/pull/8900

Differential Revision: D3674754

fbshipit-source-id: e7844f00940bf0fdd6f7f5003dd4eeefa0c317a0
2016-08-05 02:58:30 -07:00
YuTin Liu ce82428b15 docs(android): install release for android
Summary:
maybe, it is a better command.
Closes https://github.com/facebook/react-native/pull/9057

Differential Revision: D3674229

fbshipit-source-id: 0767371646c75c5743214b2695064fb61666c7c4
2016-08-04 22:13:29 -07:00
Mengjue Wang 46bac5fbba fix inset padding handling for TextInput in LTR/RTL
Summary:
Since the core layout in RN is now assigning `left/right` to `start/end`, we need to tweak the text input handling as well:
1. We need to replace all left/right to start/end
2. For text inset padding, we need to manually flipped the padding in RTL situation.

Reviewed By: fkgozali

Differential Revision: D3670277

fbshipit-source-id: 442bead25af8548a85dd1f359aa5a799982d1185
2016-08-04 21:30:02 -07:00
ShengMin Zhang b05c7f792f make sure multiline TextInput is scrollable within a ScrollView
Reviewed By: bestander

Differential Revision: D3668840

fbshipit-source-id: 349314588035935543944ea6a8ddcb730c3ee85e
2016-08-04 17:58:45 -07:00
Michał Gregorczyk 5405aeb2a3 First step to boot rn apps with hot bytecode cache
Reviewed By: tadeuzagallo

Differential Revision: D3561565

fbshipit-source-id: dc1cf580d7b31f30939b180aec38d9b8d0dd0f58
2016-08-04 15:58:36 -07:00
Michał Gregorczyk f08f23f8cb Add API to set load flags used by UnpackingJSBundleLoader
Reviewed By: tadeuzagallo

Differential Revision: D3557667

fbshipit-source-id: 5665667185cda10415210efce83685c3e3abee92
2016-08-04 15:58:36 -07:00
Hedger Wang 38979f9c68 NavigationExperimental: Stop using absolute position for NavigationHeader.
Summary:
Not a API change, but this may break the layout of exisitng apps that
uses NavigationHeader.

For now, NavigationHeader uses absolute position, which makes it hard for
NavigationCardStack to determine the height of the scenes.

Theoretically, the height of the scenes would be the height of the cards
stack minus the height of the header.

That said, if we want to support the headers with different height (e.g.
MyIOSHeader or MyAndroidHeader), we're forced to expose the height of the
headers and manually compute the height of the scenes.

Alternatively, if the header does not use absolute position, the height
of the scenes can adjust automatically with flex box, and that's what this
commit is about to do.

Reviewed By: ericvicenti

Differential Revision: D3671119

fbshipit-source-id: 26e48f801da3661c5d7dce4752ba927621172f4a
2016-08-04 15:28:30 -07:00
Janic Duplessis 158d435f36 Implement native Animated value listeners on Android
Summary:
Adds support for `Animated.Value#addListener` for native driven nodes on Android. This is based on work by skevy in the exponent RN fork. Also adds a UIExplorer example.

** Test plan **
Run unit tests

Tested that by adding a listener to a native driven animated node and checked that the listener callback is called properly.

Also tested that it doesn't crash on iOS that doesn't support this yet.
Closes https://github.com/facebook/react-native/pull/8844

Differential Revision: D3670906

fbshipit-source-id: 15700ed7b93db140d907ce80af4dae6be3102135
2016-08-04 13:13:33 -07:00
Forrest Bice 30677e7193 ReactInstanceManager API Updates
Summary:
Updating code example with updated method names...

`onHostPause` -> `onPause`
`onHostResume` -> `onResume`
`onHostDestroy` -> `onDestroy`
Closes https://github.com/facebook/react-native/pull/9217

Differential Revision: D3671267

Pulled By: javache

fbshipit-source-id: 007a2b0909fee4495a98c141bd6ac3a564b50c17
2016-08-04 13:13:33 -07:00
Eric Vicenti e3c6d8c931 Fix UIExplorer iOS swipe back
Reviewed By: hedgerwang

Differential Revision: D3670396

fbshipit-source-id: 76aafa951d869227f32c2d4c585bb1513e5eea37
2016-08-04 12:43:50 -07:00
Emil Sjolander 2f1af09a36 Add new csslayout deps to buck file
Summary: Some new csslayout deps were added that were not properly synced to open source.

Reviewed By: bestander

Differential Revision: D3670567

fbshipit-source-id: 6890aabd2eff9dadf9b33a8b44bedc6947a8525e
2016-08-04 12:43:50 -07:00
Mengjue Wang f0fb228ec7 Provide forceRTL for LTR language to test
Summary:
1. Provide forceRTL function for developer to test RTL layout in LTR language bundle in I18nUtil and expose it in I18nManager.
2. Rename `allowRTL` and `setAllowRTL` functions

Reviewed By: fkgozali

Differential Revision: D3663693

fbshipit-source-id: 3db13a44c069ae73d1728c211306422db5dd8122
2016-08-04 12:28:30 -07:00
Spencer Ahrens 0dd93b62b4 fix console.table polyfill when entries are missing
Summary: Looks like react-addons-perf is sometimes missing entries. This prevents it from crashing.

Reviewed By: davidaurelio

Differential Revision: D3669007

fbshipit-source-id: 18a1102b5ad8dcfd9b80d39e1172ba85ad0e9dd2
2016-08-04 11:43:56 -07:00
Kyle Corbitt 341b29da71 Render NavigationHeader correctly with hidden status bar
Summary:
Currently, the NavigationExperimental `Header` only renders correctly on iOS when the system status bar is visible. There are legitimate reasons to hide the status bar, especially when displaying in landscape.

This PR adds a `statusBarHeight` prop to the header, which defaults to 20 on iOS and 0 (no status bar) on Android. Changing this value causes the extra space at the top of the header reserved for the status bar to change.

I've tested this change in my own app on iOS with `statusBarHeight` set to 0, 20, and `undefined`, and ensured that it works correctly.
Closes https://github.com/facebook/react-native/pull/8983

Differential Revision: D3668637

fbshipit-source-id: 777a0c53e8fd1caa35ce4980ca3118adcf83b62d
2016-08-04 11:43:55 -07:00
Marc Horowitz 5d0131d31b Android instrumentation tests for C++ module sync methods.
Differential Revision: D3574896

fbshipit-source-id: 8cd4c55b7a472c77cc86fd5cbfe43bc4541ba6ba
2016-08-04 11:43:54 -07:00
Hedger Wang ca8531105e NavigationExperimental: Rename `renderOverlay` to `renderHeader`
Summary:
NavigationCardStack is a custom component, and its API should be explicit, not
too generic..

In NavigationCardStack, the prop `renderOverlay` is actually used to render
the NavigationHeader, and we uses absolute position to build the layout for
the header and the body.

One of the problem with using absolute postion and fixed height to build the
layout that contains the header is that the header can't have variant height
easily.

Ideally, if the layout for the header used flex-box, we'd ve able to be more
adaptive to deal with the header that has variant height.

That said, let's rename `renderOverlay` to `renderHeader`, then build the
proper layout that explicitly works better with the header.

If we to need to support overlay in navigation, we may consider add
`renderOverlay` later, if it's really necessary.

Reviewed By: ericvicenti

Differential Revision: D3670224

fbshipit-source-id: ff04acfe9dc995cb57117b3fd9b07d5f97b9c6ee
2016-08-04 11:28:31 -07:00
sam 1d980188f8 clean UIExplorer NavigationExperimental example code
Summary:
1. Explain the **motivation** for making this change.

    Those codes cleaned are not used anywhere, remove them would make the example much more clear to users.

2. **Test plan (required)**

    ![navigationexperimental](https://cloud.githubusercontent.com/assets/1091472/17392196/4f28cba4-5a4e-11e6-9ef1-727edc784f1f.gif)
Closes https://github.com/facebook/react-native/pull/9203

Differential Revision: D3668848

fbshipit-source-id: c604a21c84dba72a5a3c857fc16bc7febfe20377
2016-08-04 10:28:31 -07:00