Skip to content

Commit 4da8cfb

Browse files
committed
Layout changes
1 parent 464ee20 commit 4da8cfb

File tree

5 files changed

+80
-15
lines changed

5 files changed

+80
-15
lines changed

playground/src/app.js

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,17 +158,53 @@ function start() {
158158

159159
Navigation.setRoot({
160160
root: {
161-
stack: {
162-
id: 'TEST',
161+
bottomTabs: {
162+
options: {
163+
animations: {
164+
setRoot: {
165+
waitForRender: true
166+
}
167+
}
168+
},
163169
children: [
164170
{
165-
component: {
166-
name: 'navigation.playground.WelcomeScreen'
167-
// name: 'navigation.playground.CustomTransitionOrigin'
171+
stack: {
172+
children: [
173+
{
174+
component: {
175+
name: `navigation.playground.OptionsScreen`,
176+
options: {
177+
bottomTab: {
178+
icon: require('../img/one.png'),
179+
text: 'options'
180+
}
181+
}
182+
}
183+
}
184+
]
185+
}
186+
},
187+
{
188+
stack: {
189+
id: 'TEST',
190+
children: [
191+
{
192+
component: {
193+
name: 'navigation.playground.WelcomeScreen',
194+
// name: 'navigation.playground.CustomTransitionOrigin'
195+
options: {
196+
bottomTab: {
197+
icon: require('../img/two.png'),
198+
text: 'Welcome'
199+
}
200+
}
201+
}
202+
}
203+
]
168204
}
169205
}
170206
]
171-
}
207+
},
172208
}
173209
});
174210
});

playground/src/screens/CustomRoundedButton.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,17 @@ class CustomRoundedButton extends Component {
1414

1515
constructor(props) {
1616
super(props);
17-
this.subscription = Navigation.events().bindComponent(this);
17+
this.simulateLongRunningTask();
18+
console.log('guyca', `CRB`);
19+
Navigation.events().bindComponent(this);
1820
this.state = {};
1921
}
2022

23+
simulateLongRunningTask = () => {
24+
// tslint:disable-next-line
25+
for (let i = 0; i < Math.pow(2, 24); i++);
26+
}
27+
2128
componentDidAppear() {
2229
console.log('RNN', 'CRB.componentDidAppear');
2330
}
@@ -31,7 +38,6 @@ class CustomRoundedButton extends Component {
3138
}
3239

3340
componentWillUnmount() {
34-
this.subscription.remove();
3541
console.log('RNN', `CRB.componentWillUnmount`);
3642
}
3743

playground/src/screens/CustomTopBar.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ class CustomTopBar extends Component {
1414

1515
constructor(props) {
1616
super(props);
17+
console.log('guyca', `T.ctor ${this.props.color}`);
18+
this.simulateLongRunningTask();
1719
this.state = {};
18-
this.subscription = Navigation.events().bindComponent(this);
20+
Navigation.events().bindComponent(this);
1921
}
2022

2123
componentDidAppear() {
@@ -32,7 +34,11 @@ class CustomTopBar extends Component {
3234

3335
componentWillUnmount() {
3436
console.log('RNN', `CTB.componentWillUnmount`);
35-
this.subscription.remove();
37+
}
38+
39+
simulateLongRunningTask = () => {
40+
// tslint:disable-next-line
41+
for (let i = 0; i < Math.pow(2, 24); i++);
3642
}
3743

3844
render() {

playground/src/screens/OptionsScreen.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const TOPBAR_HEIGHT = 67;
1717
class OptionsScreen extends Component {
1818
constructor(props) {
1919
super(props);
20+
console.log('guyca', `OS.ctor`);
2021
Navigation.events().bindComponent(this);
2122
}
2223

@@ -28,8 +29,16 @@ class OptionsScreen extends Component {
2829
},
2930
topBar: {
3031
title: {
31-
text: 'Static Title',
32+
_text: 'Static Title',
3233
_height: TOPBAR_HEIGHT,
34+
component: {
35+
name: 'navigation.playground.CustomTopBar',
36+
alignment: 'center',
37+
waitForRender: true,
38+
passProps: {
39+
title: 'hola'
40+
}
41+
},
3342
color: 'black',
3443
fontSize: 16,
3544
alignment: 'center',
@@ -38,7 +47,7 @@ class OptionsScreen extends Component {
3847
largeTitle: {
3948
visible: false
4049
},
41-
subtitle: {
50+
_subtitle: {
4251
text: 'Static Subtitle',
4352
color: 'red',
4453
fontFamily: 'HelveticaNeue-Italic',
@@ -50,7 +59,8 @@ class OptionsScreen extends Component {
5059
passProps: {
5160
color: '#bbdefb'
5261
}
53-
}
62+
},
63+
waitForRender: true
5464
},
5565
...Platform.select({
5666
android: { drawBehind: true },
@@ -72,6 +82,7 @@ class OptionsScreen extends Component {
7282
testID: CUSTOM_BUTTON2,
7383
component: {
7484
name: 'CustomRoundedButton',
85+
waitForRender: true,
7586
passProps: {
7687
title: 'Two'
7788
}

playground/src/screens/TopBarBackground.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,18 @@ class TopBarBackground extends Component {
1010

1111
constructor(props) {
1212
super(props);
13-
this.subscription = Navigation.events().bindComponent(this);
13+
this.simulateLongRunningTask();
14+
console.log('guyca', `TBB.ctor ${this.props.color}`);
15+
Navigation.events().bindComponent(this);
1416
this.state = {};
1517
this.dots = new Array(55).fill('').map((ignored, i) => <View key={'dot' + i} style={[styles.dot, {backgroundColor: this.props.color}]}/>);
1618
}
1719

20+
simulateLongRunningTask = () => {
21+
// tslint:disable-next-line
22+
for (let i = 0; i < Math.pow(2, 24); i++);
23+
}
24+
1825
componentDidAppear() {
1926
console.log('RNN', 'TBB.componentDidAppear');
2027
}
@@ -29,7 +36,6 @@ class TopBarBackground extends Component {
2936

3037
componentWillUnmount() {
3138
console.log('RNN', `TBB.componentWillUnmount`);
32-
this.subscription.remove();
3339
}
3440

3541
render() {

0 commit comments

Comments
 (0)