瀏覽代碼

Documented shared element

yogevbd 6 年之前
父節點
當前提交
ba0a6bb907
共有 2 個檔案被更改,包括 36 行新增0 行删除
  1. 1
    0
      docs/_sidebar.md
  2. 35
    0
      docs/docs/animations.md

+ 1
- 0
docs/_sidebar.md 查看文件

@@ -10,6 +10,7 @@
10 10
   - [Layout Types](/docs/layout-types)
11 11
   - [Styling](/docs/styling)
12 12
   - [TopBar Buttons](/docs/topBar-buttons) 
13
+  - [Animations](/docs/animations)
13 14
 - Migration from v1
14 15
   - [Top Level](/docs/top-level-api-migration)
15 16
 - [API](/api/README)

+ 35
- 0
docs/docs/animations.md 查看文件

@@ -0,0 +1,35 @@
1
+# Animations
2
+
3
+
4
+## Shared element
5
+In order to animate shared element between two screens you need to wrap your element with `Navigation.Element` in both screens with different `elementId`.
6
+For example, to animate `Image` element wrap it in your first screen like this:
7
+```jsx
8
+<Navigation.Element elementId='image1'>
9
+  <Image source={require('img/icon.png')} />
10
+</Navigation.Element>
11
+```
12
+
13
+And in your second screen:
14
+```jsx
15
+<Navigation.Element elementId='image2'>
16
+  <Image source={require('img/icon.png')} />
17
+</Navigation.Element>
18
+```
19
+
20
+Then call `push` or `showModal` with `customTransition.animations` options:
21
+```js
22
+Navigation.push(this.props.componentId, {
23
+  component: {
24
+    name: 'second.screen',
25
+    options: {
26
+      customTransition: {
27
+        animations: [
28
+          { type: 'sharedElement', fromId: 'image1', toId: 'image2', startDelay: 0, springVelocity: 0.2, duration: 0.5 }
29
+        ],
30
+        duration: 0.8
31
+      }
32
+    }
33
+  }
34
+});
35
+```