React Native return 一个元素到控制台日志
React Native return one element to console log
如果我将 new Animated.Value(0) 设置为一个变量,然后将该变量输出到控制台日志,我将得到一个永无止境的列表,如下所示。我如何 return 日志中的任何单个元素?
{ _children: [],
x:
{ _children:
[ { _children:
[ { _children:
[ { _props:
{ style: [Circular],
onStartShouldSetResponder: [Function],
onMoveShouldSetResponder: [Function],
onStartShouldSetResponderCapture: [Function],
onMoveShouldSetResponderCapture: [Function],
onResponderGrant: [Function],
onResponderReject: [Function],
onResponderRelease: [Function],
onResponderStart: [Function],
onResponderMove: [Function],
onResponderEnd: [Function],
onResponderTerminate: [Function],
onResponderTerminationRequest: [Function],
children:
{ '$$typeof': {},
type:
{ [Function]
displayName: 'Text',
propTypes: [Object],
getDefaultProps: [Object],
childContextTypes: [Object],
contextTypes: [Object],
defaultProps: [Object] },
key: null,
Animated.Value
是一个具有许多属性的复杂嵌套对象。如果您需要访问单个元素,您可以使用 dot notation 来访问。
Ex:
let obj = new Animated.Value(0);
console.log(obj._value);//assuming _value is a valid property of the object
如果我将 new Animated.Value(0) 设置为一个变量,然后将该变量输出到控制台日志,我将得到一个永无止境的列表,如下所示。我如何 return 日志中的任何单个元素?
{ _children: [],
x:
{ _children:
[ { _children:
[ { _children:
[ { _props:
{ style: [Circular],
onStartShouldSetResponder: [Function],
onMoveShouldSetResponder: [Function],
onStartShouldSetResponderCapture: [Function],
onMoveShouldSetResponderCapture: [Function],
onResponderGrant: [Function],
onResponderReject: [Function],
onResponderRelease: [Function],
onResponderStart: [Function],
onResponderMove: [Function],
onResponderEnd: [Function],
onResponderTerminate: [Function],
onResponderTerminationRequest: [Function],
children:
{ '$$typeof': {},
type:
{ [Function]
displayName: 'Text',
propTypes: [Object],
getDefaultProps: [Object],
childContextTypes: [Object],
contextTypes: [Object],
defaultProps: [Object] },
key: null,
Animated.Value
是一个具有许多属性的复杂嵌套对象。如果您需要访问单个元素,您可以使用 dot notation 来访问。
Ex:
let obj = new Animated.Value(0);
console.log(obj._value);//assuming _value is a valid property of the object