简体   繁体   English

Animated.View 在 React Native 中不起作用

[英]Animated.View not working in React Native

import React, { Component } from 'react' import { View, StyleSheet, Text, Image, ScrollView, Animated } from 'react-native'; import React, { Component } from 'react' import { View, StyleSheet, Text, Image, ScrollView, Animated } from 'react-native';

class App extends Component {类 App 扩展组件 {

constructor(props) { super(props) this.state = { scrollY: new Animated.Value(0) } }构造函数(道具){ 超级(道具) this.state = { scrollY: new Animated.Value(0) } }

render() {使成为() {

const headerheight = this.state.scrollY.interpolate({
  inputRange: [0, 100],
  outputRange: [100, 0]
})
return (
  <View style={styles.container}>
    <Animated.View style={styles.appHeader}>
    </Animated.View>
    <ScrollView style={styles.scroll}
      onScroll={Animated.event([{ nativeEvent: { contentOffset: { Y: this.state.scrollY } } }])}>
      <View style={styles.imageView}>
        <Image style={styles.image} source={require('./assets/vikalp.jpg')} />
      </View>
      <View>
        <Text style={styles.textHeader}>Vikalp Chakravorty</Text>
      </View>
    </ScrollView>
  </View>
);

Can you explain you question?你能解释一下你的问题吗? What kind of animation do you want to create?你想创作什么样的动画?

<Animated.View style={styles.appHeader}> in here what kind of props that you pass? <Animated.View style={styles.appHeader}>在这里你传递了什么样的道具?

If you give us more detail then we can help.如果您提供更多详细信息,我们可以提供帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM