Commit Graph

1752 Commits

Author SHA1 Message Date
Spencer Ahrens 29e49bdb91 [ReactNative] LayoutAnimation brevity
Summary:
@public

Less verbose - now can just do `LayoutAnimation.easeInEaseOut()` instead of
`LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut)`

Test Plan: D2171336, play with AdsManager pickers.
2015-06-26 10:48:36 -08:00
James Ide fe7edf0860 [ListView] Defer measurement one frame after componentDidMount to fix error
Summary:
When `UIManager.measure` is called from `componentDidMount` it causes the error "Attempted to measure layout but offset or dimensions were NaN". Deferring the layout by one frame solves this problem. Layout measurement is already asynchronous anyway, so I believe adding the `requestAnimationFrame` call doesn't affect the program's correctness.

Fixes #1749

Closes https://github.com/facebook/react-native/pull/1750
Github Author: James Ide <ide@jameside.com>

Test Plan:
 Load UIExplorer and no longer get a redbox that says "Attempted to measure layout but offset or dimensions were NaN".
2015-06-26 10:26:07 -08:00
Owen Kelly 1cca4fb769 [NavigatorIOS] Allow translucent on NavigatorIOS
Summary:
Hi,

I've updated the NavigatorIOS component to allow setting the translucent property.

usage is:
```
            <NavigatorIOS
                translucent={false}
            />
```

This is my first contrib to react-native, so apologies if I've missed something.

Cheers,
Owen
Closes https://github.com/facebook/react-native/pull/1273
Github Author: Owen Kelly <owen@novede.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-26 07:17:54 -08:00
Kevin Gozali 3ec3312c7c [madman]: Fix MapView crashing problem. 2015-06-25 21:21:08 -08:00
Eric Vicenti e3e60983e6 [ReactNative] Navigator improved willFocus logic
Summary:
This makes sure to call willFocus before new scenes get mounted. This fixes cases where the keyboard is dismissed on willfocus events which incorrectly happens *after* the autofocus in a new scene. The keyboard was opening and getting immediately closed

@public

Test Plan: Test keyboard autofocus in new nav scenes on iOS
2015-06-25 14:45:23 -08:00
chaceliang 7159a4e947 Revert "[React Native] Remove layout-only nodes" 2015-06-25 13:30:06 -08:00
Eric Vicenti 7963add0d5 [ReactNative] Revamp Navigator scene cache strategy
Summary:
Updating range is too complicated. We can keep cached versions of the previously rendered scenes in a map.

@public

Test Plan: Verify that the active scene is the only thing that get re-rendered, and that rendering doesn't happen during transitions or gestures. Test navigation thouroughly in AdsManager
2015-06-25 10:36:49 -08:00
Tadeu Zagallo 5e71d352a6 [ReactNative] Guard agains errors during reconciliation
Summary:
@public

After refactoring the MessageQueue a guard was missing on around `batchedUpdates`
call.

Test Plan: Introduce an error on `getInitialState` of `AdsManagerTabsModalView.ios.js`
2015-06-25 09:40:48 -08:00
Stanislav Vishnevskiy f383bf2b83 [LayoutAnimation] RCTAnimationTypeKeyboard
Summary:
This adds the Keyboard animation type for when you want to animate UI based on the keyboard appearing/disappearing.
Closes https://github.com/facebook/react-native/pull/1366
Github Author: Stanislav Vishnevskiy <vishnevskiy@gmail.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-25 09:17:01 -08:00
David Mohl 99bc08cf61 [MapView] Support for annotation callouts, annotation press, callout presses and pin animation
Summary:
Started from here - https://github.com/facebook/react-native/issues/1120. Most functionality for annotations were missing so I started implementing and somehow got caught up until the entire thing was done.

