Skip to content

Commit

Permalink
Layout changes
Browse files Browse the repository at this point in the history
  • Loading branch information
guyca committed Dec 31, 2018
1 parent 464ee20 commit 4da8cfb
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 15 deletions.
48 changes: 42 additions & 6 deletions playground/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,17 +158,53 @@ function start() {

Navigation.setRoot({
root: {
stack: {
id: 'TEST',
bottomTabs: {
options: {
animations: {
setRoot: {
waitForRender: true
}
}
},
children: [
{
component: {
name: 'navigation.playground.WelcomeScreen'
// name: 'navigation.playground.CustomTransitionOrigin'
stack: {
children: [
{
component: {
name: `navigation.playground.OptionsScreen`,
options: {
bottomTab: {
icon: require('../img/one.png'),
text: 'options'
}
}
}
}
]
}
},
{
stack: {
id: 'TEST',
children: [
{
component: {
name: 'navigation.playground.WelcomeScreen',
// name: 'navigation.playground.CustomTransitionOrigin'
options: {
bottomTab: {
icon: require('../img/two.png'),
text: 'Welcome'
}
}
}
}
]
}
}
]
}
},
}
});
});
Expand Down
10 changes: 8 additions & 2 deletions playground/src/screens/CustomRoundedButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,17 @@ class CustomRoundedButton extends Component {

constructor(props) {
super(props);
this.subscription = Navigation.events().bindComponent(this);
this.simulateLongRunningTask();
console.log('guyca', `CRB`);
Navigation.events().bindComponent(this);
this.state = {};
}

simulateLongRunningTask = () => {
// tslint:disable-next-line
for (let i = 0; i < Math.pow(2, 24); i++);
}

componentDidAppear() {
console.log('RNN', 'CRB.componentDidAppear');
}
Expand All @@ -31,7 +38,6 @@ class CustomRoundedButton extends Component {
}

componentWillUnmount() {
this.subscription.remove();
console.log('RNN', `CRB.componentWillUnmount`);
}

Expand Down
10 changes: 8 additions & 2 deletions playground/src/screens/CustomTopBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ class CustomTopBar extends Component {

constructor(props) {
super(props);
console.log('guyca', `T.ctor ${this.props.color}`);
this.simulateLongRunningTask();
this.state = {};
this.subscription = Navigation.events().bindComponent(this);
Navigation.events().bindComponent(this);
}

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

componentWillUnmount() {
console.log('RNN', `CTB.componentWillUnmount`);
this.subscription.remove();
}

simulateLongRunningTask = () => {
// tslint:disable-next-line
for (let i = 0; i < Math.pow(2, 24); i++);
}

render() {
Expand Down
17 changes: 14 additions & 3 deletions playground/src/screens/OptionsScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const TOPBAR_HEIGHT = 67;
class OptionsScreen extends Component {
constructor(props) {
super(props);
console.log('guyca', `OS.ctor`);
Navigation.events().bindComponent(this);
}

Expand All @@ -28,8 +29,16 @@ class OptionsScreen extends Component {
},
topBar: {
title: {
text: 'Static Title',
_text: 'Static Title',
_height: TOPBAR_HEIGHT,
component: {
name: 'navigation.playground.CustomTopBar',
alignment: 'center',
waitForRender: true,
passProps: {
title: 'hola'
}
},
color: 'black',
fontSize: 16,
alignment: 'center',
Expand All @@ -38,7 +47,7 @@ class OptionsScreen extends Component {
largeTitle: {
visible: false
},
subtitle: {
_subtitle: {
text: 'Static Subtitle',
color: 'red',
fontFamily: 'HelveticaNeue-Italic',
Expand All @@ -50,7 +59,8 @@ class OptionsScreen extends Component {
passProps: {
color: '#bbdefb'
}
}
},
waitForRender: true
},
...Platform.select({
android: { drawBehind: true },
Expand All @@ -72,6 +82,7 @@ class OptionsScreen extends Component {
testID: CUSTOM_BUTTON2,
component: {
name: 'CustomRoundedButton',
waitForRender: true,
passProps: {
title: 'Two'
}
Expand Down
10 changes: 8 additions & 2 deletions playground/src/screens/TopBarBackground.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,18 @@ class TopBarBackground extends Component {

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

simulateLongRunningTask = () => {
// tslint:disable-next-line
for (let i = 0; i < Math.pow(2, 24); i++);
}

componentDidAppear() {
console.log('RNN', 'TBB.componentDidAppear');
}
Expand All @@ -29,7 +36,6 @@ class TopBarBackground extends Component {

componentWillUnmount() {
console.log('RNN', `TBB.componentWillUnmount`);
this.subscription.remove();
}

render() {
Expand Down

0 comments on commit 4da8cfb

Please sign in to comment.