DreamGamer
Lieutenant
- Registriert
- Feb. 2017
- Beiträge
- 555
Hallo, ich wollte die React Native Animated funktion nutzen und zwar für ein Bild nur gibt es das Problem ist das ich die Image Libary "react-native-scalable-image" nutzen möchte. Aber wenn ich Image ohne Animated.image nutze kann ich ja Animation nicht mehr verwenden, oder? Aktuell sieht es so bei mir aus aber dies funktioniert ja nicht, weil entweder die Value 0 oder null ist.
Hat jemand eine Idee, wie ich dies umsetzten könnte? Oder gibt es eine Alternative zu Animated?
MFG DreamGamer
Code:
class LogoZoomIn extends React.Component {
constructor(props) {
super(props);
this.state = {
widthAnim: new Animated.Value(0),
}
this.state.widthAnim.addListener(({value}) => this._value = value);
}
componentDidMount() {
Animated.timing(this.state.widthAnim,
{
toValue: 100,
duration: 10000,
}
).start(({finished}) => {
if (finished) {
console.log('Animation was completed');
} else {
console.log('Animation was aborted');
}
});
console.log(this.state.widthAnim._value);
}
render() {
return (
<Image width={widthAnim._value} source={this.props.source}></Image>
//<Image width={widthAnim} source={this.props.source}></Image>
);
}
}
Hat jemand eine Idee, wie ich dies umsetzten könnte? Oder gibt es eine Alternative zu Animated?
MFG DreamGamer