![screen shot 2015-05-12 at 10 07 43 pm](https://cloud.githubusercontent.com/assets/688326/7588677/8479a7a4-f8f9-11e4-99a4-1dc3c7691810.png)

2 new events:
- callout presses (left / right)
- annotation presses

6 new properties for annotations:
- hasLeftCallout
- hasRightCallout
- onLeftCalloutPress
- onRightCalloutPress
- animateDrop
- id

1 new property for MapView
- onAnnotationPress

---
Now the important thing is, that I implemented all of this the way "I would do it". I am not sure this is the 'reacty' way so please let me know my mistakes 😄

The problem is that there is no real way to identify annotations which makes it difficult to distinguish which one got clicked. The idea is to pass a `id` and whether it has callouts the entire way with the annotation. I had to
Closes https://github.com/facebook/react-native/pull/1247
Github Author: David Mohl <me@dave.cx>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-25 09:15:21 -08:00
Alex Akers 3c5b4b0a9f [React Native] Remove layout-only nodes
Summary:
Remove layout-only views. Works by checking properties against a list of known properties that only affect layout. The `RCTShadowView` hierarchy still has a 1:1 correlation with the JS nodes.

This works by adjusting the tags and indices in `manageChildren`. For example, if JS told us to insert tag 1 at index 0 and tag 1 is layout-only with children whose tags are 2 and 3, we adjust it so we insert tags 2 and 3 at indices 0 and 1. This keeps changes out of `RCTView` and `RCTScrollView`. In order to simplify this logic, view moves are now processed as view removals followed by additions. A move from index 0 to 1 is recorded as a removal of view at indices 0 and 1 and an insertion of tags 1 and 2 at indices 0 and 1. Of course, the remaining indices have to be offset to take account for this.

The `collapsible` attribute is a bit of a hack to force `RCTScrollView` to always have one child. This was easier than rethinking out the logic there, but we could change this later.

@public

Test Plan: There are tests in `RCTUIManagerTests.m` that test the tag- and index-manipulation logic works. There are various scenarios including add-only, remove-only, and move. In addition, two scenario tests verify that the optimization works by checking the number of views and shadow views after various situations happen.
2015-06-25 09:12:00 -08:00
Alex Kotliarskyi 64d7933e66 [ReactNative] Ignore _UILayoutGuide in tests 2015-06-25 08:09:13 -08:00
=?UTF-8?q?=E9=9A=90=E9=A3=8E?= 7fc86dded3 [Image] Add scale support for base64-encoded image.
Summary:
Fix issue #1136
Closes https://github.com/facebook/react-native/pull/1721
Github Author: =?UTF-8?q?=E9=9A=90=E9=A3=8E?= <yinfeng.fcx@alibaba-inc.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-25 06:07:42 -08:00
Andy Street f23c022f1b [ReactNative] Send debug component ownership info in createView 2015-06-25 05:47:24 -08:00
Olivia Bishop 1373dab826 [react native] JS change to support placeholderTextColor on android 2015-06-25 05:15:21 -08:00
=?UTF-8?q?=E9=9A=90=E9=A3=8E?= b09f3eaf26 Fix animation bug in 32bit when fromValue is double.
Summary:
Now `RCTAnimationExperimentalManager` is not working on 32bit devices.

```
NSValue *fromValue = [view.layer.presentationLayer valueForKeyPath:keypath];
CGFloat fromFields[count];
[fromValue getValue:fromFields];
```

If the fromValue is kind of double value which needs two bytes in 32bit device and the count is 1, the fromFileds array will go wrong.
Closes https://github.com/facebook/react-native/pull/1725
Github Author: =?UTF-8?q?=E9=9A=90=E9=A3=8E?= <yinfeng.fcx@alibaba-inc.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-25 05:08:45 -08:00
Nick Lockwood 648c2b48c2 Restructuring FBReactKit project: Part 1 2015-06-25 02:14:33 -08:00
Amjad Masad 1109ce3b8c [react-packager] Injectible file crawlers (2x crawl speedup) 2015-06-24 18:04:57 -08:00
Tadeu Zagallo 336e18d20b [ReactNative] Move module info from bridge to RCTModuleData
Summary:
@public

The info about bridge modules (such as id, name, queue, methods...) was spread
across arrays & dictionaries on the bridge, move it into a specific class.

It also removes a lot of information that was statically cached, and now have
the same lifecycle of the bridge.

Also moved RCTModuleMethod, RCTFrameUpdate and RCTBatchedBridge into it's own
files, for organization sake.

NOTE: This diff seems huge, but most of it was just moving code :)

Test Plan:
Tested UIExplorer & UIExplorer tests, Catalyst, MAdMan and Groups. Everything
looks fine.
2015-06-24 17:42:12 -08:00
Jing Chen c157051da7 [events] Add JS require time and fix up some existing logs 2015-06-24 16:59:00 -08:00
Amjad Masad 1d43a37973 [react-packager] Check-in babel-core 2015-06-24 16:12:37 -08:00
Daryl Rowland a5db0ce0de Enabled textAlign in TextInput
Summary:
Added remapping of style textAlign property to textAlignment (which is the name of the same property on text input components)
Closes https://github.com/facebook/react-native/pull/772
Github Author: Daryl Rowland <daryl@cloudyclear.com>

