如果我将新的Animated.Value(0)设置为变量,然后将该变量输出到控制台日志,我会得到一个永不停止的列表,如下所示。如何将任何单个元素返回到日志中?
{ _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,
答案 0 :(得分:1)
Animated.Value
是一个具有许多属性的复杂嵌套对象。如果您需要访问单个元素,可以使用dot notation进行访问。
Ex:
let obj = new Animated.Value(0);
console.log(obj._value);//assuming _value is a valid property of the object