|
@@ -1,13 +1,13 @@
|
1
|
1
|
# Android Specific Use Cases
|
2
|
2
|
|
3
|
|
-* [Activity Lifecycle and onActivityResult](https://wix.github.io/react-native-navigation/#/android-specific-use-cases?id=activity-lifecycle-and-onactivityresult)
|
4
|
|
-* [Adjusting soft input mode](https://wix.github.io/react-native-navigation/#/android-specific-use-cases?id=adjusting-soft-input-mode)
|
5
|
|
-* [Splash screen](https://wix.github.io/react-native-navigation/#/android-specific-use-cases?id=splash-screen)
|
6
|
|
-* [Collapsing React header](https://wix.github.io/react-native-navigation/#/android-specific-use-cases?id=collapsing-react-header)
|
7
|
|
- * [Collapsing react view](https://wix.github.io/react-native-navigation/#/android-specific-use-cases?id=collapsing-react-view)
|
8
|
|
- * [Collapsing react view with top tabs](https://wix.github.io/react-native-navigation/#/android-specific-use-cases?id=collapsing-react-view-with-top-tabs)
|
9
|
|
-* [Shared Element Transition](https://wix.github.io/react-native-navigation/#/android-specific-use-cases?id=shared-element-transition)
|
10
|
|
-* [Reloading from terminal](https://wix.github.io/react-native-navigation/#/android-specific-use-cases?id=reloading-from-terminal)
|
|
3
|
+TOC
|
|
4
|
+* [Activity Lifecycle and onActivityResult](https://github.com/wix/react-native-navigation/wiki/Android#activity-lifecycle-and-onactivityresult)
|
|
5
|
+* [Adjusting soft input mode](https://github.com/wix/react-native-navigation/wiki/Android/#adjusting-soft-input-mode)
|
|
6
|
+* [Splash screen](https://github.com/wix/react-native-navigation/wiki/Android/#splash-screen)
|
|
7
|
+* [Collapsing React header](https://github.com/wix/react-native-navigation/wiki/Android/#collapsing-react-header---android-only)
|
|
8
|
+ * [Collapsing react view](https://github.com/wix/react-native-navigation/wiki/Android/#collapsing-react-view)
|
|
9
|
+ * [Collapsing react view with top tabs](https://github.com/wix/react-native-navigation/wiki/Android/_edit#collapsing-react-view-with-top-tabs)
|
|
10
|
+* [Reloading from terminal](https://github.com/wix/react-native-navigation/wiki/Android/#reloading-from-terminal)
|
11
|
11
|
|
12
|
12
|
# Activity Lifecycle and onActivityResult
|
13
|
13
|
In order to listen to activity lifecycle callbacks, set `ActivityCallback` in `MainApplication.onCreate` as follows:
|
|
@@ -143,8 +143,6 @@ Screen transitions provide visual connections between different states through m
|
143
|
143
|
|
144
|
144
|
The `<SharedElementTransition>` component determines how views that are shared between two screens transition between these screens. For example, if two screens have the same image in different positions and sizes, the `<SharedElementTransition>` will translate and scale the image smoothly between these screens.
|
145
|
145
|
|
146
|
|
->When you Shared Element Transition is used, the default cross-fading transition is activated between the entering and exiting screens. To disable the corss-fade animation set `animated: false` when pushing the second screen.
|
147
|
|
-
|
148
|
146
|
## Supported transitions
|
149
|
147
|
* Scale
|
150
|
148
|
* Text color
|
|
@@ -194,7 +192,81 @@ this.props.navigator.push({
|
194
|
192
|
});
|
195
|
193
|
```
|
196
|
194
|
## Animating image bounds and scale
|
197
|
|
-By default, when animating images, a basic scale transition is used. This is good enough for basic use cases where both images have the same aspect ratio. If the images have different size and scale, you can animate their bounds and scale by setting `animateClipBounds={true}` on the final `<SharedElementTransition/> element.
|
|
195
|
+By default, when animating images, a basic scale transition is used. This is good enough for basic use cases where both images have the same aspect ratio. If the images have different size and scale, you can animate their bounds and scale by setting `animateClipBounds={true}` on the final `<SharedElementTransition/>` element.
|
|
196
|
+
|
|
197
|
+## Curved motion
|
|
198
|
+The `path` interpolator transitions elements along a curved path based on Bézier curves. This interpolator specifies a motion curve in a 1x1 square, with anchor points at (0,0) and (1,1) and control points specified using the `showInterpolation` and `hideInterpolation` props.
|
|
199
|
+
|
|
200
|
+### Using curved motion
|
|
201
|
+First, wrap the view you would like to transition in a `<SharedElementTransition/>` and give it a unique id. In this example we are going to transition an `<Image/>'.
|
|
202
|
+
|
|
203
|
+```js
|
|
204
|
+<SharedElementTransition sharedElementId={'sharedImageId'}>
|
|
205
|
+ <Image
|
|
206
|
+ style={{height: 50, width: 50}}
|
|
207
|
+ source={this.props.image}/>
|
|
208
|
+</SharedElementTransition>
|
|
209
|
+```
|
|
210
|
+
|
|
211
|
+<br>In the `<SharedElementTransition/>` wrapping the Image in the second screen, define control points in `showInterpolation` and `hideInterpolation` props:
|
|
212
|
+
|
|
213
|
+```js
|
|
214
|
+<SharedElementTransition
|
|
215
|
+ sharedElementId={'sharedImageId'}
|
|
216
|
+ showDuration={600}
|
|
217
|
+ hideDuration={400}
|
|
218
|
+ showInterpolation={
|
|
219
|
+ {
|
|
220
|
+ type: 'path',
|
|
221
|
+ controlX1: '0.5',
|
|
222
|
+ controlY1: '1',
|
|
223
|
+ controlX2: '0',
|
|
224
|
+ controlY2: '0.5',
|
|
225
|
+ easing: 'FastOutSlowIn'
|
|
226
|
+ }
|
|
227
|
+ }
|
|
228
|
+ hideInterpolation={
|
|
229
|
+ {
|
|
230
|
+ type: 'path',
|
|
231
|
+ controlX1: '0.5',
|
|
232
|
+ controlY1: '0',
|
|
233
|
+ controlX2: '1',
|
|
234
|
+ controlY2: '0.5',
|
|
235
|
+ easing:'FastOutSlowIn'
|
|
236
|
+ }
|
|
237
|
+ }
|
|
238
|
+>
|
|
239
|
+ <Image
|
|
240
|
+ style={{height: 100, width: 100}}
|
|
241
|
+ source={this.props.image}
|
|
242
|
+ fadeDuration={0} // Disable react-native's default 300 ms fade-in animation
|
|
243
|
+ />
|
|
244
|
+</SharedElementTransition>
|
|
245
|
+```
|
|
246
|
+
|
|
247
|
+<br>As in the previous example, specify the elements you'd like to transition when pushing the second screen:
|
|
248
|
+
|
|
249
|
+```js
|
|
250
|
+this.props.navigator.push({
|
|
251
|
+ screen: 'SharedElementScreen',
|
|
252
|
+ sharedElements: ['sharedImageId']
|
|
253
|
+ }
|
|
254
|
+});
|
|
255
|
+```
|
|
256
|
+
|
|
257
|
+## Easing
|
|
258
|
+specify the rate of change of a parameter over time
|
|
259
|
+
|
|
260
|
+* `accelerateDecelerate` - the rate of change starts and ends slowly but accelerates through the middle.
|
|
261
|
+* `accelerate` - the rate of change starts out slowly and and then accelerates.
|
|
262
|
+* `decelerate` - the rate of change starts out quickly and and then decelerates.
|
|
263
|
+* `fastOutSlowIn` - the rate of change starts fast but decelerates slowly.
|
|
264
|
+* `linear` - the rate of change is constant (default)
|
|
265
|
+
|
|
266
|
+## Screen animation
|
|
267
|
+When Shared Element Transition is used, a cross-fade transition is used between the entering and exiting screens. Make sure the root `View` has a background color in order for the cross-fade animation to be visible.
|
|
268
|
+
|
|
269
|
+To disable the corss-fade animation, set `animated: false` when pushing the second screen. Disabling this animation is useful if you'd like to animate the reset of the elements on screen your self.
|
198
|
270
|
|
199
|
271
|
# Reloading from terminal
|
200
|
|
-You can easily reload your app from terminal using `adb shell am broadcast -a react.native.RELOAD`. This is particularly useful when debugging on device.
|
|
272
|
+You can easily reload your app from terminal using `adb shell am broadcast -a react.native.RELOAD`. This is particularly useful when debugging on device.
|