Commit Graph

3008 Commits

Author SHA1 Message Date
Tienchai Wirojsaksaree ff12423d63 Fixing touch/mouse issues with TapEventPlugin
On ios device, browser simulates mouse events, but does that with
a delay, because of double tap gesture. The problem is that
TapEventPlugins listens to both types of events, so it fires twice

Everytime there is a touch event, we should ignore mouse events that
follow it.  This way, we still respond to both mouse and touch events,
just ignore the device generated ones.
2014-10-27 17:02:03 -07:00
Paul O’Shannessy 1c241b3ebc Ensure PropTypes test works when warning module is replaced
For example, warning might be replaced with a module that throws errors,
as is the case internally when running tests. Previously we were
whitelisting this test to provide time to update callsites. Now we
aren't and it fails.
2014-10-27 16:58:54 -07:00
Paul O’Shannessy d63aa0f113 Move Object.assign file to align with internal 2014-10-26 17:14:00 -07:00
Paul O’Shannessy 076a8285f7 Merge pull request #2409 from enaqx/master
Remove obsolete jshint options
2014-10-26 11:12:20 -07:00
Nick Raienko eb3337b018 Remove obsolete jshint options 2014-10-26 12:18:24 +02:00
Sebastian Markbåge ae8771fe2e Merge pull request #2084 from kimagure/unmount-comp-error
Error when unmountComponentAtNode receives non-node
2014-10-23 12:53:40 -07:00
Sebastian Markbåge 29bcda463e Merge pull request #2387 from fabiomcosta/avoid_double_scrollread
avoid reading the scroll position twice
2014-10-23 12:51:23 -07:00
Sebastian Markbåge b7cd3e7d1d Merge pull request #2396 from sebmarkbage/classmodule
Move Class Creation Concerns into a ReactClass Module
2014-10-23 12:50:17 -07:00
Sebastian Markbage 7ce8c844bd Hide ReactElement constructor
This prevents feature tests like:

var ReactElement = React.createElement(...).constructor;

if (element.constructor === ReactElement)

This is intentional so that we have the option to make these plain objects.
E.g. for direct inlining or replacing them with value types.
2014-10-23 12:08:14 -07:00
Paul O’Shannessy 8de03c47dd Merge pull request #2397 from mjul/fix-gruntfile
Added missing semicolon after statement.
2014-10-23 12:01:55 -07:00
Martin Jul 994fc7d8a7 Merge remote-tracking branch 'upstream/master' into fix-gruntfile 2014-10-23 09:55:43 +02:00
Martin Jul c9fb57feb3 Added missing semicolons identified by using grunt jshint:project. 2014-10-23 09:54:13 +02:00
Sebastian Markbage d9fe40e147 Move Class Creation Concerns to ReactClass
This moves logic responsible for class creation and mixins into
the ReactClass module. This currently creates a class that extends
the ReactCompositeBase but in the future, this will be decoupled as
ReactCompositeComponent will compose these classes.

This is just a cut/paste.
2014-10-22 21:25:20 -07:00
Sebastian Markbage c7bb936566 Introduce React Class as an alias for Composite Component
This is in preparation for the separation of Composite Component internals
from the Class abstraction.
2014-10-22 18:35:10 -07:00
Lee Byron d545238fd9 Merge pull request #2376 from leebyron/iterable
Allow iterables in traverseAllChildren
2014-10-22 18:18:08 -07:00
Ben Alpert de1dacdb28 Refactor composite component update flow
Fixes #1392.

Previously, ReactComponent.updateComponent set the new props and owner and updated the component's refs. Because it did the actual props assignment, it had to be called by ReactCompositeComponent between componentWillMount and componentDidMount, meaning that it was skipped if shouldComponentUpdate returned false. Now, updateComponent takes the old and new descriptors and only updates refs, allowing a subclass to call updateComponent at a convenient time (specifically, it can be before `this._descriptor` is updated if the subclass also overrides performUpdateIfNecessary).

The new update cycle for composites is:

- receiveComponent is called which stores `this._pendingDescriptor` and calls performUpdateIfNecessary directly or a state update is enqueued, in which case ReactUpdates will call performUpdateIfNecessary
- performUpdateIfNecessary ensures that an update is still pending (which might no longer be the case if an update is queued for a subcomponent that was updated through a parent's reconciliation) and calls updateComponent with the old and new descriptors
- updateComponent calls super to update refs, then calls componentWillReceiveProps (if applicable) and shouldComponentUpdate -- if shouldComponentUpdate returns false, `this._descriptor`, `this.props`, and `this.state` are updated and the update is skipped; else, _performComponentUpdate is called
- _performComponentUpdate calls componentWillUpdate and _updateRenderedComponent, and enqueues the componentDidUpdate call (in that order)
- _updateRenderedComponent calls render and updates the rendered component appropriately

For DOM components (essentially unchanged):

- receiveComponent is called which does a short-circuit check for descriptor equality and delegates to super (which stores `this._pendingDescriptor` and calls performUpdateIfNecessary)
- performUpdateIfNecessary (not overridden) sets new values for `this.props`, etc. and calls updateComponent
- updateComponent does the DOM property and children updates (some synchronously, some queued for the transaction close)

For text and ART components (unchanged):

- receiveComponent updates the DOM or ART directly based on the new props
- updateComponent is never called

Notable changes:

- When shouldComponentUpdate returns false, refs are still updated
- ReactDefaultPerf now includes lifecycle methods in component timings
- updateComponent's signature changed (technically this is part of the public API, though we've never documented it)

Test Plan: jest
2014-10-22 17:59:58 -07:00
Ben Alpert 9c2125599c Add \n after <textarea> to fix missing linebreaks
Same for <pre> and <listing>. Browsers are crazy.

Test Plan: jest, verify in Chrome that starting textareas with a value starting with two newlines renders both newlines instead of one newline, as it did before.
2014-10-22 17:24:24 -07:00
Martin Jul 70fdd5a287 Added missing semicolon after statement. 2014-10-22 23:46:54 +02:00
Paul O’Shannessy b78fe39b60 Bump version to 0.13.0-alpha 2014-10-22 14:19:54 -07:00
Ben Alpert 5e2d926d65 Merge pull request #2372 from spicyj/docs012-1
Update docs to align with 0.12 better
2014-10-22 14:02:35 -07:00
Ben Alpert 52494f9d72 Update docs to align with 0.12 better
- Rename React.renderComponent -> React.render
- Remove most references to transferPropsTo
2014-10-22 14:01:54 -07:00
Paul O’Shannessy 85a98d4c8e Merge pull request #2322 from zpao/update-licenses-docs-examples
Update docs/examples with licenses
2014-10-22 13:13:56 -07:00
Paul O’Shannessy 7dc0e3d746 Update licenses for docs and examples
Docs are now CC licensed
Examples are under a separate license
2014-10-22 12:35:08 -07:00
Lee Byron c07ea0ba34 Allow iterables in traverseAllChildren
This lets you use any kind of iterable as a container of react child elements. It also preserves keys when possible if the iterable is keyed.

 * Use an ES6 Map or Set to hold children.
 * Use an Immutable-js collection to hold children.
 * Use a function* which yields children.

Concretely, this removes the necessary conversion to JS objects if you're mapping over Immutable-js collections to get children, i.e.:

```
<div>
  {myImmutable.map(val => <span>{val}</span>).toJS()
</div>
```

Now we can remove the `toJS()` and the intermediate allocation along with it.

This also cleans up the traverseAllChildrenImpl method.
2014-10-21 15:18:53 -07:00
Ben Alpert 631b6a097c Merge pull request #2388 from spicyj/null-key
Support but warn on key={null}
2014-10-21 14:20:16 -07:00
Paul O’Shannessy ac3e9b55e0 Merge pull request #2370 from chenglou/rm-school
[Docs] Remove most of @jsx
2014-10-21 14:11:22 -07:00
Ben Alpert dd92786fb0 Support but warn on key={null}
Fixes #2386.

Test Plan: jest
2014-10-20 17:19:48 -07:00
Sebastian Markbåge 2bdad81955 Merge pull request #2384 from sebmarkbage/deprecateisvalidclass
Deprecate isValidClass
2014-10-20 17:17:56 -07:00
Fabio M. Costa dafaf1a42e avoid reading the scroll position twice 2014-10-20 13:30:02 -07:00
Cheng Lou 1b3b432d64 [Docs] Remove most of @jsx
I kept some places intact (search for @jsx) because they require other bigger changes:

