Skip to content

Commit c1b662a

Browse files
committed
animation: create new image with same style as activeImage at the start
1 parent 641f03d commit c1b662a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/HomeScreen.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { SafeAreaView } from 'react-navigation'
1212
import { FlatList, TouchableOpacity } from 'react-native-gesture-handler';
1313

1414
const WINDOW_WIDTH = Dimensions.get('window').width
15+
const WINDOW_HEIGHT = Dimensions.get('window').height
1516

1617
class HomeScreen extends Component {
1718

@@ -92,6 +93,13 @@ class HomeScreen extends Component {
9293
}
9394

9495
render() {
96+
const activeImageStyle = {
97+
width: this.dimensions.x,
98+
height: this.dimensions.y,
99+
left: this.position.x,
100+
top: this.position.y
101+
}
102+
95103
return (
96104
<SafeAreaView style={styles.container}>
97105
<Text category="h4" style={styles.welcome}>Welcome to Home Screen</Text>
@@ -108,7 +116,7 @@ class HomeScreen extends Component {
108116
>
109117
<View style={{ flex: 2 }}>
110118
<Animated.Image
111-
style={{ height: "80%", width: "100%" }}
119+
style={[{ top: 0, left: 0, height: WINDOW_HEIGHT - 100, width: WINDOW_WIDTH - 40, resizeMode: 'cover' }, activeImageStyle]}
112120
source={{ uri: this.state.activeImage ? this.state.activeImage.imageUrl : null }}
113121
>
114122
</Animated.Image>

0 commit comments

Comments
 (0)