RN: Stop Deep Linking ReactChildren

Reviewed By: sebmarkbage

Differential Revision: D4025469

fbshipit-source-id: 311f9d741101133155395355d8468938435063f7
This commit is contained in:
Tim Yung 2016-10-14 18:50:19 -07:00 committed by Facebook Github Bot
parent edecbcddcc
commit efcdef711e
3 changed files with 4 additions and 7 deletions

View File

@ -14,7 +14,6 @@
var ColorPropType = require('ColorPropType');
var React = require('React');
var ReactChildren = require('react/lib/ReactChildren');
var StyleSheet = require('StyleSheet');
var StyleSheetPropType = require('StyleSheetPropType');
var View = require('View');
@ -79,7 +78,7 @@ class PickerAndroid extends React.Component {
// Translate prop and children into stuff that the native picker understands.
_stateFromProps = (props) => {
var selectedIndex = 0;
const items = ReactChildren.map(props.children, (child, index) => {
const items = React.Children.map(props.children, (child, index) => {
if (child.props.value === props.selectedValue) {
selectedIndex = index;
}

View File

@ -14,7 +14,6 @@
var NativeMethodsMixin = require('react/lib/NativeMethodsMixin');
var React = require('React');
var ReactChildren = require('react/lib/ReactChildren');
var StyleSheet = require('StyleSheet');
var StyleSheetPropType = require('StyleSheetPropType');
var TextStylePropTypes = require('TextStylePropTypes');
@ -45,7 +44,7 @@ var PickerIOS = React.createClass({
_stateFromProps: function(props) {
var selectedIndex = 0;
var items = [];
ReactChildren.toArray(props.children).forEach(function (child, index) {
React.Children.toArray(props.children).forEach(function (child, index) {
if (child.props.value === props.selectedValue) {
selectedIndex = index;
}

View File

@ -18,7 +18,6 @@ const NativeMethodsMixin = require('react/lib/NativeMethodsMixin');
const Platform = require('Platform');
const React = require('React');
const ReactNative = require('ReactNative');
const ReactChildren = require('react/lib/ReactChildren');
const StyleSheet = require('StyleSheet');
const Text = require('Text');
const TextInputState = require('TextInputState');
@ -621,7 +620,7 @@ const TextInput = React.createClass({
} else {
var children = props.children;
var childCount = 0;
ReactChildren.forEach(children, () => ++childCount);
React.Children.forEach(children, () => ++childCount);
invariant(
!(props.value && childCount),
'Cannot specify both value and children.'
@ -670,7 +669,7 @@ const TextInput = React.createClass({
UIManager.AndroidTextInput.Constants.AutoCapitalizationType[this.props.autoCapitalize];
var children = this.props.children;
var childCount = 0;
ReactChildren.forEach(children, () => ++childCount);
React.Children.forEach(children, () => ++childCount);
invariant(
!(this.props.value && childCount),
'Cannot specify both value and children.'