- ref-01-top-level-api.md
- grunt/tasks/npm.js
- old blog posts (don't change those)
- examples/ folder, as they have their own package.json that rely on old dependencies (node-jsx, reactify) that haven't upgraded to 0.12
2014-10-20 14:44:07 -04:00
Paul O’Shannessy be468c2c22 Merge pull request #2373 from genbit/docs-animation-props
Update 09.1-animation.md
2014-10-20 11:01:36 -07:00
Paul O’Shannessy a94bfd7888 Merge pull request #2381 from shripadk/jsdoc-fix
Fix JSDoc tag in ReactElement.js
2014-10-20 10:56:46 -07:00
Sebastian Markbage ef971014bc Deprecate isValidClass
Fixes #2374
2014-10-19 23:55:57 -07:00
Shripad K 621bb09cd7 Fix JSDoc tag in ReactElement.js 2014-10-19 21:01:45 +05:30
Sergey Generalov 3031c6591e Update 09.1-animation.md
Add note about ReactTransitionGroup, that any additional, user-defined, properties will be become properties of the rendered component.
And example how to render a `<ul>` with css class.
2014-10-17 20:18:45 -07:00
Ben Alpert daf4182707 Merge pull request #2368 from spicyj/use-the-string
Fix warning message for using React.DOM.* as type
2014-10-17 12:01:17 -07:00
Christopher Chedeau dec41bbbca Merge pull request #2356 from vjeux/roundup_23
Community round-up #23
2014-10-17 07:58:40 -07:00
Christopher Chedeau 6470920125 Community round-up #23 2014-10-17 07:56:28 -07:00
Ben Alpert 810582d114 Fix warning message for using React.DOM.* as type
Previously, this said 'Use the string "function() { [native code] }" instead.'.
2014-10-16 18:22:37 -07:00
Paul O’Shannessy 56e84d8cf3 Merge pull request #2364 from zpao/0.12rc-blog-post
0.12 rc1 release materials
2014-10-16 15:34:11 -07:00
Paul O’Shannessy aca264e399 0.12 rc1 release materials
* blog post
* starter kit
2014-10-16 15:31:52 -07:00
Paul O’Shannessy 2b4e35870b v0.12.0-rc1 v0.12.0-rc1 2014-10-16 14:56:50 -07:00
Sebastian Markbåge 22903a57e8 Merge pull request #2363 from sebmarkbage/assign
Use hasOwnProperty checks in Object.assign
2014-10-16 11:52:43 -07:00
Sebastian Markbage 25d63b43ef Use hasOwnProperty checks in Object.assign
Because IE8 polyfills add enumerable properties, this doesn't play nicely.
So for IE8 compatibility we add this check. Slower though. :(
2014-10-16 11:49:50 -07:00
Sebastian Markbåge 828efb798a Merge pull request #2350 from sebmarkbage/assign
Hide Object.assign polyfill behind a module
2014-10-16 09:29:01 -07:00
Sebastian Markbage 8210beeef4 Hide Object.assign polyfill behind a module
Because the JS community's polyfilling infrastructure sucks and we'll
have to fix it for them before we require this.

JSX spread uses React.__spread
(which might get special behavior for key/ref, not sure yet)

This never uses the native implementation and throws for prototype chains.
Once the native implementations are faster, we'll start using them.
2014-10-16 09:21:10 -07:00
Paul O’Shannessy 5263f61c87 Merge pull request #2357 from jimjea/patch-1
Minor grammar change to Thinking in React
2014-10-15 17:01:57 -07:00
Jimmy Jea 43dbd29bb1 minor change to post
Hello,

I was just reading through your post and noticed a minor change. The sentence originally read, "It's scaled very well for us...". I thought it was a little unclear since it's can mean "it has" or "it is", which can make this sentence take on a whole different meaning.
2014-10-15 16:36:30 -07:00
Paul O’Shannessy 4d06df3153 Merge pull request #2359 from zpao/fix-blog-post
[docs] Move React Elements post to right place, fix typo
2014-10-15 16:22:36 -07:00
Paul O’Shannessy dcbc64ac76 [docs] Move React Elements post to right place, fix typo
The URL already made its way around so we can't just break it. We might
want to just live with it instead of even doing this redirect.

https://github.com/plaxdan/react/commit/2b225446c03192b58e176f8885e60055cf5ea436#commitcomment-8176218
2014-10-15 16:10:03 -07:00