瀏覽代碼

Reformat code (#1401)

Guy Carmeli 7 年之前
父節點
當前提交
0de47791fe
共有 25 個檔案被更改,包括 1141 行新增1141 行删除
  1. 43
    43
      example/src/app.js
  2. 30
    30
      example/src/components/Row.js
  3. 145
    145
      example/src/screens/Actions.js
  4. 1
    2
      example/src/screens/CustomNavBar.js
  5. 2
    1
      example/src/screens/CustomNavBarScreen.js
  6. 24
    24
      example/src/screens/Transitions.js
  7. 81
    81
      example/src/screens/Types.js
  8. 21
    21
      example/src/screens/index.js
  9. 24
    24
      example/src/screens/transitions/CollapsingHeader.js
  10. 32
    32
      example/src/screens/transitions/SharedElementTransitions.js
  11. 90
    90
      example/src/screens/transitions/sharedElementTransitions/Cards/Cards.js
  12. 102
    102
      example/src/screens/transitions/sharedElementTransitions/Cards/Info.js
  13. 40
    40
      example/src/screens/transitions/sharedElementTransitions/Masonry/Item.js
  14. 79
    79
      example/src/screens/transitions/sharedElementTransitions/Masonry/Masonry.js
  15. 92
    92
      example/src/screens/transitions/sharedElementTransitions/Masonry/images.js
  16. 182
    182
      example/src/screens/transitions/sharedElementTransitions/Profiles/Profiles.js
  17. 30
    30
      example/src/screens/transitions/sharedElementTransitions/Profiles/data.js
  18. 14
    14
      example/src/screens/types/Drawer.js
  19. 31
    31
      example/src/screens/types/LightBox.js
  20. 14
    14
      example/src/screens/types/Modal.js
  21. 23
    23
      example/src/screens/types/Notification.js
  22. 14
    14
      example/src/screens/types/Push.js
  23. 11
    11
      example/src/screens/types/TopTabs.js
  24. 8
    8
      example/src/screens/types/tabs/TabOne.js
  25. 8
    8
      example/src/screens/types/tabs/TabTwo.js

+ 43
- 43
example/src/app.js 查看文件

@@ -1,59 +1,59 @@
1
-import { Platform } from 'react-native';
2
-import { Navigation } from 'react-native-navigation';
1
+import {Platform} from 'react-native';
2
+import {Navigation} from 'react-native-navigation';
3 3
 import registerScreens from './screens';
4 4
 
5 5
 // screen related book keeping
6 6
 registerScreens();
7 7
 
8 8
 const tabs = [{
9
-    label: 'Navigation',
10
-    screen: 'example.Types',
11
-    icon: require('../img/list.png'),
12
-    title: 'Navigation Types',
9
+  label: 'Navigation',
10
+  screen: 'example.Types',
11
+  icon: require('../img/list.png'),
12
+  title: 'Navigation Types',
13 13
 }, {
14
-    label: 'Actions',
15
-    screen: 'example.Actions',
16
-    icon: require('../img/swap.png'),
17
-    title: 'Navigation Actions',
14
+  label: 'Actions',
15
+  screen: 'example.Actions',
16
+  icon: require('../img/swap.png'),
17
+  title: 'Navigation Actions',
18 18
 }];
19 19
 
20 20
 if (Platform.OS === 'android') {
21
-    tabs.push({
22
-        label: 'Transitions',
23
-        screen: 'example.Transitions',
24
-        icon: require('../img/transform.png'),
25
-        title: 'Navigation Transitions',
26
-    });
21
+  tabs.push({
22
+    label: 'Transitions',
23
+    screen: 'example.Transitions',
24
+    icon: require('../img/transform.png'),
25
+    title: 'Navigation Transitions',
26
+  });
27 27
 }
28 28
 
29 29
 // this will start our app
30 30
 Navigation.startTabBasedApp({
31
-    tabs,
32
-    tabsStyle: {
33
-        tabBarBackgroundColor: '#003a66',
34
-        navBarButtonColor: '#ffffff',
35
-        tabBarButtonColor: '#ffffff',
36
-        navBarTextColor: '#ffffff',
37
-        tabBarSelectedButtonColor: '#ff505c',
38
-        navigationBarColor: '#003a66',
39
-        navBarBackgroundColor: '#003a66',
40
-        statusBarColor: '#002b4c',
41
-        tabFontFamily: 'BioRhyme-Bold',
42
-    },
43
-    appStyle: {
44
-        tabBarBackgroundColor: '#003a66',
45
-        navBarButtonColor: '#ffffff',
46
-        tabBarButtonColor: '#ffffff',
47
-        navBarTextColor: '#ffffff',
48
-        tabBarSelectedButtonColor: '#ff505c',
49
-        navigationBarColor: '#003a66',
50
-        navBarBackgroundColor: '#003a66',
51
-        statusBarColor: '#002b4c',
52
-        tabFontFamily: 'BioRhyme-Bold',
53
-    },
54
-    drawer: {
55
-        left: {
56
-            screen: 'example.Types.Drawer'
57
-        }
31
+  tabs,
32
+  tabsStyle: {
33
+    tabBarBackgroundColor: '#003a66',
34
+    navBarButtonColor: '#ffffff',
35
+    tabBarButtonColor: '#ffffff',
36
+    navBarTextColor: '#ffffff',
37
+    tabBarSelectedButtonColor: '#ff505c',
38
+    navigationBarColor: '#003a66',
39
+    navBarBackgroundColor: '#003a66',
40
+    statusBarColor: '#002b4c',
41
+    tabFontFamily: 'BioRhyme-Bold',
42
+  },
43
+  appStyle: {
44
+    tabBarBackgroundColor: '#003a66',
45
+    navBarButtonColor: '#ffffff',
46
+    tabBarButtonColor: '#ffffff',
47
+    navBarTextColor: '#ffffff',
48
+    tabBarSelectedButtonColor: '#ff505c',
49
+    navigationBarColor: '#003a66',
50
+    navBarBackgroundColor: '#003a66',
51
+    statusBarColor: '#002b4c',
52
+    tabFontFamily: 'BioRhyme-Bold',
53
+  },
54
+  drawer: {
55
+    left: {
56
+      screen: 'example.Types.Drawer'
58 57
     }
58
+  }
59 59
 });

+ 30
- 30
example/src/components/Row.js 查看文件

@@ -1,43 +1,43 @@
1 1
 import React from 'react';
2 2
 import PropTypes from 'prop-types';
3
-import { StyleSheet, View, Text, TouchableHighlight, Platform } from 'react-native';
3
+import {StyleSheet, View, Text, TouchableHighlight, Platform} from 'react-native';
4 4
 
5
-function Row({ title, onPress, platform, testID }) {
6
-    if (platform && platform !== Platform.OS) {
7
-        return <View />;
8
-    }
5
+function Row({title, onPress, platform, testID}) {
6
+  if (platform && platform !== Platform.OS) {
7
+    return <View />;
8
+  }
9 9
 
10
-    return (
11
-        <TouchableHighlight
12
-            onPress={onPress}
13
-            testID={testID}
14
-            underlayColor={'rgba(0, 0, 0, 0.054)'}
15
-        >
16
-            <View style={styles.row}>
17
-                <Text style={styles.text}>{title}</Text>
18
-            </View>
19
-        </TouchableHighlight>
20
-    );
10
+  return (
11
+    <TouchableHighlight
12
+      onPress={onPress}
13
+      testID={testID}
14
+      underlayColor={'rgba(0, 0, 0, 0.054)'}
15
+    >
16
+      <View style={styles.row}>
17
+        <Text style={styles.text}>{title}</Text>
18
+      </View>
19
+    </TouchableHighlight>
20
+  );
21 21
 }
22 22
 
23 23
 Row.propTypes = {
24
-    title: PropTypes.string.isRequired,
25
-    onPress: PropTypes.func.isRequired,
24
+  title: PropTypes.string.isRequired,
25
+  onPress: PropTypes.func.isRequired,
26 26
 };
27 27
 
28 28
 const styles = StyleSheet.create({
29
-    row: {
30
-        height: 48,
31
-        paddingHorizontal: 16,
32
-        flexDirection: 'row',
33
-        alignItems: 'center',
34
-        justifyContent: 'center',
35
-        borderBottomWidth: 1,
36
-        borderBottomColor: 'rgba(0, 0, 0, 0.054)',
37
-    },
38
-    text: {
39
-        fontSize: 16,
40
-    },
29
+  row: {
30
+    height: 48,
31
+    paddingHorizontal: 16,
32
+    flexDirection: 'row',
33
+    alignItems: 'center',
34
+    justifyContent: 'center',
35
+    borderBottomWidth: 1,
36
+    borderBottomColor: 'rgba(0, 0, 0, 0.054)',
37
+  },
38
+  text: {
39
+    fontSize: 16,
40
+  },
41 41
 });
42 42
 
43 43
 export default Row;

+ 145
- 145
example/src/screens/Actions.js 查看文件

@@ -4,159 +4,159 @@ import Row from '../components/Row';
4 4
 
5 5
 class Actions extends React.Component {
6 6
 
7
-    constructor(props) {
8
-        super(props);
9
-
10
-        this._fab = false;
11
-        this._rightButton = null;
12
-        this._contextualMenu = false;
13
-        this._toggleTabs = 'shown';
14
-        this._toggleNavBar = 'shown';
15
-        this.props.navigator.setOnNavigatorEvent(this.onNavigatorEvent.bind(this));
7
+  constructor(props) {
8
+    super(props);
9
+
10
+    this._fab = false;
11
+    this._rightButton = null;
12
+    this._contextualMenu = false;
13
+    this._toggleTabs = 'shown';
14
+    this._toggleNavBar = 'shown';
15
+    this.props.navigator.setOnNavigatorEvent(this.onNavigatorEvent.bind(this));
16
+  }
17
+
18
+  onNavigatorEvent(event) {
19
+    if (event.id === 'contextualMenuDismissed') {
20
+      this._contextualMenu = false;
16 21
     }
22
+  }
23
+
24
+  setTitle = () => {
25
+    this.props.navigator.setTitle({
26
+      title: 'New Title!',
27
+    });
28
+  };
29
+
30
+  toggleTabs = () => {
31
+    const to = this._toggleTabs === 'shown' ? 'hidden' : 'shown';
32
+
33
+    this.props.navigator.toggleTabs({
34
+      to,
35
+      animated: true,
36
+    });
37
+    this._toggleTabs = to;
38
+  };
39
+
40
+  setTabBadge = () => {
41
+    this.props.navigator.setTabBadge({
42
+      tabIndex: 1,
43
+      badge: Math.floor(Math.random() * 20) + 1,
44
+    });
45
+  };
46
+
47
+  switchToTab = () => {
48
+    this.props.navigator.switchToTab({
49
+      tabIndex: 0,
50
+    });
51
+  };
52
+
53
+  toggleNavBar = () => {
54
+    const to = this._toggleNavBar === 'shown' ? 'hidden' : 'shown';
55
+
56
+    this.props.navigator.toggleNavBar({
57
+      to,
58
+      animated: true,
59
+    });
60
+    this._toggleNavBar = to;
61
+  };
62
+
63
+  showSnackbar = () => {
64
+    this.props.navigator.showSnackbar({
65
+      title: 'Woo Snacks!',
66
+    });
67
+  };
68
+
69
+  toggleContextualMenu = () => {
70
+    if (!this._contextualMenu) {
71
+      this.props.navigator.showContextualMenu({
72
+        rightButtons: [{
73
+          title: 'Edit',
74
+          icon: require('../../img/edit.png'),
75
+        }, {
76
+          title: 'Delete',
77
+          icon: require('../../img/delete.png'),
78
+        }],
79
+        onButtonPressed: (index) => console.log(`Button ${index} tapped`)
80
+      });
81
+      this._contextualMenu = true;
82
+    } else {
83
+      this.props.navigator.dismissContextualMenu();
84
+      this._contextualMenu = false;
85
+    }
86
+
87
+  };
88
+
89
+  setButtons = () => {
90
+    let title = '';
17 91
 
18
-    onNavigatorEvent(event) {
19
-        if (event.id === 'contextualMenuDismissed') {
20
-            this._contextualMenu = false;
21
-        }
92
+    if (!this._rightButton) {
93
+      title = 'Hello';
94
+    } else if (this._rightButton === 'Hello') {
95
+      title = 'Its Me';
22 96
     }
23 97
 
24
-    setTitle = () => {
25
-        this.props.navigator.setTitle({
26
-            title: 'New Title!',
27
-        });
28
-    };
29
-
30
-    toggleTabs = () => {
31
-        const to = this._toggleTabs === 'shown' ? 'hidden' : 'shown';
32
-
33
-        this.props.navigator.toggleTabs({
34
-            to,
35
-            animated: true,
36
-        });
37
-        this._toggleTabs = to;
38
-    };
39
-
40
-    setTabBadge = () => {
41
-        this.props.navigator.setTabBadge({
42
-            tabIndex: 1,
43
-            badge: Math.floor(Math.random() * 20) + 1,
44
-        });
45
-    };
46
-
47
-    switchToTab = () => {
48
-        this.props.navigator.switchToTab({
49
-            tabIndex: 0,
50
-        });
51
-    };
52
-
53
-    toggleNavBar = () => {
54
-        const to = this._toggleNavBar === 'shown' ? 'hidden' : 'shown';
55
-
56
-        this.props.navigator.toggleNavBar({
57
-            to,
58
-            animated: true,
59
-        });
60
-        this._toggleNavBar = to;
61
-    };
62
-
63
-    showSnackbar = () => {
64
-        this.props.navigator.showSnackbar({
65
-            title: 'Woo Snacks!',
66
-        });
67
-    };
68
-
69
-    toggleContextualMenu = () => {
70
-        if (!this._contextualMenu) {
71
-            this.props.navigator.showContextualMenu({
72
-                rightButtons: [{
73
-                    title: 'Edit',
74
-                    icon: require('../../img/edit.png'),
75
-                }, {
76
-                    title: 'Delete',
77
-                    icon: require('../../img/delete.png'),
78
-                }],
79
-                onButtonPressed: (index) => console.log(`Button ${index} tapped`)
80
-            });
81
-            this._contextualMenu = true;
82
-        } else {
83
-            this.props.navigator.dismissContextualMenu();
84
-            this._contextualMenu = false;
85
-        }
86
-
87
-    };
88
-
89
-    setButtons = () => {
90
-        let title = '';
91
-
92
-        if (!this._rightButton) {
93
-            title = 'Hello';
94
-        } else if (this._rightButton === 'Hello') {
95
-            title = 'Its Me';
96
-        }
97
-
98
-        this.props.navigator.setButtons({
99
-            rightButtons: [{
100
-                title,
101
-                id: 'topRight',
102
-            }],
103
-            animated: true,
104
-        });
105
-        this._rightButton = title;
106
-    };
107
-
108
-    toggleFAB = () => {
109
-        if (this._fab) {
110
-            this.props.navigator.setButtons({
111
-                fab: {},
112
-            });
113
-            this._fab = false;
114
-        } else {
115
-            this.props.navigator.setButtons({
116
-                fab: {
117
-                    collapsedId: 'share',
118
-                    collapsedIcon: require('../../img/edit@1x.png'),
119
-                    expendedId: 'clear',
120
-                    expendedIcon: require('../../img/edit@1x.png'),
121
-                    backgroundColor: '#ff505c',
122
-                    actions: [
123
-                        {
124
-                            id: 'mail',
125
-                            icon: require('../../img/edit@1x.png'),
126
-                            backgroundColor: '#03A9F4'
127
-                        },
128
-                        {
129
-                            id: 'delete',
130
-                            icon: require('../../img/delete@1x.png'),
131
-                            backgroundColor: '#4CAF50'
132
-                        }
133
-                    ]
134
-                },
135
-                animated: true,
136
-            });
137
-            this._fab = true;
138
-        }
139
-    };
140
-
141
-    render() {
142
-        return (
143
-            <ScrollView style={styles.container}>
144
-                <Row title={'Set Title'} onPress={this.setTitle}/>
145
-                <Row title={'Toggle Tabs'} onPress={this.toggleTabs}/>
146
-                <Row title={'Set Tab Badge'} onPress={this.setTabBadge}/>
147
-                <Row title={'Switch To Tab 0'} onPress={this.switchToTab}/>
148
-                <Row title={'Toggle Nav Bar'} onPress={this.toggleNavBar}/>
149
-                <Row title={'Show Snackbar'} onPress={this.showSnackbar} platform={'android'}/>
150
-                <Row title={'Toggle Contextual Menu'} onPress={this.toggleContextualMenu} platform={'android'}/>
151
-                <Row title={'Set Right Buttons'} onPress={this.setButtons}/>
152
-                <Row title={'Toggle FAB'} onPress={this.toggleFAB} platform={'android'}/>
153
-            </ScrollView>
154
-        );
98
+    this.props.navigator.setButtons({
99
+      rightButtons: [{
100
+        title,
101
+        id: 'topRight',
102
+      }],
103
+      animated: true,
104
+    });
105
+    this._rightButton = title;
106
+  };
107
+
108
+  toggleFAB = () => {
109
+    if (this._fab) {
110
+      this.props.navigator.setButtons({
111
+        fab: {},
112
+      });
113
+      this._fab = false;
114
+    } else {
115
+      this.props.navigator.setButtons({
116
+        fab: {
117
+          collapsedId: 'share',
118
+          collapsedIcon: require('../../img/edit@1x.png'),
119
+          expendedId: 'clear',
120
+          expendedIcon: require('../../img/edit@1x.png'),
121
+          backgroundColor: '#ff505c',
122
+          actions: [
123
+            {
124
+              id: 'mail',
125
+              icon: require('../../img/edit@1x.png'),
126
+              backgroundColor: '#03A9F4'
127
+            },
128
+            {
129
+              id: 'delete',
130
+              icon: require('../../img/delete@1x.png'),
131
+              backgroundColor: '#4CAF50'
132
+            }
133
+          ]
134
+        },
135
+        animated: true,
136
+      });
137
+      this._fab = true;
155 138
     }
139
+  };
140
+
141
+  render() {
142
+    return (
143
+      <ScrollView style={styles.container}>
144
+        <Row title={'Set Title'} onPress={this.setTitle}/>
145
+        <Row title={'Toggle Tabs'} onPress={this.toggleTabs}/>
146
+        <Row title={'Set Tab Badge'} onPress={this.setTabBadge}/>
147
+        <Row title={'Switch To Tab 0'} onPress={this.switchToTab}/>
148
+        <Row title={'Toggle Nav Bar'} onPress={this.toggleNavBar}/>
149
+        <Row title={'Show Snackbar'} onPress={this.showSnackbar} platform={'android'}/>
150
+        <Row title={'Toggle Contextual Menu'} onPress={this.toggleContextualMenu} platform={'android'}/>
151
+        <Row title={'Set Right Buttons'} onPress={this.setButtons}/>
152
+        <Row title={'Toggle FAB'} onPress={this.toggleFAB} platform={'android'}/>
153
+      </ScrollView>
154
+    );
155
+  }
156 156
 }
157 157
 
158 158
 const styles = StyleSheet.create({
159
-    container: {},
159
+  container: {},
160 160
 });
161 161
 
162 162
 export default Actions;

+ 1
- 2
example/src/screens/CustomNavBar.js 查看文件

@@ -12,8 +12,7 @@ export default class CustomNavBar extends Component {
12 12
 
13 13
   constructor(props) {
14 14
     super(props);
15
-    this.state = {
16
-    };
15
+    this.state = {};
17 16
   }
18 17
 
19 18
   render() {

+ 2
- 1
example/src/screens/CustomNavBarScreen.js 查看文件

@@ -19,6 +19,7 @@ export default class CustomNavBarScreen extends Component {
19 19
   constructor(props) {
20 20
     super(props);
21 21
   }
22
+
22 23
   render() {
23 24
     return (
24 25
       <View style={styles.container}>
@@ -38,7 +39,7 @@ const styles = StyleSheet.create({
38 39
     textAlign: 'center',
39 40
     fontSize: 18,
40 41
     marginBottom: 10,
41
-    marginTop:10,
42
+    marginTop: 10,
42 43
     color: 'blue'
43 44
   }
44 45
 });

+ 24
- 24
example/src/screens/Transitions.js 查看文件

@@ -1,37 +1,37 @@
1 1
 import React from 'react';
2
-import { StyleSheet, ScrollView, Text } from 'react-native';
2
+import {StyleSheet, ScrollView, Text} from 'react-native';
3 3
 import Row from '../components/Row';
4 4
 
5 5
 class Transitions extends React.Component {
6 6
 
7
-    showCollapsingHeader = () => {
8
-      this.props.navigator.showModal({
9
-          title: 'Collapsing Header',
10
-          screen: 'example.Transitions.CollapsingHeader',
11
-      });
12
-    };
7
+  showCollapsingHeader = () => {
8
+    this.props.navigator.showModal({
9
+      title: 'Collapsing Header',
10
+      screen: 'example.Transitions.CollapsingHeader',
11
+    });
12
+  };
13 13
 
14
-    showSharedElementTransitions = () => {
15
-        this.props.navigator.showModal({
16
-            title: 'Shared Element Transition Examples',
17
-            screen: 'example.Transitions.SharedElementTransitions',
18
-        });
19
-    };
14
+  showSharedElementTransitions = () => {
15
+    this.props.navigator.showModal({
16
+      title: 'Shared Element Transition Examples',
17
+      screen: 'example.Transitions.SharedElementTransitions',
18
+    });
19
+  };
20 20
 
21
-    render() {
22
-        return (
23
-            <ScrollView style={styles.container}>
24
-                <Row title={'Collapsing Header'} onPress={this.showCollapsingHeader} />
25
-                <Row title={'Shared Element Transition'} onPress={this.showSharedElementTransitions} />
26
-            </ScrollView>
27
-        );
28
-    }
21
+  render() {
22
+    return (
23
+      <ScrollView style={styles.container}>
24
+        <Row title={'Collapsing Header'} onPress={this.showCollapsingHeader}/>
25
+        <Row title={'Shared Element Transition'} onPress={this.showSharedElementTransitions}/>
26
+      </ScrollView>
27
+    );
28
+  }
29 29
 }
30 30
 
31 31
 const styles = StyleSheet.create({
32
-    container: {
33
-        flex: 1,
34
-    },
32
+  container: {
33
+    flex: 1,
34
+  },
35 35
 });
36 36
 
37 37
 export default Transitions;

+ 81
- 81
example/src/screens/Types.js 查看文件

@@ -1,99 +1,99 @@
1 1
 import React from 'react';
2
-import { StyleSheet, View, Text, ScrollView, TouchableHighlight } from 'react-native';
2
+import {StyleSheet, View, Text, ScrollView, TouchableHighlight} from 'react-native';
3 3
 import Row from '../components/Row';
4 4
 
5 5
 class Types extends React.Component {
6 6
 
7
-    toggleDrawer = () => {
8
-        this.props.navigator.toggleDrawer({
9
-            side: 'left',
10
-            animated: true
11
-        });
12
-    };
7
+  toggleDrawer = () => {
8
+    this.props.navigator.toggleDrawer({
9
+      side: 'left',
10
+      animated: true
11
+    });
12
+  };
13 13
 
14
-    pushScreen = () => {
15
-        this.props.navigator.push({
16
-            screen: 'example.Types.Push',
17
-            title: 'New Screen',
18
-        });
19
-    };
14
+  pushScreen = () => {
15
+    this.props.navigator.push({
16
+      screen: 'example.Types.Push',
17
+      title: 'New Screen',
18
+    });
19
+  };
20 20
 
21
-    pushTopTabsScreen = () => {
22
-        this.props.navigator.push({
23
-            screen: 'example.Types.TopTabs',
24
-            title: 'Top Tabs',
25
-            topTabs: [{
26
-                screenId: 'example.Types.TopTabs.TabOne',
27
-                title: 'Tab One',
28
-            }, {
29
-                screenId: 'example.Types.TopTabs.TabTwo',
30
-                title: 'Tab Two',
31
-            }],
32
-        });
33
-    };
21
+  pushTopTabsScreen = () => {
22
+    this.props.navigator.push({
23
+      screen: 'example.Types.TopTabs',
24
+      title: 'Top Tabs',
25
+      topTabs: [{
26
+        screenId: 'example.Types.TopTabs.TabOne',
27
+        title: 'Tab One',
28
+      }, {
29
+        screenId: 'example.Types.TopTabs.TabTwo',
30
+        title: 'Tab Two',
31
+      }],
32
+    });
33
+  };
34 34
 
35
-    showModal = () => {
36
-        this.props.navigator.showModal({
37
-            screen: 'example.Types.Modal',
38
-            title: 'Modal',
39
-        });
40
-    };
35
+  showModal = () => {
36
+    this.props.navigator.showModal({
37
+      screen: 'example.Types.Modal',
38
+      title: 'Modal',
39
+    });
40
+  };
41 41
 
42
-    showLightBox = () => {
43
-        this.props.navigator.showLightBox({
44
-            screen: "example.Types.LightBox",
45
-            passProps: {
46
-                title: 'LightBox',
47
-                content: 'Hey there, I\'m a light box screen :D',
48
-                onClose: this.dismissLightBox,
49
-            },
50
-            style: {
51
-                backgroundBlur: 'dark',
52
-                backgroundColor: 'rgba(0, 0, 0, 0.7)',
53
-            }
54
-        });
55
-    };
42
+  showLightBox = () => {
43
+    this.props.navigator.showLightBox({
44
+      screen: "example.Types.LightBox",
45
+      passProps: {
46
+        title: 'LightBox',
47
+        content: 'Hey there, I\'m a light box screen :D',
48
+        onClose: this.dismissLightBox,
49
+      },
50
+      style: {
51
+        backgroundBlur: 'dark',
52
+        backgroundColor: 'rgba(0, 0, 0, 0.7)',
53
+      }
54
+    });
55
+  };
56 56
 
57
-    dismissLightBox = () => {
58
-        this.props.navigator.dismissLightBox();
59
-    };
57
+  dismissLightBox = () => {
58
+    this.props.navigator.dismissLightBox();
59
+  };
60 60
 
61
-    showInAppNotification = () => {
62
-        this.props.navigator.showInAppNotification({
63
-            screen: 'example.Types.Notification',
64
-        });
65
-    };
61
+  showInAppNotification = () => {
62
+    this.props.navigator.showInAppNotification({
63
+      screen: 'example.Types.Notification',
64
+    });
65
+  };
66 66
 
67
-    render() {
68
-        return (
69
-            <ScrollView style={styles.container}>
70
-                <Row title={'Toggle Drawer'} onPress={this.toggleDrawer} />
71
-                <Row title={'Push Screen'} testID={'pushScreen'} onPress={this.pushScreen} />
72
-                <Row title={'Top Tabs Screen'} onPress={this.pushTopTabsScreen} platform={'android'} />
73
-                <Row title={'Show Modal'} onPress={this.showModal} />
74
-                <Row title={'Show Lightbox'} onPress={this.showLightBox} />
75
-                <Row title={'Show In-App Notification'} onPress={this.showInAppNotification} />
76
-            </ScrollView>
77
-        );
78
-    }
67
+  render() {
68
+    return (
69
+      <ScrollView style={styles.container}>
70
+        <Row title={'Toggle Drawer'} onPress={this.toggleDrawer}/>
71
+        <Row title={'Push Screen'} testID={'pushScreen'} onPress={this.pushScreen}/>
72
+        <Row title={'Top Tabs Screen'} onPress={this.pushTopTabsScreen} platform={'android'}/>
73
+        <Row title={'Show Modal'} onPress={this.showModal}/>
74
+        <Row title={'Show Lightbox'} onPress={this.showLightBox}/>
75
+        <Row title={'Show In-App Notification'} onPress={this.showInAppNotification}/>
76
+      </ScrollView>
77
+    );
78
+  }
79 79
 }
80 80
 
81 81
 const styles = StyleSheet.create({
82
-    container: {
83
-        flex: 1,
84
-    },
85
-    row: {
86
-        height: 48,
87
-        paddingHorizontal: 16,
88
-        flexDirection: 'row',
89
-        alignItems: 'center',
90
-        justifyContent: 'center',
91
-        borderBottomWidth: 1,
92
-        borderBottomColor: 'rgba(0, 0, 0, 0.054)',
93
-    },
94
-    text: {
95
-        fontSize: 16,
96
-    },
82
+  container: {
83
+    flex: 1,
84
+  },
85
+  row: {
86
+    height: 48,
87
+    paddingHorizontal: 16,
88
+    flexDirection: 'row',
89
+    alignItems: 'center',
90
+    justifyContent: 'center',
91
+    borderBottomWidth: 1,
92
+    borderBottomColor: 'rgba(0, 0, 0, 0.054)',
93
+  },
94
+  text: {
95
+    fontSize: 16,
96
+  },
97 97
 });
98 98
 
99 99
 export default Types;

+ 21
- 21
example/src/screens/index.js 查看文件

@@ -1,4 +1,4 @@
1
-import { Navigation } from 'react-native-navigation';
1
+import {Navigation} from 'react-native-navigation';
2 2
 
3 3
 import Types from './Types';
4 4
 import Actions from './Actions';
@@ -23,24 +23,24 @@ import Masonry from './transitions/sharedElementTransitions/Masonry/Masonry';
23 23
 import MasonryItem from './transitions/sharedElementTransitions/Masonry/Item';
24 24
 
25 25
 export default function () {
26
-    Navigation.registerComponent('example.Types', () => Types);
27
-    Navigation.registerComponent('example.Actions', () => Actions);
28
-    Navigation.registerComponent('example.Transitions', () => Transitions);
29
-
30
-    Navigation.registerComponent('example.Types.Push', () => Push);
31
-    Navigation.registerComponent('example.Types.Drawer', () => Drawer);
32
-    Navigation.registerComponent('example.Types.Screen', () => Drawer);
33
-    Navigation.registerComponent('example.Types.Modal', () => Modal);
34
-    Navigation.registerComponent('example.Types.LightBox', () => LightBox);
35
-    Navigation.registerComponent('example.Types.Notification', () => Notification);
36
-    Navigation.registerComponent('example.Types.TopTabs', () => TopTabs);
37
-    Navigation.registerComponent('example.Types.TopTabs.TabOne', () => TabOne);
38
-    Navigation.registerComponent('example.Types.TopTabs.TabTwo', () => TabTwo);
39
-
40
-    Navigation.registerComponent('example.Transitions.CollapsingHeader', () => CollapsingHeader);
41
-    Navigation.registerComponent('example.Transitions.SharedElementTransitions', () => SharedElementTransitions);
42
-    Navigation.registerComponent('example.Transitions.SharedElementTransitions.Cards', () => Cards);
43
-    Navigation.registerComponent('example.Transitions.SharedElementTransitions.Cards.Info', () => CardsInfo);
44
-    Navigation.registerComponent('example.Transitions.SharedElementTransitions.Masonry', () => Masonry);
45
-    Navigation.registerComponent('example.Transitions.SharedElementTransitions.Masonry.Item', () => MasonryItem);
26
+  Navigation.registerComponent('example.Types', () => Types);
27
+  Navigation.registerComponent('example.Actions', () => Actions);
28
+  Navigation.registerComponent('example.Transitions', () => Transitions);
29
+
30
+  Navigation.registerComponent('example.Types.Push', () => Push);
31
+  Navigation.registerComponent('example.Types.Drawer', () => Drawer);
32
+  Navigation.registerComponent('example.Types.Screen', () => Drawer);
33
+  Navigation.registerComponent('example.Types.Modal', () => Modal);
34
+  Navigation.registerComponent('example.Types.LightBox', () => LightBox);
35
+  Navigation.registerComponent('example.Types.Notification', () => Notification);
36
+  Navigation.registerComponent('example.Types.TopTabs', () => TopTabs);
37
+  Navigation.registerComponent('example.Types.TopTabs.TabOne', () => TabOne);
38
+  Navigation.registerComponent('example.Types.TopTabs.TabTwo', () => TabTwo);
39
+
40
+  Navigation.registerComponent('example.Transitions.CollapsingHeader', () => CollapsingHeader);
41
+  Navigation.registerComponent('example.Transitions.SharedElementTransitions', () => SharedElementTransitions);
42
+  Navigation.registerComponent('example.Transitions.SharedElementTransitions.Cards', () => Cards);
43
+  Navigation.registerComponent('example.Transitions.SharedElementTransitions.Cards.Info', () => CardsInfo);
44
+  Navigation.registerComponent('example.Transitions.SharedElementTransitions.Masonry', () => Masonry);
45
+  Navigation.registerComponent('example.Transitions.SharedElementTransitions.Masonry.Item', () => MasonryItem);
46 46
 }

+ 24
- 24
example/src/screens/transitions/CollapsingHeader.js 查看文件

@@ -1,35 +1,35 @@
1 1
 import React from 'react';
2
-import { StyleSheet, View, Text, ScrollView } from 'react-native';
2
+import {StyleSheet, View, Text, ScrollView} from 'react-native';
3 3
 
4 4
 class CollapsingHeader extends React.Component {
5 5
 
6
-    static navigatorStyle = {
7
-        drawUnderTabBar: true,
8
-        navBarButtonColor: '#ffffff',
9
-        navBarTextColor: '#ffffff',
10
-        collapsingToolBarImage: require('../../../img/gyro_header.jpg'),
11
-        collapsingToolBarCollapsedColor: '#0f2362',
12
-        navBarBackgroundColor: '#eeeeee'
13
-    };
6
+  static navigatorStyle = {
7
+    drawUnderTabBar: true,
8
+    navBarButtonColor: '#ffffff',
9
+    navBarTextColor: '#ffffff',
10
+    collapsingToolBarImage: require('../../../img/gyro_header.jpg'),
11
+    collapsingToolBarCollapsedColor: '#0f2362',
12
+    navBarBackgroundColor: '#eeeeee'
13
+  };
14 14
 
15
-    render() {
16
-        return (
17
-            <ScrollView style={styles.container}>
18
-                <View>
19
-                    {[...new Array(40)].map((a, index) => (
20
-                        <Text key={`row_${index}`} style={styles.button}>Row {index}</Text>
21
-                    ))}
22
-                </View>
23
-            </ScrollView>
24
-        );
25
-    }
15
+  render() {
16
+    return (
17
+      <ScrollView style={styles.container}>
18
+        <View>
19
+          {[...new Array(40)].map((a, index) => (
20
+            <Text key={`row_${index}`} style={styles.button}>Row {index}</Text>
21
+          ))}
22
+        </View>
23
+      </ScrollView>
24
+    );
25
+  }
26 26
 }
27 27
 
28 28
 const styles = StyleSheet.create({
29
-    container: {
30
-        flex: 1,
31
-        backgroundColor: '#fff',
32
-    },
29
+  container: {
30
+    flex: 1,
31
+    backgroundColor: '#fff',
32
+  },
33 33
 });
34 34
 
35 35
 export default CollapsingHeader;

+ 32
- 32
example/src/screens/transitions/SharedElementTransitions.js 查看文件

@@ -1,46 +1,46 @@
1 1
 import React from 'react';
2
-import { StyleSheet, ScrollView, Text } from 'react-native';
2
+import {StyleSheet, ScrollView, Text} from 'react-native';
3 3
 import Row from '../../components/Row';
4 4
 
5 5
 class Transitions extends React.Component {
6 6
 
7
-    showCardsExample = () => {
8
-        this.props.navigator.showModal({
9
-            title: 'Cards',
10
-            screen: 'example.Transitions.SharedElementTransitions.Cards',
11
-        });
12
-    };
7
+  showCardsExample = () => {
8
+    this.props.navigator.showModal({
9
+      title: 'Cards',
10
+      screen: 'example.Transitions.SharedElementTransitions.Cards',
11
+    });
12
+  };
13 13
 
14
-    showProfileExample = () => {
15
-        this.props.navigator.showModal({
16
-            title: 'Profiles',
17
-            screen: 'example.Transitions.SharedElementTransitions.Profiles',
18
-        });
19
-    };
14
+  showProfileExample = () => {
15
+    this.props.navigator.showModal({
16
+      title: 'Profiles',
17
+      screen: 'example.Transitions.SharedElementTransitions.Profiles',
18
+    });
19
+  };
20 20
 
21
-    showMasonryExample = () => {
22
-        this.props.navigator.showModal({
23
-            title: 'Masonry',
24
-            screen: 'example.Transitions.SharedElementTransitions.Masonry',
25
-        });
26
-    };
21
+  showMasonryExample = () => {
22
+    this.props.navigator.showModal({
23
+      title: 'Masonry',
24
+      screen: 'example.Transitions.SharedElementTransitions.Masonry',
25
+    });
26
+  };
27 27
 
28
-    render() {
29
-        return (
30
-            <ScrollView style={styles.container}>
31
-                <Row title={'Cards'} onPress={this.showCardsExample} />
32
-                {/*<Row title={'Profiles'} onPress={this.showProfileExample} />*/}
33
-                <Row title={'Masonry'} onPress={this.showMasonryExample} />
34
-            </ScrollView>
35
-        );
36
-    }
28
+  render() {
29
+    return (
30
+      <ScrollView style={styles.container}>
31
+        <Row title={'Cards'} onPress={this.showCardsExample}/>
32
+        {/*<Row title={'Profiles'} onPress={this.showProfileExample} />*/}
33
+        <Row title={'Masonry'} onPress={this.showMasonryExample}/>
34
+      </ScrollView>
35
+    );
36
+  }
37 37
 }
38 38
 
39 39
 const styles = StyleSheet.create({
40
-    container: {
41
-        flex: 1,
42
-        backgroundColor: '#ffffff',
43
-    },
40
+  container: {
41
+    flex: 1,
42
+    backgroundColor: '#ffffff',
43
+  },
44 44
 });
45 45
 
46 46
 export default Transitions;

+ 90
- 90
example/src/screens/transitions/sharedElementTransitions/Cards/Cards.js 查看文件

@@ -1,106 +1,106 @@
1 1
 import React from 'react';
2
-import { ScrollView, TouchableHighlight, StyleSheet, Image, Text, View, ScrolView } from 'react-native';
3
-import { SharedElementTransition } from 'react-native-navigation';
2
+import {ScrollView, TouchableHighlight, StyleSheet, Image, Text, View, ScrolView} from 'react-native';
3
+import {SharedElementTransition} from 'react-native-navigation';
4 4
 
5 5
 const IMAGE_HEIGHT = 190;
6 6
 
7 7
 class CardScreen extends React.Component {
8 8
 
9
-    goToCard = (index) => {
10
-        this.props.navigator.push({
11
-            screen: 'example.Transitions.SharedElementTransitions.Cards.Info',
12
-            sharedElements: [`image${index}`],
13
-            animated: false,
14
-            overrideBackPress: true,
15
-            passProps: {
16
-                sharedImageId: `image${index}`
17
-            }
18
-        })
19
-    };
9
+  goToCard = (index) => {
10
+    this.props.navigator.push({
11
+      screen: 'example.Transitions.SharedElementTransitions.Cards.Info',
12
+      sharedElements: [`image${index}`],
13
+      animated: false,
14
+      overrideBackPress: true,
15
+      passProps: {
16
+        sharedImageId: `image${index}`
17
+      }
18
+    })
19
+  };
20 20
 
21
-    _renderCard(index) {
22
-        return (
23
-            <View style={styles.cardContainer}>
24
-                <TouchableHighlight
25
-                    underlayColor={'rgba(0, 0, 0, 0.054)'}
26
-                    onPress={() => this.goToCard(index)}
27
-                >
28
-                    <View>
29
-                        {this._renderImage(index)}
30
-                        {this._renderCardContent()}
31
-                    </View>
32
-                </TouchableHighlight>
33
-            </View>
34
-        );
35
-    }
21
+  _renderCard(index) {
22
+    return (
23
+      <View style={styles.cardContainer}>
24
+        <TouchableHighlight
25
+          underlayColor={'rgba(0, 0, 0, 0.054)'}
26
+          onPress={() => this.goToCard(index)}
27
+        >
28
+          <View>
29
+            {this._renderImage(index)}
30
+            {this._renderCardContent()}
31
+          </View>
32
+        </TouchableHighlight>
33
+      </View>
34
+    );
35
+  }
36 36
 
37
-    _renderImage(index) {
38
-        return (
39
-            <SharedElementTransition
40
-                style={styles.imageContainer}
41
-                sharedElementId={`image${index}`}
42
-            >
43
-                <Image
44
-                    style={styles.image}
45
-                    source={require('../../../../../img/beach.jpg')}
46
-                />
47
-            </SharedElementTransition>
48
-        );
49
-    }
37
+  _renderImage(index) {
38
+    return (
39
+      <SharedElementTransition
40
+        style={styles.imageContainer}
41
+        sharedElementId={`image${index}`}
42
+      >
43
+        <Image
44
+          style={styles.image}
45
+          source={require('../../../../../img/beach.jpg')}
46
+        />
47
+      </SharedElementTransition>
48
+    );
49
+  }
50 50
 
51
-    _renderCardContent() {
52
-        return (
53
-            <View style={styles.cardContentContainer}>
54
-                <Text style={styles.title}>This is a title</Text>
55
-                <Text>This is a very long long long long long long long long long long content</Text>
56
-            </View>
57
-        );
58
-    }
51
+  _renderCardContent() {
52
+    return (
53
+      <View style={styles.cardContentContainer}>
54
+        <Text style={styles.title}>This is a title</Text>
55
+        <Text>This is a very long long long long long long long long long long content</Text>
56
+      </View>
57
+    );
58
+  }
59 59
 
60
-    render() {
61
-        return (
62
-            <ScrollView
63
-                style={styles.container}
64
-                contentContainerStyle={styles.content}
65
-            >
66
-                {this._renderCard(0)}
67
-                {this._renderCard(1)}
68
-                {this._renderCard(2)}
69
-            </ScrollView>
70
-        );
71
-    }
60
+  render() {
61
+    return (
62
+      <ScrollView
63
+        style={styles.container}
64
+        contentContainerStyle={styles.content}
65
+      >
66
+        {this._renderCard(0)}
67
+        {this._renderCard(1)}
68
+        {this._renderCard(2)}
69
+      </ScrollView>
70
+    );
71
+  }
72 72
 }
73 73
 
74 74
 const styles = StyleSheet.create({
75
-    container: {
76
-        flex: 1,
77
-        backgroundColor: '#ffffff',
78
-    },
79
-    content: {
80
-        marginHorizontal: 8,
81
-    },
82
-    cardContainer: {
83
-        marginVertical: 8,
84
-        elevation: 2,
85
-        borderRadius: 2,
86
-        backgroundColor: '#F5F5F5'
87
-    },
88
-    imageContainer: {
89
-        justifyContent: 'flex-start'
90
-    },
91
-    image: {
92
-        height: IMAGE_HEIGHT,
93
-        borderTopLeftRadius: 2,
94
-        borderTopRightRadius: 2
95
-    },
96
-    cardContentContainer: {
97
-        padding: 8
98
-    },
99
-    title: {
100
-        fontWeight: '500',
101
-        paddingBottom: 8,
102
-        fontSize: 17
103
-    },
75
+  container: {
76
+    flex: 1,
77
+    backgroundColor: '#ffffff',
78
+  },
79
+  content: {
80
+    marginHorizontal: 8,
81
+  },
82
+  cardContainer: {
83
+    marginVertical: 8,
84
+    elevation: 2,
85
+    borderRadius: 2,
86
+    backgroundColor: '#F5F5F5'
87
+  },
88
+  imageContainer: {
89
+    justifyContent: 'flex-start'
90
+  },
91
+  image: {
92
+    height: IMAGE_HEIGHT,
93
+    borderTopLeftRadius: 2,
94
+    borderTopRightRadius: 2
95
+  },
96
+  cardContentContainer: {
97
+    padding: 8
98
+  },
99
+  title: {
100
+    fontWeight: '500',
101
+    paddingBottom: 8,
102
+    fontSize: 17
103
+  },
104 104
 });
105 105
 
106 106
 export default CardScreen;

+ 102
- 102
example/src/screens/transitions/sharedElementTransitions/Cards/Info.js 查看文件

@@ -1,15 +1,15 @@
1
-import React, { Component } from 'react';
1
+import React, {Component} from 'react';
2 2
 import {
3
-    ScrollView,
4
-    TouchableOpacity,
5
-    StyleSheet,
6
-    Image,
7
-    Text,
8
-    View,
9
-    Platform,
10
-    ScrolView
3
+  ScrollView,
4
+  TouchableOpacity,
5
+  StyleSheet,
6
+  Image,
7
+  Text,
8
+  View,
9
+  Platform,
10
+  ScrolView
11 11
 } from 'react-native';
12
-import { SharedElementTransition } from 'react-native-navigation';
12
+import {SharedElementTransition} from 'react-native-navigation';
13 13
 import * as Animatable from 'react-native-animatable';
14 14
 
15 15
 const SHOW_DURATION = 400;
@@ -17,107 +17,107 @@ const HIDE_DURATION = 300;
17 17
 
18 18
 class InfoScreen extends Component {
19 19
 
20
-    constructor(props) {
21
-        super(props);
22
-        this.props.navigator.setOnNavigatorEvent(this.onNavigatorEvent.bind(this));
23
-        this.state = {
24
-            animationType: 'fadeInRight',
25
-            animationDuration: SHOW_DURATION
26
-        }
20
+  constructor(props) {
21
+    super(props);
22
+    this.props.navigator.setOnNavigatorEvent(this.onNavigatorEvent.bind(this));
23
+    this.state = {
24
+      animationType: 'fadeInRight',
25
+      animationDuration: SHOW_DURATION
27 26
     }
27
+  }
28 28
 
29
-    onNavigatorEvent(event) {
30
-        if (event.id === 'backPress') {
31
-            this.setState({
32
-                animationType: 'fadeOutRight',
33
-                animationDuration: HIDE_DURATION
34
-            });
35
-            this.props.navigator.pop();
36
-        }
29
+  onNavigatorEvent(event) {
30
+    if (event.id === 'backPress') {
31
+      this.setState({
32
+        animationType: 'fadeOutRight',
33
+        animationDuration: HIDE_DURATION
34
+      });
35
+      this.props.navigator.pop();
37 36
     }
37
+  }
38 38
 
39
-    render() {
40
-        return (
41
-            <View style={styles.container}>
42
-                {this._renderImage()}
43
-                {this._renderContent()}
44
-            </View>
45
-        );
46
-    }
39
+  render() {
40
+    return (
41
+      <View style={styles.container}>
42
+        {this._renderImage()}
43
+        {this._renderContent()}
44
+      </View>
45
+    );
46
+  }
47 47
 
48
-    _renderImage() {
49
-        return (
50
-            <SharedElementTransition
51
-                style={styles.imageContainer}
52
-                sharedElementId={this.props.sharedImageId}
53
-                showDuration={SHOW_DURATION}
54
-                hideDuration={HIDE_DURATION}
55
-                animateClipBounds={true}
56
-                showInterpolation={
57
-                    {
58
-                        type: 'linear',
59
-                        easing: 'FastOutSlowIn'
60
-                    }
61
-                }
62
-                hideInterpolation={
63
-                    {
64
-                        type: 'linear',
65
-                        easing: 'FastOutSlowIn'
66
-                    }
67
-                }
68
-            >
69
-                <Image
70
-                    style={styles.image}
71
-                    source={require('../../../../../img/beach.jpg')}
72
-                />
73
-            </SharedElementTransition>
74
-        );
75
-    }
48
+  _renderImage() {
49
+    return (
50
+      <SharedElementTransition
51
+        style={styles.imageContainer}
52
+        sharedElementId={this.props.sharedImageId}
53
+        showDuration={SHOW_DURATION}
54
+        hideDuration={HIDE_DURATION}
55
+        animateClipBounds={true}
56
+        showInterpolation={
57
+          {
58
+            type: 'linear',
59
+            easing: 'FastOutSlowIn'
60
+          }
61
+        }
62
+        hideInterpolation={
63
+          {
64
+            type: 'linear',
65
+            easing: 'FastOutSlowIn'
66
+          }
67
+        }
68
+      >
69
+        <Image
70
+          style={styles.image}
71
+          source={require('../../../../../img/beach.jpg')}
72
+        />
73
+      </SharedElementTransition>
74
+    );
75
+  }
76 76
 
77
-    _renderContent() {
78
-        return (
79
-            <Animatable.View
80
-                style={styles.content}
81
-                duration={this.state.animationDuration}
82
-                animation={this.state.animationType}
83
-                useNativeDriver={true}
84
-            >
85
-                <Text style={styles.text}>Line 1</Text>
86
-                <Text style={styles.text}>Line 2</Text>
87
-                <Text style={styles.text}>Line 3</Text>
88
-                <Text style={styles.text}>Line 4</Text>
89
-                <Text style={styles.text}>Line 5</Text>
90
-                <Text style={styles.text}>Line 6</Text>
91
-                <Text style={styles.text}>Line 7</Text>
92
-                <Text style={styles.text}>Line 8</Text>
93
-            </Animatable.View>
94
-        );
95
-    }
77
+  _renderContent() {
78
+    return (
79
+      <Animatable.View
80
+        style={styles.content}
81
+        duration={this.state.animationDuration}
82
+        animation={this.state.animationType}
83
+        useNativeDriver={true}
84
+      >
85
+        <Text style={styles.text}>Line 1</Text>
86
+        <Text style={styles.text}>Line 2</Text>
87
+        <Text style={styles.text}>Line 3</Text>
88
+        <Text style={styles.text}>Line 4</Text>
89
+        <Text style={styles.text}>Line 5</Text>
90
+        <Text style={styles.text}>Line 6</Text>
91
+        <Text style={styles.text}>Line 7</Text>
92
+        <Text style={styles.text}>Line 8</Text>
93
+      </Animatable.View>
94
+    );
95
+  }
96 96
 }
97 97
 
98 98
 const styles = StyleSheet.create({
99
-    container: {
100
-        flex: 1
101
-    },
102
-    content: {
103
-        flex: 1,
104
-        marginTop: 190,
105
-        backgroundColor: 'white'
106
-    },
107
-    imageContainer: {
108
-        position: 'absolute',
109
-        top: 0,
110
-        left: 0,
111
-        right: 0,
112
-    },
113
-    image: {
114
-        height: 190
115
-    },
116
-    text: {
117
-        fontSize: 17,
118
-        paddingVertical: 4,
119
-        paddingLeft: 8
120
-    }
99
+  container: {
100
+    flex: 1
101
+  },
102
+  content: {
103
+    flex: 1,
104
+    marginTop: 190,
105
+    backgroundColor: 'white'
106
+  },
107
+  imageContainer: {
108
+    position: 'absolute',
109
+    top: 0,
110
+    left: 0,
111
+    right: 0,
112
+  },
113
+  image: {
114
+    height: 190
115
+  },
116
+  text: {
117
+    fontSize: 17,
118
+    paddingVertical: 4,
119
+    paddingLeft: 8
120
+  }
121 121
 });
122 122
 
123 123
 export default InfoScreen;

+ 40
- 40
example/src/screens/transitions/sharedElementTransitions/Masonry/Item.js 查看文件

@@ -1,54 +1,54 @@
1 1
 import React from 'react';
2
-import { StyleSheet, View, Text, Image } from 'react-native';
3
-import { SharedElementTransition } from 'react-native-navigation';
2
+import {StyleSheet, View, Text, Image} from 'react-native';
3
+import {SharedElementTransition} from 'react-native-navigation';
4 4
 
5 5
 const SHOW_DURATION = 240;
6 6
 const HIDE_DURATION = 200;
7 7
 
8 8
 class Item extends React.Component {
9 9
 
10
-    static navigatorStyle = {
11
-        navBarHidden: true,
12
-        drawUnderNavBar: true
13
-    };
10
+  static navigatorStyle = {
11
+    navBarHidden: true,
12
+    drawUnderNavBar: true
13
+  };
14 14
 
15
-    render() {
16
-        return (
17
-            <View style={styles.container}>
18
-                <SharedElementTransition
19
-                    sharedElementId={this.props.sharedImageId}
20
-                    showDuration={SHOW_DURATION}
21
-                    hideDuration={HIDE_DURATION}
22
-                    animateClipBounds
23
-                    showInterpolation={{
24
-                        type: 'linear',
25
-                        easing: 'FastInSlowOut',
26
-                    }}
27
-                    hideInterpolation={{
28
-                        type: 'linear',
29
-                        easing: 'FastOutSlowIn',
30
-                    }}
31
-                >
32
-                    <Image
33
-                        style={styles.image}
34
-                        source={this.props.image}
35
-                    />
36
-                </SharedElementTransition>
37
-            </View>
38
-        );
39
-    }
15
+  render() {
16
+    return (
17
+      <View style={styles.container}>
18
+        <SharedElementTransition
19
+          sharedElementId={this.props.sharedImageId}
20
+          showDuration={SHOW_DURATION}
21
+          hideDuration={HIDE_DURATION}
22
+          animateClipBounds
23
+          showInterpolation={{
24
+            type: 'linear',
25
+            easing: 'FastInSlowOut',
26
+          }}
27
+          hideInterpolation={{
28
+            type: 'linear',
29
+            easing: 'FastOutSlowIn',
30
+          }}
31
+        >
32
+          <Image
33
+            style={styles.image}
34
+            source={this.props.image}
35
+          />
36
+        </SharedElementTransition>
37
+      </View>
38
+    );
39
+  }
40 40
 }
41 41
 
42 42
 const styles = StyleSheet.create({
43
-    container: {
44
-        flex: 1,
45
-        backgroundColor: '#ffffff',
46
-        justifyContent: 'center',
47
-    },
48
-    image: {
49
-        width: 400,
50
-        height: 400,
51
-    }
43
+  container: {
44
+    flex: 1,
45
+    backgroundColor: '#ffffff',
46
+    justifyContent: 'center',
47
+  },
48
+  image: {
49
+    width: 400,
50
+    height: 400,
51
+  }
52 52
 });
53 53
 
54 54
 export default Item;

+ 79
- 79
example/src/screens/transitions/sharedElementTransitions/Masonry/Masonry.js 查看文件

@@ -1,6 +1,6 @@
1 1
 import React from 'react';
2
-import { StyleSheet, View, Text, PixelRatio, FlatList, Image, TouchableHighlight } from 'react-native';
3
-import { Navigation, SharedElementTransition } from 'react-native-navigation';
2
+import {StyleSheet, View, Text, PixelRatio, FlatList, Image, TouchableHighlight} from 'react-native';
3
+import {Navigation, SharedElementTransition} from 'react-native-navigation';
4 4
 
5 5
 import images from './images';
6 6
 
@@ -9,90 +9,90 @@ const COLS = 2;
9 9
 
10 10
 class Masonry extends React.Component {
11 11
 
12
-    onAssetPress = (image, key) => {
13
-        this.props.navigator.push({
14
-            screen: 'example.Transitions.SharedElementTransitions.Masonry.Item',
15
-            sharedElements: [key],
16
-            passProps: {
17
-                image,
18
-                sharedImageId: key,
19
-            },
20
-        });
21
-    };
12
+  onAssetPress = (image, key) => {
13
+    this.props.navigator.push({
14
+      screen: 'example.Transitions.SharedElementTransitions.Masonry.Item',
15
+      sharedElements: [key],
16
+      passProps: {
17
+        image,
18
+        sharedImageId: key,
19
+      },
20
+    });
21
+  };
22 22
 
23
-    renderAsset = (asset, row, column, index) => {
24
-        const key = `row_${row}_column_${column}_asset_${index}`;
23
+  renderAsset = (asset, row, column, index) => {
24
+    const key = `row_${row}_column_${column}_asset_${index}`;
25 25
 
26
-        return (
27
-            <TouchableHighlight
28
-                key={key}
29
-                onPress={() => {
30
-                    this.onAssetPress(asset.source, key);
31
-                }}
32
-                style={[styles.assetContainer, { flex: asset.weight }]}
33
-            >
34
-                <View style={{ flex: 1 }}>
35
-                    <SharedElementTransition
36
-                        style={{ flex: 1 }}
37
-                        sharedElementId={key}
38
-                    >
39
-                        <Image
40
-                            source={asset.source}
41
-                            resizeMode={'cover'}
42
-                            style={styles.asset}
43
-                        />
44
-                    </SharedElementTransition>
45
-                </View>
46
-            </TouchableHighlight>
47
-        );
48
-    };
26
+    return (
27
+      <TouchableHighlight
28
+        key={key}
29
+        onPress={() => {
30
+          this.onAssetPress(asset.source, key);
31
+        }}
32
+        style={[styles.assetContainer, {flex: asset.weight}]}
33
+      >
34
+        <View style={{flex: 1}}>
35
+          <SharedElementTransition
36
+            style={{flex: 1}}
37
+            sharedElementId={key}
38
+          >
39
+            <Image
40
+              source={asset.source}
41
+              resizeMode={'cover'}
42
+              style={styles.asset}
43
+            />
44
+          </SharedElementTransition>
45
+        </View>
46
+      </TouchableHighlight>
47
+    );
48
+  };
49 49
 
50
-    renderItem = ({ item, index }) => {
51
-        return (
52
-            <View style={[styles.item, { height: ROW_HEIGHT }]}>
53
-                {[...new Array(COLS)].map((column, columnIndex) => (
54
-                    <View
55
-                        key={`row_${index}_column_${columnIndex}`}
56
-                        style={{ flex: 1 }}
57
-                    >
58
-                        {item.images[columnIndex].map((asset, assetIndex) => this.renderAsset(asset, index, columnIndex, assetIndex))}
59
-                    </View>
60
-                ))}
61
-            </View>
62
-        );
63
-    };
50
+  renderItem = ({item, index}) => {
51
+    return (
52
+      <View style={[styles.item, {height: ROW_HEIGHT}]}>
53
+        {[...new Array(COLS)].map((column, columnIndex) => (
54
+          <View
55
+            key={`row_${index}_column_${columnIndex}`}
56
+            style={{flex: 1}}
57
+          >
58
+            {item.images[columnIndex].map((asset, assetIndex) => this.renderAsset(asset, index, columnIndex, assetIndex))}
59
+          </View>
60
+        ))}
61
+      </View>
62
+    );
63
+  };
64 64
 
65
-    render() {
66
-        return (
67
-            <View style={styles.container}>
68
-                <FlatList
69
-                    data={images}
70
-                    renderItem={this.renderItem}
71
-                    getItemLayout={(layout, index) => ({ length: ROW_HEIGHT, offset: ROW_HEIGHT * index, index })}
72
-                />
73
-            </View>
74
-        );
75
-    }
65
+  render() {
66
+    return (
67
+      <View style={styles.container}>
68
+        <FlatList
69
+          data={images}
70
+          renderItem={this.renderItem}
71
+          getItemLayout={(layout, index) => ({length: ROW_HEIGHT, offset: ROW_HEIGHT * index, index})}
72
+        />
73
+      </View>
74
+    );
75
+  }
76 76
 }
77 77
 
78 78
 const styles = StyleSheet.create({
79
-    container: {
80
-        flex: 1,
81
-        backgroundColor: '#ffffff',
82
-    },
83
-    item: {
84
-        flex: 1,
85
-        flexDirection: 'row',
86
-    },
87
-    assetContainer: {
88
-        margin: 5,
89
-        borderRadius: 6,
90
-        borderWidth: StyleSheet.hairlineWidth,
91
-    },
92
-    asset: {
93
-        flex: 1,
94
-        borderRadius: 6,
95
-    },
79
+  container: {
80
+    flex: 1,
81
+    backgroundColor: '#ffffff',
82
+  },
83
+  item: {
84
+    flex: 1,
85
+    flexDirection: 'row',
86
+  },
87
+  assetContainer: {
88
+    margin: 5,
89
+    borderRadius: 6,
90
+    borderWidth: StyleSheet.hairlineWidth,
91
+  },
92
+  asset: {
93
+    flex: 1,
94
+    borderRadius: 6,
95
+  },
96 96
 });
97 97
 
98 98
 export default Masonry;

+ 92
- 92
example/src/screens/transitions/sharedElementTransitions/Masonry/images.js 查看文件

@@ -1,100 +1,100 @@
1 1
 const images = [
2
-    require('../../../../../img/masonry/Cfw87359UT.jpeg'),
3
-    require('../../../../../img/masonry/a848dHxA4e.jpeg'),
4
-    require('../../../../../img/masonry/AdGXmD1CH6.jpeg'),
5
-    require('../../../../../img/masonry/5Gi8kova3k.jpeg'),
6
-    require('../../../../../img/masonry/ri90ueind7.jpeg'),
7
-    require('../../../../../img/masonry/kVN0FryOZk.jpeg'),
8
-    require('../../../../../img/masonry/v8KLi2f0Tr.jpeg'),
9
-    require('../../../../../img/masonry/xU42hx19BB.jpeg'),
10
-    require('../../../../../img/masonry/61mpAVRV73.jpeg'),
11
-    require('../../../../../img/masonry/pqgylg80SD.jpeg'),
12
-    require('../../../../../img/masonry/37r6Cqp1B8.jpeg'),
13
-    require('../../../../../img/masonry/N30E32431C.jpeg'),
14
-    require('../../../../../img/masonry/rVOcz7rd0z.jpeg'),
15
-    require('../../../../../img/masonry/A4g0lZ33Z8.jpeg'),
16
-    require('../../../../../img/masonry/j51Pva1P8L.jpeg'),
17
-    require('../../../../../img/masonry/158xD4xbeh.jpeg'),
2
+  require('../../../../../img/masonry/Cfw87359UT.jpeg'),
3
+  require('../../../../../img/masonry/a848dHxA4e.jpeg'),
4
+  require('../../../../../img/masonry/AdGXmD1CH6.jpeg'),
5
+  require('../../../../../img/masonry/5Gi8kova3k.jpeg'),
6
+  require('../../../../../img/masonry/ri90ueind7.jpeg'),
7
+  require('../../../../../img/masonry/kVN0FryOZk.jpeg'),
8
+  require('../../../../../img/masonry/v8KLi2f0Tr.jpeg'),
9
+  require('../../../../../img/masonry/xU42hx19BB.jpeg'),
10
+  require('../../../../../img/masonry/61mpAVRV73.jpeg'),
11
+  require('../../../../../img/masonry/pqgylg80SD.jpeg'),
12
+  require('../../../../../img/masonry/37r6Cqp1B8.jpeg'),
13
+  require('../../../../../img/masonry/N30E32431C.jpeg'),
14
+  require('../../../../../img/masonry/rVOcz7rd0z.jpeg'),
15
+  require('../../../../../img/masonry/A4g0lZ33Z8.jpeg'),
16
+  require('../../../../../img/masonry/j51Pva1P8L.jpeg'),
17
+  require('../../../../../img/masonry/158xD4xbeh.jpeg'),
18 18
 ];
19 19
 
20 20
 function randomImage() {
21
-    return images[Math.floor(Math.random() * images.length)];
21
+  return images[Math.floor(Math.random() * images.length)];
22 22
 }
23 23
 
24 24
 export default [
25
-    {
26
-        key: 1,
27
-        images: [[{
28
-            weight: 2,
29
-            source: randomImage(),
30
-        }, {
31
-            weight: 1,
32
-            source: randomImage(),
33
-        }, {
34
-            weight: 3,
35
-            source: randomImage(),
36
-        }], [{
37
-            weight: 1,
38
-            source: randomImage(),
39
-        } ,{
40
-            weight: 3,
41
-            source: randomImage(),
42
-        }, {
43
-            weight: 1,
44
-            source: randomImage(),
45
-        }, {
46
-            weight: 1,
47
-            source: randomImage(),
48
-        }]],
49
-    },
50
-    {
51
-        key: 2,
52
-        images: [[{
53
-            weight: 1,
54
-            source: randomImage(),
55
-        }, {
56
-            weight: 1,
57
-            source: randomImage(),
58
-        }, {
59
-            weight: 1,
60
-            source: randomImage(),
61
-        }, {
62
-            weight: 3,
63
-            source: randomImage(),
64
-        }], [{
65
-            weight: 3,
66
-            source: randomImage(),
67
-        } ,{
68
-            weight: 3,
69
-            source: randomImage(),
70
-        }]],
71
-    },
72
-    {
73
-        key: 3,
74
-        images: [[{
75
-            weight: 1,
76
-            source: randomImage(),
77
-        }, {
78
-            weight: 2,
79
-            source: randomImage(),
80
-        }, {
81
-            weight: 1,
82
-            source: randomImage(),
83
-        }, {
84
-            weight: 2,
85
-            source: randomImage(),
86
-        }], [{
87
-            weight: 2,
88
-            source: randomImage(),
89
-        } ,{
90
-            weight: 1,
91
-            source: randomImage(),
92
-        }, {
93
-            weight: 2,
94
-            source: randomImage(),
95
-        }, {
96
-            weight: 1,
97
-            source: randomImage(),
98
-        }]],
99
-    }
25
+  {
26
+    key: 1,
27
+    images: [[{
28
+      weight: 2,
29
+      source: randomImage(),
30
+    }, {
31
+      weight: 1,
32
+      source: randomImage(),
33
+    }, {
34
+      weight: 3,
35
+      source: randomImage(),
36
+    }], [{
37
+      weight: 1,
38
+      source: randomImage(),
39
+    }, {
40
+      weight: 3,
41
+      source: randomImage(),
42
+    }, {
43
+      weight: 1,
44
+      source: randomImage(),
45
+    }, {
46
+      weight: 1,
47
+      source: randomImage(),
48
+    }]],
49
+  },
50
+  {
51
+    key: 2,
52
+    images: [[{
53
+      weight: 1,
54
+      source: randomImage(),
55
+    }, {
56
+      weight: 1,
57
+      source: randomImage(),
58
+    }, {
59
+      weight: 1,
60
+      source: randomImage(),
61
+    }, {
62
+      weight: 3,
63
+      source: randomImage(),
64
+    }], [{
65
+      weight: 3,
66
+      source: randomImage(),
67
+    }, {
68
+      weight: 3,
69
+      source: randomImage(),
70
+    }]],
71
+  },
72
+  {
73
+    key: 3,
74
+    images: [[{
75
+      weight: 1,
76
+      source: randomImage(),
77
+    }, {
78
+      weight: 2,
79
+      source: randomImage(),
80
+    }, {
81
+      weight: 1,
82
+      source: randomImage(),
83
+    }, {
84
+      weight: 2,
85
+      source: randomImage(),
86
+    }], [{
87
+      weight: 2,
88
+      source: randomImage(),
89
+    }, {
90
+      weight: 1,
91
+      source: randomImage(),
92
+    }, {
93
+      weight: 2,
94
+      source: randomImage(),
95
+    }, {
96
+      weight: 1,
97
+      source: randomImage(),
98
+    }]],
99
+  }
100 100
 ];

+ 182
- 182
example/src/screens/transitions/sharedElementTransitions/Profiles/Profiles.js 查看文件

@@ -1,14 +1,14 @@
1
-import React, { Component } from 'react';
1
+import React, {Component} from 'react';
2 2
 import {
3
-    ScrollView,
4
-    TouchableOpacity,
5
-    StyleSheet,
6
-    Image,
7
-    Text,
8
-    View,
9
-    ScrolView
3
+  ScrollView,
4
+  TouchableOpacity,
5
+  StyleSheet,
6
+  Image,
7
+  Text,
8
+  View,
9
+  ScrolView
10 10
 } from 'react-native';
11
-import { SharedElementTransition } from 'react-native-navigation';
11
+import {SharedElementTransition} from 'react-native-navigation';
12 12
 import * as Animatable from 'react-native-animatable';
13 13
 
14 14
 const FADE_DURATION = 500;
@@ -19,195 +19,195 @@ const ICON_MARGIN = 24;
19 19
 
20 20
 class Profiles extends Component {
21 21
 
22
-    constructor(props) {
23
-        super(props);
24
-        this.props.navigator.setOnNavigatorEvent(this.onNavigatorEvent.bind(this));
25
-        this.state = {
26
-            animationType: 'fadeIn'
27
-        }
22
+  constructor(props) {
23
+    super(props);
24
+    this.props.navigator.setOnNavigatorEvent(this.onNavigatorEvent.bind(this));
25
+    this.state = {
26
+      animationType: 'fadeIn'
28 27
     }
28
+  }
29 29
 
30
-    componentDidMount() {
31
-        if (__STRESS_TEST__) {
32
-            setTimeout(() => {
33
-                this.setState({
34
-                    animationType: 'fadeOut'
35
-                });
36
-                this.props.navigator.pop();
37
-            }, 650);
38
-        }
30
+  componentDidMount() {
31
+    if (__STRESS_TEST__) {
32
+      setTimeout(() => {
33
+        this.setState({
34
+          animationType: 'fadeOut'
35
+        });
36
+        this.props.navigator.pop();
37
+      }, 650);
39 38
     }
39
+  }
40 40
 
41
-    onNavigatorEvent(event) {
42
-        if (event.id === 'backPress') {
43
-            this.setState({
44
-                animationType: 'fadeOut'
45
-            });
46
-            this.props.navigator.pop();
47
-        }
41
+  onNavigatorEvent(event) {
42
+    if (event.id === 'backPress') {
43
+      this.setState({
44
+        animationType: 'fadeOut'
45
+      });
46
+      this.props.navigator.pop();
48 47
     }
48
+  }
49 49
 
50
-    _renderHeader() {
51
-        return (
52
-            <Animatable.View
53
-                animation={this.state.animationType}
54
-                duration={FADE_DURATION}
55
-                style={[styles.header, { backgroundColor: this.props.primaryColor }]}
56
-                useNativeDriver={true}
57
-            >
58
-                <View style={{ height: ICON_MARGIN, flexDirection: 'row', backgroundColor: 'white' }} />
59
-                <View style={{ flex: 1, flexDirection: 'row' }}>
60
-                    {this._renderIcon()}
61
-                    {this._renderTitle()}
62
-                </View>
63
-            </Animatable.View>
64
-        );
65
-    }
50
+  _renderHeader() {
51
+    return (
52
+      <Animatable.View
53
+        animation={this.state.animationType}
54
+        duration={FADE_DURATION}
55
+        style={[styles.header, {backgroundColor: this.props.primaryColor}]}
56
+        useNativeDriver={true}
57
+      >
58
+        <View style={{height: ICON_MARGIN, flexDirection: 'row', backgroundColor: 'white'}}/>
59
+        <View style={{flex: 1, flexDirection: 'row'}}>
60
+          {this._renderIcon()}
61
+          {this._renderTitle()}
62
+        </View>
63
+      </Animatable.View>
64
+    );
65
+  }
66 66
 
67
-    _renderTitle() {
68
-        return (
69
-            <View style={{ alignSelf: 'flex-end' }}>
70
-                <SharedElementTransition
71
-                    style={styles.titleContainer}
72
-                    sharedElementId={this.props.sharedTitleId}
73
-                    showDuration={SHOW_DURATION}
74
-                    hideDuration={HIDE_DURATION}
75
-                    showInterpolation={
76
-                        {
77
-                            type: 'path',
78
-                            controlX1: '0.5',
79
-                            controlY1: '1',
80
-                            controlX2: '0',
81
-                            controlY2: '0.5',
82
-                            easing: 'FastOutSlowIn'
83
-                        }
84
-                    }
85
-                    hideInterpolation={
86
-                        {
87
-                            type: 'path',
88
-                            controlX1: '0.5',
89
-                            controlY1: '0',
90
-                            controlX2: '1',
91
-                            controlY2: '0.5',
92
-                            easing: 'FastOutSlowIn'
93
-                        }
94
-                    }
95
-                >
96
-                    <Text style={[styles.title, { color: this.props.titleColor }]}>{this.props.title}</Text>
97
-                </SharedElementTransition>
98
-            </View>
99
-        );
100
-    }
67
+  _renderTitle() {
68
+    return (
69
+      <View style={{alignSelf: 'flex-end'}}>
70
+        <SharedElementTransition
71
+          style={styles.titleContainer}
72
+          sharedElementId={this.props.sharedTitleId}
73
+          showDuration={SHOW_DURATION}
74
+          hideDuration={HIDE_DURATION}
75
+          showInterpolation={
76
+            {
77
+              type: 'path',
78
+              controlX1: '0.5',
79
+              controlY1: '1',
80
+              controlX2: '0',
81
+              controlY2: '0.5',
82
+              easing: 'FastOutSlowIn'
83
+            }
84
+          }
85
+          hideInterpolation={
86
+            {
87
+              type: 'path',
88
+              controlX1: '0.5',
89
+              controlY1: '0',
90
+              controlX2: '1',
91
+              controlY2: '0.5',
92
+              easing: 'FastOutSlowIn'
93
+            }
94
+          }
95
+        >
96
+          <Text style={[styles.title, {color: this.props.titleColor}]}>{this.props.title}</Text>
97
+        </SharedElementTransition>
98
+      </View>
99
+    );
100
+  }
101 101
 
102
-    _renderContent() {
103
-        return (
104
-            <Animatable.View
105
-                animation={this.state.animationType}
106
-                duration={FADE_DURATION}
107
-                style={styles.body}
108
-                useNativeDriver={true}>
109
-                <View
110
-                    style={styles.list}
111
-                    initialListSize={20}>
112
-                    {this._genRows()}
113
-                </View>
114
-            </Animatable.View>
115
-        );
116
-    }
102
+  _renderContent() {
103
+    return (
104
+      <Animatable.View
105
+        animation={this.state.animationType}
106
+        duration={FADE_DURATION}
107
+        style={styles.body}
108
+        useNativeDriver={true}>
109
+        <View
110
+          style={styles.list}
111
+          initialListSize={20}>
112
+          {this._genRows()}
113
+        </View>
114
+      </Animatable.View>
115
+    );
116
+  }
117 117
 
118
-    _genRows() {
119
-        const children = [];
120
-        for (let ii = 0; ii < 30; ii++) {
121
-            children.push(
122
-                <Text>{'row ' + ii}</Text>
123
-            );
124
-        }
125
-        return children;
118
+  _genRows() {
119
+    const children = [];
120
+    for (let ii = 0; ii < 30; ii++) {
121
+      children.push(
122
+        <Text>{'row ' + ii}</Text>
123
+      );
126 124
     }
125
+    return children;
126
+  }
127 127
 
128
-    _renderIcon() {
129
-        return (
130
-            <SharedElementTransition
131
-                sharedElementId={this.props.sharedIconId}
132
-                style={styles.iconContainer}
133
-                showDuration={SHOW_DURATION}
134
-                hideDuration={HIDE_DURATION}
135
-                showInterpolation={
136
-                    {
137
-                        type: 'path',
138
-                        controlX1: '0.5',
139
-                        controlY1: '1',
140
-                        controlX2: '0',
141
-                        controlY2: '0.5',
142
-                        easing: 'FastOutSlowIn'
143
-                    }
144
-                }
145
-                hideInterpolation={
146
-                    {
147
-                        type: 'path',
148
-                        controlX1: '0.5',
149
-                        controlY1: '0',
150
-                        controlX2: '1',
151
-                        controlY2: '0.5',
152
-                        easing: 'FastOutSlowIn'
153
-                    }
154
-                }
155
-            >
156
-                <Image
157
-                    source={this.props.icon}
158
-                    style={styles.heroIcon}
159
-                    fadeDuration={0}
160
-                />
161
-            </SharedElementTransition>
162
-        );
163
-    }
128
+  _renderIcon() {
129
+    return (
130
+      <SharedElementTransition
131
+        sharedElementId={this.props.sharedIconId}
132
+        style={styles.iconContainer}
133
+        showDuration={SHOW_DURATION}
134
+        hideDuration={HIDE_DURATION}
135
+        showInterpolation={
136
+          {
137
+            type: 'path',
138
+            controlX1: '0.5',
139
+            controlY1: '1',
140
+            controlX2: '0',
141
+            controlY2: '0.5',
142
+            easing: 'FastOutSlowIn'
143
+          }
144
+        }
145
+        hideInterpolation={
146
+          {
147
+            type: 'path',
148
+            controlX1: '0.5',
149
+            controlY1: '0',
150
+            controlX2: '1',
151
+            controlY2: '0.5',
152
+            easing: 'FastOutSlowIn'
153
+          }
154
+        }
155
+      >
156
+        <Image
157
+          source={this.props.icon}
158
+          style={styles.heroIcon}
159
+          fadeDuration={0}
160
+        />
161
+      </SharedElementTransition>
162
+    );
163
+  }
164 164
 
165
-    render() {
166
-        return (
167
-            <ScrollView style={[styles.container]}>
168
-                {this._renderHeader()}
169
-                {this._renderContent()}
170
-            </ScrollView>
171
-        );
172
-    }
165
+  render() {
166
+    return (
167
+      <ScrollView style={[styles.container]}>
168
+        {this._renderHeader()}
169
+        {this._renderContent()}
170
+      </ScrollView>
171
+    );
172
+  }
173 173
 
174 174
 }
175 175
 
176 176
 const styles = StyleSheet.create({
177
-    container: {
178
-        flex: 1,
179
-        flexDirection: 'column',
180
-        backgroundColor: 'transparent'
181
-    },
182
-    header: {
183
-        height: 110,
184
-        flexDirection: 'column-reverse'
185
-    },
186
-    titleContainer: {
187
-        marginLeft: ICON_MARGIN + 90 + +16,
188
-        marginBottom: 8
189
-    },
190
-    title: {
191
-        fontSize: 23,
192
-    },
193
-    iconContainer: {
194
-        position: 'absolute',
195
-        bottom: -ICON_MARGIN,
196
-        left: ICON_MARGIN
197
-    },
198
-    heroIcon: {
199
-        width: 90,
200
-        height: 90,
201
-        resizeMode: 'contain'
202
-    },
203
-    body: {
204
-        flex: 4,
205
-        backgroundColor: 'white',
206
-    },
207
-    list: {
208
-        marginTop: 16,
209
-        marginHorizontal: 8
210
-    }
177
+  container: {
178
+    flex: 1,
179
+    flexDirection: 'column',
180
+    backgroundColor: 'transparent'
181
+  },
182
+  header: {
183
+    height: 110,
184
+    flexDirection: 'column-reverse'
185
+  },
186
+  titleContainer: {
187
+    marginLeft: ICON_MARGIN + 90 + +16,
188
+    marginBottom: 8
189
+  },
190
+  title: {
191
+    fontSize: 23,
192
+  },
193
+  iconContainer: {
194
+    position: 'absolute',
195
+    bottom: -ICON_MARGIN,
196
+    left: ICON_MARGIN
197
+  },
198
+  heroIcon: {
199
+    width: 90,
200
+    height: 90,
201
+    resizeMode: 'contain'
202
+  },
203
+  body: {
204
+    flex: 4,
205
+    backgroundColor: 'white',
206
+  },
207
+  list: {
208
+    marginTop: 16,
209
+    marginHorizontal: 8
210
+  }
211 211
 });
212 212
 
213 213
 export default Profiles;

+ 30
- 30
example/src/screens/transitions/sharedElementTransitions/Profiles/data.js 查看文件

@@ -1,32 +1,32 @@
1 1
 export default heroes = [
2
-    {
3
-        title: 'Bounty Hunter',
4
-        icon: require('../../../../../img/heroes/bouny_hunter.png'),
5
-        primaryColor: '#f0cb3c',
6
-        titleColor: '#993825'
7
-    },
8
-    {
9
-        title: 'Templar Assasin',
10
-        icon: require('../../../../../img/heroes/templar_assasin.png'),
11
-        primaryColor: '#f6f6f6',
12
-        titleColor: 'red',
13
-    },
14
-    {
15
-        title: 'Oracle',
16
-        icon: require('../../../../../img/heroes/oracle.png'),
17
-        primaryColor: '#19b0b9',
18
-        titleColor: '#a2195b'
19
-    },
20
-    {
21
-        title: 'Earthspirit',
22
-        icon: require('../../../../../img/heroes/earthspirit.png'),
23
-        primaryColor: '#819c97',
24
-        titleColor: 'red',
25
-    },
26
-    {
27
-        title: 'Skywrath Mage',
28
-        icon: require('../../../../../img/heroes/skywrath_mage.png'),
29
-        primaryColor: '#dfb42e',
30
-        titleColor: '#1e5ea6'
31
-    }
2
+  {
3
+    title: 'Bounty Hunter',
4
+    icon: require('../../../../../img/heroes/bouny_hunter.png'),
5
+    primaryColor: '#f0cb3c',
6
+    titleColor: '#993825'
7
+  },
8
+  {
9
+    title: 'Templar Assasin',
10
+    icon: require('../../../../../img/heroes/templar_assasin.png'),
11
+    primaryColor: '#f6f6f6',
12
+    titleColor: 'red',
13
+  },
14
+  {
15
+    title: 'Oracle',
16
+    icon: require('../../../../../img/heroes/oracle.png'),
17
+    primaryColor: '#19b0b9',
18
+    titleColor: '#a2195b'
19
+  },
20
+  {
21
+    title: 'Earthspirit',
22
+    icon: require('../../../../../img/heroes/earthspirit.png'),
23
+    primaryColor: '#819c97',
24
+    titleColor: 'red',
25
+  },
26
+  {
27
+    title: 'Skywrath Mage',
28
+    icon: require('../../../../../img/heroes/skywrath_mage.png'),
29
+    primaryColor: '#dfb42e',
30
+    titleColor: '#1e5ea6'
31
+  }
32 32
 ];

+ 14
- 14
example/src/screens/types/Drawer.js 查看文件

@@ -1,25 +1,25 @@
1 1
 import React from 'react';
2
-import { StyleSheet, View, Text } from 'react-native';
2
+import {StyleSheet, View, Text} from 'react-native';
3 3
 
4 4
 class MyClass extends React.Component {
5 5
 
6
-    render() {
7
-        return (
8
-            <View style={styles.container}>
6
+  render() {
7
+    return (
8
+      <View style={styles.container}>
9 9
 
10
-            </View>
11
-        );
12
-    }
10
+      </View>
11
+    );
12
+  }
13 13
 }
14 14
 
15 15
 const styles = StyleSheet.create({
16
-    container: {
17
-        flex: 1,
18
-        width: 300,
19
-        alignItems: 'center',
20
-        justifyContent: 'center',
21
-        backgroundColor: '#ffffff',
22
-    },
16
+  container: {
17
+    flex: 1,
18
+    width: 300,
19
+    alignItems: 'center',
20
+    justifyContent: 'center',
21
+    backgroundColor: '#ffffff',
22
+  },
23 23
 });
24 24
 
25 25
 export default MyClass;

+ 31
- 31
example/src/screens/types/LightBox.js 查看文件

@@ -1,41 +1,41 @@
1 1
 import React from 'react';
2
-import { StyleSheet, View, Text, Dimensions, Button } from 'react-native';
2
+import {StyleSheet, View, Text, Dimensions, Button} from 'react-native';
3 3
 
4 4
 class Lightbox extends React.Component {
5 5
 
6
-    render() {
7
-        return (
8
-            <View style={styles.container}>
9
-                <View style={{ flex: 8 }}>
10
-                    <Text style={styles.title}>{this.props.title}</Text>
11
-                    <Text style={styles.content}>{this.props.content}</Text>
12
-                </View>
13
-                <View style={{ flex: 2 }}>
14
-                    <Button
15
-                        title={'Close'}
16
-                        onPress={() => this.props.onClose()}
17
-                    />
18
-                </View>
19
-            </View>
20
-        );
21
-    }
6
+  render() {
7
+    return (
8
+      <View style={styles.container}>
9
+        <View style={{flex: 8}}>
10
+          <Text style={styles.title}>{this.props.title}</Text>
11
+          <Text style={styles.content}>{this.props.content}</Text>
12
+        </View>
13
+        <View style={{flex: 2}}>
14
+          <Button
15
+            title={'Close'}
16
+            onPress={() => this.props.onClose()}
17
+          />
18
+        </View>
19
+      </View>
20
+    );
21
+  }
22 22
 }
23 23
 
24 24
 const styles = StyleSheet.create({
25
-    container: {
26
-        width: Dimensions.get('window').width * 0.7,
27
-        height: Dimensions.get('window').height * 0.3,
28
-        backgroundColor: '#ffffff',
29
-        borderRadius: 5,
30
-        padding: 16,
31
-    },
32
-    title: {
33
-        fontSize: 17,
34
-        fontWeight: '700',
35
-    },
36
-    content: {
37
-      marginTop: 8,
38
-    },
25
+  container: {
26
+    width: Dimensions.get('window').width * 0.7,
27
+    height: Dimensions.get('window').height * 0.3,
28
+    backgroundColor: '#ffffff',
29
+    borderRadius: 5,
30
+    padding: 16,
31
+  },
32
+  title: {
33
+    fontSize: 17,
34
+    fontWeight: '700',
35
+  },
36
+  content: {
37
+    marginTop: 8,
38
+  },
39 39
 });
40 40
 
41 41
 export default Lightbox;

+ 14
- 14
example/src/screens/types/Modal.js 查看文件

@@ -1,24 +1,24 @@
1 1
 import React from 'react';
2
-import { StyleSheet, View, Text } from 'react-native';
2
+import {StyleSheet, View, Text} from 'react-native';
3 3
 
4 4
 class Modal extends React.Component {
5 5
 
6
-    render() {
7
-        return (
8
-            <View style={styles.container}>
9
-                <Text>Modal Screen</Text>
10
-            </View>
11
-        );
12
-    }
6
+  render() {
7
+    return (
8
+      <View style={styles.container}>
9
+        <Text>Modal Screen</Text>
10
+      </View>
11
+    );
12
+  }
13 13
 }
14 14
 
15 15
 const styles = StyleSheet.create({
16
-    container: {
17
-        flex: 1,
18
-        alignItems: 'center',
19
-        justifyContent: 'center',
20
-        backgroundColor: '#ffffff',
21
-    },
16
+  container: {
17
+    flex: 1,
18
+    alignItems: 'center',
19
+    justifyContent: 'center',
20
+    backgroundColor: '#ffffff',
21
+  },
22 22
 });
23 23
 
24 24
 export default Modal;

+ 23
- 23
example/src/screens/types/Notification.js 查看文件

@@ -1,33 +1,33 @@
1 1
 import React from 'react';
2
-import { StyleSheet, View, Text, Dimensions, Button } from 'react-native';
2
+import {StyleSheet, View, Text, Dimensions, Button} from 'react-native';
3 3
 
4 4
 class Notification extends React.Component {
5 5
 
6
-    render() {
7
-        return (
8
-            <View style={styles.container}>
9
-                <Text style={styles.title}>In-App Notification</Text>
10
-                <Text style={styles.content}>You have 10 unread notifications!</Text>
11
-            </View>
12
-        );
13
-    }
6
+  render() {
7
+    return (
8
+      <View style={styles.container}>
9
+        <Text style={styles.title}>In-App Notification</Text>
10
+        <Text style={styles.content}>You have 10 unread notifications!</Text>
11
+      </View>
12
+    );
13
+  }
14 14
 }
15 15
 
16 16
 const styles = StyleSheet.create({
17
-    container: {
18
-        height: 100,
19
-        backgroundColor: '#ff505c',
20
-        padding: 16,
21
-        margin: 10,
22
-    },
23
-    title: {
24
-        fontSize: 18,
25
-        textAlign: 'center',
26
-    },
27
-    content: {
28
-        textAlign: 'center',
29
-        marginTop: 10,
30
-    },
17
+  container: {
18
+    height: 100,
19
+    backgroundColor: '#ff505c',
20
+    padding: 16,
21
+    margin: 10,
22
+  },
23
+  title: {
24
+    fontSize: 18,
25
+    textAlign: 'center',
26
+  },
27
+  content: {
28
+    textAlign: 'center',
29
+    marginTop: 10,
30
+  },
31 31
 });
32 32
 
33 33
 export default Notification;

+ 14
- 14
example/src/screens/types/Push.js 查看文件

@@ -1,24 +1,24 @@
1 1
 import React from 'react';
2
-import { StyleSheet, View, Text } from 'react-native';
2
+import {StyleSheet, View, Text} from 'react-native';
3 3
 
4 4
 class Push extends React.Component {
5 5
 
6
-    render() {
7
-        return (
8
-            <View style={styles.container}>
9
-                <Text>Pushed Screen</Text>
10
-            </View>
11
-        );
12
-    }
6
+  render() {
7
+    return (
8
+      <View style={styles.container}>
9
+        <Text>Pushed Screen</Text>
10
+      </View>
11
+    );
12
+  }
13 13
 }
14 14
 
15 15
 const styles = StyleSheet.create({
16
-    container: {
17
-        flex: 1,
18
-        alignItems: 'center',
19
-        justifyContent: 'center',
20
-        backgroundColor: '#ffffff',
21
-    },
16
+  container: {
17
+    flex: 1,
18
+    alignItems: 'center',
19
+    justifyContent: 'center',
20
+    backgroundColor: '#ffffff',
21
+  },
22 22
 });
23 23
 
24 24
 export default Push;

+ 11
- 11
example/src/screens/types/TopTabs.js 查看文件

@@ -1,19 +1,19 @@
1 1
 import React from 'react';
2
-import { PixelRatio } from 'react-native';
2
+import {PixelRatio} from 'react-native';
3 3
 
4 4
 class TopTabs extends React.Component {
5
-    static navigatorStyle = {
6
-        topTabTextColor: '#ffffff',
7
-        selectedTopTabTextColor: '#ff505c',
5
+  static navigatorStyle = {
6
+    topTabTextColor: '#ffffff',
7
+    selectedTopTabTextColor: '#ff505c',
8 8
 
9
-        // Icons
10
-        topTabIconColor: '#ffffff',
11
-        selectedTopTabIconColor: '#ff505c',
9
+    // Icons
10
+    topTabIconColor: '#ffffff',
11
+    selectedTopTabIconColor: '#ff505c',
12 12
 
13
-        // Tab indicator
14
-        selectedTopTabIndicatorHeight: PixelRatio.get() * 2,
15
-        selectedTopTabIndicatorColor: '#ff505c',
16
-    };
13
+    // Tab indicator
14
+    selectedTopTabIndicatorHeight: PixelRatio.get() * 2,
15
+    selectedTopTabIndicatorColor: '#ff505c',
16
+  };
17 17
 }
18 18
 
19 19
 export default TopTabs;

+ 8
- 8
example/src/screens/types/tabs/TabOne.js 查看文件

@@ -1,15 +1,15 @@
1 1
 import React from 'react';
2
-import { StyleSheet, View, Text, Dimensions, Button } from 'react-native';
2
+import {StyleSheet, View, Text, Dimensions, Button} from 'react-native';
3 3
 
4 4
 class TabOne extends React.Component {
5 5
 
6
-    render() {
7
-        return (
8
-            <View>
9
-                <Text>Tab One</Text>
10
-            </View>
11
-        );
12
-    }
6
+  render() {
7
+    return (
8
+      <View>
9
+        <Text>Tab One</Text>
10
+      </View>
11
+    );
12
+  }
13 13
 }
14 14
 
15 15
 export default TabOne;

+ 8
- 8
example/src/screens/types/tabs/TabTwo.js 查看文件

@@ -1,15 +1,15 @@
1 1
 import React from 'react';
2
-import { StyleSheet, View, Text, Dimensions, Button } from 'react-native';
2
+import {StyleSheet, View, Text, Dimensions, Button} from 'react-native';
3 3
 
4 4
 class TabOne extends React.Component {
5 5
 
6
-    render() {
7
-        return (
8
-            <View>
9
-                <Text>Tab Two</Text>
10
-            </View>
11
-        );
12
-    }
6
+  render() {
7
+    return (
8
+      <View>
9
+        <Text>Tab Two</Text>
10
+      </View>
11
+    );
12
+  }
13 13
 }
14 14
 
15 15
 export default TabOne;