Skip to content

BUG: version 15.6 is not working on iOS 9.3 and below (inputValueTracking.js) #9959

Closed
@morten-olsen

Description

@morten-olsen

It appears that version 15.6 does not work on older iOS devices (iOS 9.2 and 9.3 tested to be affected)

The root cause appears to be that Object.getOwnPropertyDescriptor is broken on these versions (it simply return undefined)
This method is used inside src/renderers/dom/shared/inputValueTracking.js, which causes React to break on ReactDOM.render causing nothing to be rendered

Error message:
TypeError: undefined is not an object (evaluating 's.get.call')

Stack trace:

get — inputValueTracking.js:70
postMountWrapper — ReactDOMInput.js:217
s — ReactDOMComponent.js:182
notifyAll — CallbackQueue.js:76
close — ReactReconcileTransaction.js:80
closeAll — Transaction.js:209
perform — Transaction.js:156
s — ReactMount.js:126
perform — Transaction.js:143
batchedUpdates — ReactDefaultBatchingStrategy.js:62
i — ReactUpdates.js:97
_renderNewRootComponent — ReactMount.js:319
_renderSubtreeIntoContainer — 1497445420246.mobile.js:37:84724
render — ReactMount.js:422
(anonymous function) — mobile.js:103
(anonymous function) — es6.promise.js:87
(anonymous function) — es6.promise.js:100
l — _microtask.js:18

Affected code:

track: function (inst) {
  if (getTracker(inst)) {
    return;
  }
  var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  var valueField = isCheckable(node) ? 'checked' : 'value';
  var descriptor = Object.getOwnPropertyDescriptor(node.constructor.prototype, valueField);

  var currentValue = '' + node[valueField];

  // if someone has already defined a value bail and don't track value
  // will cause over reporting of changes, but it's better then a hard failure
  // (needed for certain tests that spyOn input values)
  if (node.hasOwnProperty(valueField)) {
    return;
  }

  Object.defineProperty(node, valueField, {
    enumerable: descriptor.enumerable,
    configurable: true,
    get: function () {
      return descriptor.get.call(this);
    },
    set: function (value) {
      currentValue = '' + value;
      descriptor.set.call(this, value);
    }
  });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions