@@ -240,51 +240,94 @@ deactivedViewStyleHandler={({ location, action, isNestedRoute }) => {
240
240
241
241
```
242
242
243
- ### transition up like Scaling
243
+ ### Vertical Swipe and Navigation
244
244
245
- ![ Scaling Transiction Up Animation] ( https://raw.githubusercontent.com/Taymindis/react-router-native-animate-stack/master/demo/scale_and_moveup .gif )
245
+ ![ Scaling Transiction Up Animation] ( https://raw.githubusercontent.com/Taymindis/react-router-native-animate-stack/master/demo/vertical_swipe .gif )
246
246
247
247
``` jsx
248
- activedViewStyleHandler= {({ location, action, isNestedRoute }) => {
249
- return {
250
- paddingLeft: 30 ,
251
- transform: [
252
- {
253
- translateY: enterAnimKit .interpolate ({
254
- inputRange: [0 , 1 ],
255
- outputRange: [height, 0 ],
256
- }),
257
- },
258
- {
259
- scale: enterAnimKit .interpolate ({
260
- inputRange: [0 , 0.5 , 1 ],
261
- outputRange: [1 , 0.2 , 1 ],
262
- }),
263
- },
264
- ],
265
- };
266
- }}
267
- deactivedViewStyleHandler= {({ location, action, isNestedRoute }) => {
268
- return {
269
- paddingLeft: 30 ,
270
- transform: [
271
- {
272
- translateY: exitAnimKit .interpolate ({
273
- inputRange: [0 , 1 ],
274
- outputRange: [0 , - height],
275
- }),
276
- },
277
- {
278
- scale: exitAnimKit .interpolate ({
279
- inputRange: [0 , 0.5 , 1 ],
280
- outputRange: [1 , 0.2 , 1 ],
281
- }),
282
- },
283
- ],
284
- };
285
- }}
286
248
287
- ```
249
+ < NativeRouter>
250
+ < View style= {styles .container }>
251
+ < View style= {{ flex: 9 , height: ' 100%' }}>
252
+ < AnimatedStack
253
+ swipeMethod= {SwipeMethod .SWIPE_VERTICAL }
254
+ onMountAnimate= {() => {
255
+ Animated .timing (enterAnimKit, {
256
+ toValue: 1 ,
257
+ duration: 100 ,
258
+ }).start ();
259
+ }}
260
+ onTransitionAnimate= {({ location, action, isNestedRoute }) => {
261
+ if (isNestedRoute) return ;
262
+ // Enter and exit or one only
263
+ enterAnimKit .setValue (0 );
264
+ exitAnimKit .setValue (0 );
265
+
266
+ Animated .timing (enterAnimKit, {
267
+ toValue: 1 ,
268
+ duration: 500 ,
269
+ delay: 200 ,
270
+ }).start ();
271
+
272
+ Animated .timing (exitAnimKit, {
273
+ toValue: 1 ,
274
+ duration: 500 ,
275
+ }).start ();
276
+ }}
277
+ activedViewStyleHandler= {({ location, action, isNestedRoute }) => {
278
+ return {
279
+ paddingLeft: 40 ,
280
+ transform: [
281
+ {
282
+ translateY: enterAnimKit .interpolate ({
283
+ inputRange: [0 , 1 ],
284
+ outputRange: [height, 0 ],
285
+ }),
286
+ },
287
+ {
288
+ scale: enterAnimKit .interpolate ({
289
+ inputRange: [0 , 0.5 , 1 ],
290
+ outputRange: [1 , 0.2 , 1 ],
291
+ }),
292
+ },
293
+ ],
294
+ };
295
+ }}
296
+ deactivedViewStyleHandler= {({ location, action, isNestedRoute }) => {
297
+ return {
298
+ transform: [
299
+ {
300
+ translateY: exitAnimKit .interpolate ({
301
+ inputRange: [0 , 1 ],
302
+ outputRange: [0 , - height],
303
+ }),
304
+ },
305
+ {
306
+ scale: exitAnimKit .interpolate ({
307
+ inputRange: [0 , 0.5 , 1 ],
308
+ outputRange: [1 , 0.2 , 1 ],
309
+ }),
310
+ },
311
+ ],
312
+ };
313
+ }}
314
+ >
315
+ < Route exact path= " /" >
316
+ < Home / >
317
+ < / Route>
318
+ < Route path= " /about" >
319
+ < About / >
320
+ < / Route>
321
+ < Route path= " /topics" component= {Topics} / >
322
+ < / AnimatedStack>
323
+ < / View>
324
+ < View style= {{ flex: 1 }}>
325
+ < Navigator / >
326
+ < / View>
327
+ < / View>
328
+ < / NativeRouter>
329
+
330
+ ```
288
331
289
332
290
333
## Reason of created this
0 commit comments