同じマークアップにもかかわらず、異なるレートで画面に表示される2つの画像があります。私が見ることのできる唯一の違いは、uriをソースとして使用する1つのイメージと、assetsディレクトリからロードされる際に必要となる他のイメージです。イメージは異なる速度で読み込みます:uri vs require?
この問題は、シミュレータとiPhoneに表示されます。
コード:
state = { opacity: new Animated.Value(0) };
componentDidMount() {
\t \t Animated.timing(this.state.opacity, {
\t \t \t toValue: 1,
\t \t \t duration: 1000
\t \t }).start();
\t }
\t render() {
\t \t return(
<View style={{ flex: 1, backgroundColor: 'white' }} >
<View style={{flex: 1}} >
\t <Animated.Image
\t \t style={{ flex:1, height: undefined, width: undefined, opacity: this.state.opacity }}
\t \t resizeMode="contain"
source={{uri: this.props.screenProps }}
/>
</View>
<View>
<Animated.Image
source={ require('../assets/images/footer.png') }
style={{height: 170, width: SCREEN_WIDTH, opacity: this.state.opacity}}
/>
</View>
</View>
\t \t);
\t }
}
私は一緒にロードするカレンダーの引用画像とフッターの画像をしたいと思います。