Test Plan: Not sure. I tried cleaned and rebuilt and my TextInput works, though! Do we need to set up any unit tests or examples for this?
2015-06-24 15:53:13 -08:00
Amjad Masad 4ac5c7e19e [react-packager] Fix the confused node_modules detection function
Summary:
@public

We have a function that detects whether a give file is to be treated as a node_modules. If so it doesn't have access to the haste module map. There is an exception to this rule which is a few modules that are allowed to do that. Currently thats react-native, react-tools, and parse.

The current implementation had a bug where if you had `react-native` (or react-tools etc) in the name before the actual package root then the detection will be off. This fixes the problem by starting from the `lastIndexOf('node_modules')` directory, that way nothing confuses us.

Test Plan:
./runJestTests.sh
export OSS, patch, run e2e test
2015-06-24 15:20:35 -08:00
Christopher Chedeau eb9c7235e2 [ReactNative] Bring in node console.log formatting
Summary:
@public

The current output of console.log is extremely bad. If you pass NaN, it shows up as null (super confusing I know -_-), if you pass a cyclical object, it just says that it is cyclic and that's it. It doesn't print up the first few levels which are NOT cyclical and would be really helpful.

It turns out that nodejs console.log pretty printer is really awesome and can be easily extracted as a few hundred lines. This is going to be such a productivity boost that I think it's the right tradeoff to embed it like this

Test Plan:
```
var a = {kikoo: {lol: 1}}
a.kikoo.nice = a;

console.log(a);
> { kikoo: { lol: 1, nice: [Circular] } }

console.log(NaN)
> NaN
```
2015-06-24 14:11:55 -08:00
Alex Kotliarskyi 01d2df8c86 [ReactNative] NavigationContext-test mock fix for OSS 2015-06-24 13:37:46 -08:00
Spencer Ahrens bf5224bb80 [ReactNative] Support decimal color parts
Summary:
@public

Animating colors generates fractional values, so we should support them.  No
reason not to?

Test Plan: Header color animates correctly: https://www.facebook.com/groups/588394697875816/permalink/886439588071324/
2015-06-24 13:24:45 -08:00
Alex Kotliarskyi 0a6c1d6148 [ReactNative] Disable mocking "promise" in OSS Jest tests 2015-06-24 10:25:13 -08:00
Pieter De Baets effa43926b Provide root reactTag to RootComponent and use it to resolve view controllers 2015-06-24 10:20:55 -08:00
Christopher Dro 5614a04cba [RCTConvert] Sort mapping keys alphabetically in RCTLogError
Summary:

Closes https://github.com/facebook/react-native/pull/1679
Github Author: Christopher Dro <hello@blick-labs.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-24 10:00:00 -08:00
Artem Yarulin 3c72250a1a Fixed inline function to process last symbol (iOS9)
Summary:
### TL/DR:
```
a="function() {return [22]}"
a.substring(a.indexOf("{")+1,a.indexOf("}")-1) // "return [22"
a.substring(a.indexOf("{")+1,a.indexOf("}")) // "return [22]"
```

### In long: why it is broken now and why it worked before:

I've installed latest iOS 9 and started to see really strange issues when code is minified:
```
Invariant Violation: Application app has not been registered."
2015-06-18 16:29:05.898 [error][tid:com.facebook.React.JavaScript] "Error: Unexpected identifier 'transformMatrix'. Expected ']' to end a subscript expression
```

After some investigation it turns out that new Safari returned a bit different string representation for a MatrixOps.unroll. On old safari:
`function(e,t,n,r,o,i,a,s,u,c,l,p,d,h,f,m,g){t=e[0],n=e[1],r=e[2],o=e[3],i=e[4],a=e[5],s=e[6],u=e[7],c=e[8],l=e[9],p=e[10],d=e[11],h=e[12],f=e[13],m=e[14],g=e[15];}`
while using latest iOS:
`function (e,t,n,r,o,i,a,s,u,c,l,p,d,h,f,m,g){t=e[0],n=e[1],r=e[2],o=e[3],i=e[4],a=e[5],s=e[6],u=e[7],c=e[8],l=e[9]
Closes https://github.com/facebook/react-native/pull/1672
Github Author: Artem Yarulin <artem.yarulin@fessguid.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-24 09:42:51 -08:00
Hannes Verlinde d859620816 Add unit tests for RCTShadowView. 2015-06-24 00:19:46 -08:00
Tadeu Zagallo 3bb303e81a [ReactNative] Explictly set displayName on tests
Summary:
@public

For some weird reason sometimes displayName is undefined on the OSS tests, manually
set it for now to unbreak the tests.

Test Plan: Run the tests on OSS
2015-06-23 19:14:55 -08:00
Jing Chen b58578e935 [rn] Add PerformanceOverlay to the inspector 2015-06-23 15:41:41 -08:00
Nick Lockwood 0624a0fe52 Fixed async local storage 2015-06-23 14:24:42 -08:00
Eric Vicenti 47508566a0 [ReactNative] resizeMode is not a nativeOnly prop
Summary:
resizeMode is a native prop, but it is also in the propTypes, so this causes an incorrect warning:

```
Prop resizeMode = `contain` should not be set directly on Image.
```

@public

Test Plan: No warnings on image example in UIExplorer
2015-06-23 08:57:47 -08:00
Nick Lockwood 1e66e5f53d Fixed border bug on events dashboard 2015-06-23 07:54:12 -08:00
Nick Lockwood 9ed2bd6285 Fixed nil safety issue in RKSounds 2015-06-23 05:44:21 -08:00
Tadeu Zagallo bd3f9763f7 [ReactNative] Fix alert out of main thread
Summary:
@public

I've added an alert to notify when the profile has been generated, but it was
being created out of the main thread.

Test Plan:
Launch the UIExplorer, start and stop profiling, an alert should show up, and
everything should just keep working as expected.
2015-06-23 03:54:57 -08:00
Eric Vicenti 0c38229e8e [Navigator] Fix overswipe to -1, move guard 2015-06-22 17:00:52 -08:00
Eric Vicenti d105ae7e51 [AdsManager] Fix Navigation focus events for logging 2015-06-22 16:44:32 -08:00
Nick Lockwood 86639450ee Fixed AsyncLocalStorage bug 2015-06-22 14:40:33 -08:00
Spencer Ahrens 5b476d0e41 [ReactNative] Fix manual ListView loading
Summary:
@public

If something changes in the list view that should trigger more loads, it
wouldn't.  Example case is tap to load more - only the first new row would load,
but it wouldn't trigger a re-measure and subsequent layout of additional new
rows.

Test Plan: View More in Events works.
2015-06-22 13:37:30 -08:00
Tadeu Zagallo 3d6ffcf903 [ReactNative][Profiler] Fix initialize extra call + add popup
Summary:
@public

When the profile is initialized, it automatically hooks into every method of
the bridge modules, that was causing `+initialize` to be called twice.

Also add a popup to notify the user that the profile has been created.

Test Plan:
Run the UIExplorer, start the profiler, try to rage shake to open the dev menu
again. It should now work, and show an alertview with some information once the
profile is stopped.
2015-06-22 13:33:21 -08:00
Philipp von Weitershausen a8011f283d [React Native][Packager] allow --assetRoots to be relative paths 2015-06-22 12:58:04 -08:00
Hedger Wang 7f54506f96 <Navigator />: Fix the getter for `navigationContext`.
Summary:
@public
The current getter for `navigationContext` always return a static
context, and it should return an instance-based one, instead.

Test Plan:
Use console.log() in inspect that two different navigators do
have their own `navigationContext` created.
2015-06-22 12:02:55 -08:00
Alex Kotliarskyi 1429b78af5 [ReactNative] Ignore bad inputs to parseErrorStack 2015-06-22 10:09:08 -08:00
Gabe Levi 972b546fc6 [Flow] Fix or suppress errors in react-native for Flow v0.13.0 2015-06-22 09:48:15 -08:00
Forbes Lindesay fccea2f365 Replace bluebird with promise 2015-06-22 08:44:03 -08:00
Nick Lockwood eda44edad9 Fixed Cmd-R shortcut on iOS 9 2015-06-22 08:17:09 -08:00
Ruben Niculcea 457fca4cb3 Allow live reload even on errors.
Summary:
Live reload is disabled when an error has occurred. This requires the developer to fix the error and then switch to the simulator to reload the device manually; impacting developer flow and increasing alt tabbing. This pull request fixes that by allowing live reload to work even on errors.

This fixes issue: #1343.
Closes https://github.com/facebook/react-native/pull/1549
Github Author: Ruben Niculcea <ruben.niculcea@gmail.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-22 06:56:43 -08:00