-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathindex.ios.js
110 lines (95 loc) · 3.15 KB
/
index.ios.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
'use strict';
var React = require('react-native');
var {
AppRegistry,
StyleSheet,
Navigator,
TouchableOpacity,
View,
Text,
PixelRatio
} = React;
var FlexTest = require('./application/common/flex_test.js');
var Fish = require('./application/common/fish.js');
var fish_cfg_istarkov = require('./application/istarkov_fish/fish_cfg_istarkov.js');
var create_istarkov_fish_part = require('./application/istarkov_fish/fish_flake_types.js').createPart;
var Dimensions = require('Dimensions');
var kSCREEN_WIDTH = Dimensions.get('window').width;
var kSCREEN_HEIGHT = Dimensions.get('window').height;
var scenes_ = [
{
title: 'istarkov',
component: (route, nav, active) => (
<Fish
options={
{
dimensions: {width: kSCREEN_WIDTH, height: kSCREEN_HEIGHT},
body: { b_sigma: 0.3, b_mu: 0.5, b_r_scale: 30, b_min_r: 0, b_length: 16, b_flakes_count: 12,
b_flake_colors: ['#F0F00F', '#000F0F', '#F0000F', '#F00F0F', '#000AE0']}
}}
create={fish_cfg_istarkov}
createPart={create_istarkov_fish_part}
{...route}
active={active}
navigator={nav} />),
},
{
title: 'hz',
component: (route, nav, active) => (
<Fish
options={
{
dimensions: {width: kSCREEN_WIDTH, height: kSCREEN_HEIGHT},
body: { b_sigma: 0.33, b_mu: 0.8, b_r_scale: 30, b_min_r: 0, b_length: 20, b_flakes_count: 10,
b_flake_colors: ['#F00F9F', '#00FFEF', '#FFFF00', '#0000FF', '#F06F9F']}
}}
create={fish_cfg_istarkov}
createPart={create_istarkov_fish_part}
{...route}
active={active}
navigator={nav} />),
},
{
title: 'Temp',
component: (route, nav, active) => <FlexTest {...route} active={active} navigator={nav} />,
}
];
var route_mapper = require('./application/route_mapper.js');
var animation = React.createClass({
renderScene (route, nav) {
return scenes_[route.index].component(route, nav, this.state.play_anim && route.index === this.state.current_route); //<FlexTest {...route} navigator={nav} />;
},
routeMapper: route_mapper(scenes_),
getInitialState() {
return {
current_route: 0,
play_anim: false,
};
},
render() {
return (
<Navigator
style={styles.navigator}
initialRoute={{ index: this.state.current_route }}
renderScene={this.renderScene}
onWillFocus={(r) => this.setState({play_anim: false, current_route: r.index})} //to detect current view inside view (props.navigator.getCurrentRoutes() does not call redraw)
onDidFocus={(r) => this.setState({play_anim: true})} //
navigationBar={
<Navigator.NavigationBar
routeMapper={this.routeMapper}
style={styles.navBar} />
} />
);
}
});
var styles = StyleSheet.create({
navigator: {
paddingTop: Navigator.NavigationBar.Styles.General.TotalNavHeight
},
navBar: {
backgroundColor: 'white',
borderBottomWidth: 1 / PixelRatio.get(), //very thin line
borderBottomColor: '#EEEEEE',
},
});
AppRegistry.registerComponent('animation', () => animation);