Commit Graph
3784 Commits
Author SHA1 Message Date
Dan Abramov 77add81e28 Merge branch 'master' into rollup 2017-03-29 13:59:44 +01:00
Dominic Gannaway 660306982c added DEV condition around getDeclarationErrorAddendum contents 2017-03-29 13:49:30 +01:00
Brian Vaughn a749f4fb63 Adding fix to EventPropagators that was accidentally omitted from PR #9219 (#9274) 2017-03-28 11:24:13 -07:00
Brian Vaughn fca5d3ffc5 Added missing @flow annotation to ReactNativeFeatureFlags file (#9267) 2017-03-27 14:59:37 -07:00
Nathan Hunzaker 29d9710892 Fix Chrome number input backspace and invalid input issue (#7359)
* Only re-assign defaultValue if it is different

* Do not set value if it is the same

* Properly cover defaultValue

* Use coercion to be smart about value assignment

* Add explanation of loose type checks in value assignment.

* Add test coverage for setAttribute update.

* Only apply loose value check to text inputs

* Fix case where empty switches to zero

* Handle zero case in controlled input

* Correct mistake with default value assignment after rebase

* Do not assign bad input to number input

* Only trigger number input value attribute updates on blur

* Remove reference to LinkedValueUtils

* Record new fiber tests

* Add tests for blurred number input behavior

* Replace onBlur wrapper with rule in ChangeEventPlugin

* Sift down to only number inputs

* Re-record fiber tests

* Add test case for updating attribute on uncontrolled inputs. Make related correction

* Handle uncontrolled inputs, integrate fiber

* Reorder boolean to mitigate DOM checks

* Only assign value if it is different

* Add number input browser test fixtures

During the course of the number input fix, we uncovered many edge
cases. This commit adds browser test fixtures for each of those instances.

* Address edge case preventing number precision lower than 1 place

0.0 coerces to 0, however they are not the same value when doing
string comparision. This prevented controlled number inputs from
inputing the characters `0.00`.

Also adds test cases.

* Accommodate lack of IE9 number input support

IE9 does not support number inputs. Number inputs in IE9 fallback to
traditional text inputs. This means that accessing `input.value` will
report the raw text, rather than parsing a numeric value.

This commit makes the ReactDOMInput wrapper check to see if the `type`
prop has been configured to `"number"`. In those cases, it will
perform a comparison based upon `parseFloat` instead of the raw input
value.

* Remove footnotes about IE exponent issues

With the recent IE9 fix, IE properly inserts `e` when it produces an
invalid number.

* Address exception in IE9/10 ChangeEventPlugin blur event

On blur, inputs have their values assigned. This is so that number
inputs do not conduct unexpected behavior in
Chrome/Safari. Unfortunately, there are cases where the target
instance might be undefined in IE9/10, raising an exception.

* Migrate over ReactDOMInput.js number input fixes to Fiber

Also re-record tests

* Update number fixtures to use latest components

* Add number input test case for dashes and negative numbers

* Replace trailing dash test case with replace with dash

Also run prettier
2017-03-27 11:39:18 -05:00
Dominic Gannaway 88293c7180 added shims for DEV only code so it does not get included in prod bundles 2017-03-27 16:02:42 +01:00
Dominic Gannaway b025c43487 Added init() dev block to ReactTestUtils 2017-03-27 15:46:18 +01:00
Dominic Gannaway d526452b0b fixed merge conflicts with upstream master 2017-03-27 12:32:58 +01:00
Sasha Aickin c51411c812 Adding new SSR tests for context, refs, and reviving markup. (#9257) 2017-03-26 13:32:23 -07:00
Brian Vaughn cb585229bc Ran yarn and fixed line-length lint issue 2017-03-24 19:59:05 -07:00
Dan Abramov 9347ca0115 Work around Jest issue with CurrentOwner shared state in www 2017-03-25 00:55:10 +00:00
Brian Vaughn 71a87bcfee Updating packages for 16.0.0-alpha.6 release 2017-03-24 23:16:34 +00:00
Brian Vaughn c5156eb0be ReactElementValidator uses temporary ReactNative View propTypes getter (#9256) 2017-03-24 23:16:24 +00:00
Sasha Aickin 60e78e37b8 Add more SSR unit tests for elements and children. (#9221)
* Adding more SSR unit tests for elements and children.

* Some of my SSR tests were testing for react-text and react-empty elements that no longer exist in Fiber. Fixed the tests so that they expect correct markup in Fiber.

* Tweaked some test names after @gaearon review comment https://github.com/facebook/react/pull/9221#discussion_r107045673 . Also realized that one of the tests was essentially a direct copy of another, so deleted it.

* Responding to code review https://github.com/facebook/react/pull/9221#pullrequestreview-28996315 . Thanks @spicyj!
2017-03-24 23:16:24 +00:00
Brian Vaughn 1a29b4e2a3 Updating packages for 16.0.0-alpha.6 release 2017-03-24 15:44:09 -07:00
Brian Vaughn 1acf949240 ReactElementValidator uses temporary ReactNative View propTypes getter (#9256) 2017-03-24 15:37:21 -07:00
Sasha Aickin 25deff6203 Add more SSR unit tests for elements and children. (#9221)
* Adding more SSR unit tests for elements and children.

* Some of my SSR tests were testing for react-text and react-empty elements that no longer exist in Fiber. Fixed the tests so that they expect correct markup in Fiber.

* Tweaked some test names after @gaearon review comment https://github.com/facebook/react/pull/9221#discussion_r107045673 . Also realized that one of the tests was essentially a direct copy of another, so deleted it.

* Responding to code review https://github.com/facebook/react/pull/9221#pullrequestreview-28996315 . Thanks @spicyj!
2017-03-24 13:31:15 -07:00
Dan Abramov 4691521ccb Merge branch 'master' into rollup 2017-03-24 18:19:44 +00:00
Dan Abramov 0a41890eaa Remove rethrowCaughtError injection (#9252) 2017-03-24 18:19:12 +00:00
Dan Abramov bd4ff9d6bf Unflowify shims 2017-03-24 16:22:05 +00:00
Dan Abramov a57e1403d9 Tweak reactComponentExpect to make it standalone-ish in www 2017-03-23 21:25:59 +00:00
Dan Abramov c84f4e03bc Add missing ReactErrorUtils shim 2017-03-23 21:15:30 +00:00
Dan Abramov 779d5bd040 Fix merge conflict 2017-03-23 19:55:23 +00:00
Dan Abramov f082e35b36 Fix up invariant import to be from fbjs/lib/ 2017-03-23 19:45:10 +00:00
Dan Abramov 4d1584b055 Fix ReactErrorUtils injection (#9247) 2017-03-23 19:43:22 +00:00
Dan Abramov 26fa2cdedc Add dynamic injection to ReactErrorUtils (#9246) 2017-03-23 19:43:22 +00:00
Brian Vaughn 07a963a5f4 Updated ReactNative findNodeHandle() to handle number case (#9238) 2017-03-23 19:43:22 +00:00
Dan Abramov d6a2c669d2 Fix ReactErrorUtils injection (#9247) 2017-03-23 19:13:07 +00:00
Dan Abramov 1c9dcd53d5 Add dynamic injection to ReactErrorUtils (#9246) 2017-03-23 18:45:38 +00:00
Brian Vaughn c8897f8382 Updated ReactNative findNodeHandle() to handle number case (#9238) 2017-03-23 08:16:52 -07:00
Dominic Gannaway 373e15b4a7 fixed merge conflict 2017-03-22 19:14:19 +00:00
Dan Abramov b0b9f37960 Fix up Flow syntax 2017-03-22 18:41:42 +00:00
Dan Abramov 8de9c6c12c Add injection for error dialog (#9235) 2017-03-22 18:21:12 +00:00
Brian Vaughn 8ce5fe97b5 Bumped React version to 16.0.0-alpha.5 2017-03-21 13:04:08 -07:00
Dominic Gannaway 0e2f67168b added NPM package creation and copying into build chain 2017-03-21 18:57:51 +00:00
Dominic Gannaway 4a578dbc65 Fixed merge conflicts in ReactNative.js and ReactMethodsMixin.js 2017-03-21 14:10:04 +00:00
Valentin Shergin 97ab3f5ef8 Removed optimization for events without target in ReactNativeEventEmitter (#9219)
* Removed optimization for events without target in ReactNativeEventEmitter

This PR fixes the problem originally introduced in https://github.com/facebook/react/pull/6590
The problem is that `ResponderEventPlugin` (and `ResponderTouchHistoryStore`) relies on that fact that touch events are balanced.
So if one `startish` event happened, should be coming `endish` event. Otherwise there is no way to maintain internal `trackedTouchCount` counter. So, if we drop some events, we break this logic.

Moreover, that optimization clearly contradict with this statement from `ResponderEventPlugin`:
```
We must be resilient to `targetInst` being `null` on `touchMove` or
`touchEnd`. On certain platforms, this means that a native scroll has
assumed control and the original touch targets are destroyed.
```

This issue causes several major problems in React Native, and one of them (finally!) is easy to reproduce: https://github.com/facebook/react-native/issues/12976 .

The test also illustrates this problem.

* Prettier
2017-03-20 17:07:28 -07:00
Brian Vaughn 7f665da0ee ReactNative upstream sync (#9197)
* Addresses a circular dependency between NativeMethodsMixin and ReactNativeFiber:

* Created new ReactNativeFiberHostComponent with similar interface but without unnecessary call to findNodeHandle.
* Created new Flow interface for mixins to ensure ReactNativeFiberHostComponent and NativeMethodsMixinUtils stay synced.
* Moved helper methods to NativeMethodsMixinUtils to be shared between the 2 wrappers.

This diff was submitted and reviewed internally along with some other ReactNative changes. This is the React-only portion.

* Removed unused Flow type import

* Copied a Flow fix from internal
2017-03-20 13:50:31 -07:00
Dan Abramov e15a481773 Re-add tests unintentionally deleted in #9209 (#9225)
These tests are useful and don't test addons specifically.
I moved them to appropriate places in the codebase.
2017-03-20 19:38:54 +00:00
Dan Abramov 34e4352cba Delete addons (#9209)
* Delete addons

* Remove ReactFragment dependency from tests

* Remove addons testing from fixtures

* Don't mention createFragment() in a warning

* Address feedback

* Remove unused variables

* Remove mention of deleted file

* Add a missing key to the test

* Fix lint
2017-03-20 16:15:01 +00:00
Sasha Aickin 78761c387f Add unit tests for props to attribute mapping in SSR. (#9106)
* Added a handful of SSR unit tests, ported from a previous pull request.

* Fixing linting errors

* Fixed a test helper function to properly report errors.

* Un-nested the new rendering tests. Updated the fiber test passing/not passing lists.

* Edited to comply with the react/jsx-space-before-closing eslint rule, which will soon be merged into master.

* Response to code review from @spicyj. Moved tests to separate file, reworked wording of test names, corrected use of canUseDom, and simplified tests against tagName. Thanks for the help, @spicyj!

* Converted the unit tests to use async-await style.

* Moved async-await babel transform for tests from .babelrc to preprocessor.js.

* Response to code review in PR #9089. Thanks, @spicyj!

* Fixing some bugs in the SSR unit tests.

* Missed deleting some repeated code in the last commit.

* Adding unit tests for property to attribute mapping in SSR.

* Removing some redundant unit tests.

* Oops. I forgot to re-run record-tests after c593dbc; fixing that here.

* Reformatting for prettier so that the build will pass.
2017-03-19 16:08:55 +00:00
Andrew Clark f606e0e7d3 Merge pull request #9145 from acdlite/explicitnullcheckfiberupdatequeue
Use explicit null checks in ReactFiberUpdateQueue
2017-03-17 10:44:11 -07:00
Sebastian Markbåge 9c7cf20dd5 Ignore event listener extraction on numeric text components (#9194)
In ReactDOM we don't dispatch events in the synthetic event system on to
text nodes. We back up one to the element before dispatching.

In React Native we don't do that. The iOS native side doesn't dispatch on
the text nodes but only the parent. The Android native side however does
dispatch on text nodes.

We already covered this for strings, but current element in Stack can be
a number if it is numeric text content.
2017-03-16 15:29:06 -07:00
Dan Abramov e4fcbecc1e Add a working RN build 2017-03-16 19:10:46 +00:00
Andrew Clark bc30ef9842 Work around loose typing for fiber.updateQueue
The updateQueue field is currently an any type. Check the fiber's tag so
that only UpdateQueues are passed to getPendingPriority.
2017-03-15 15:05:04 -07:00
Andrew Clark 21e0e3711b Use explicit null checks in ReactFiberUpdateQueue
Follow-up to #8978
2017-03-15 15:04:59 -07:00
Dan Abramov 7a2819042f Work in progress: start adding ReactNative bundle 2017-03-15 21:29:39 +00:00
Dan Abramov 2c9ea97f5e Merge branch 'master' into rollup 2017-03-15 20:09:13 +00:00
Sebastian Markbage 7e078d6a92 Fix lint rules
The typeof one is a bit strange because the disable rule gets moved.
2017-03-14 14:12:35 -07:00
Sebastian Markbage ba1299acc2 Non idempotent steps in prettier 2017-03-13 17:06:03 -07:00