import React, { Component } from 'react';
import { StyleSheet, Button, View, TextInput } from 'react-native';
import { Screen, ScreenContainer } from 'react-native-screens';
export class LazyTabs extends Component {
state = {
screens: ['azure'],
active: 'azure',
};
goto(key) {
let { screens } = this.state;
if (screens.indexOf(key) === -1) {
screens = [...screens, key];
}
this.setState({ active: key, screens });
}
renderScreen = (key, index) => {
const active = key === this.state.active ? 1 : 0;
return (
{this.props.renderScreen(key)}
);
};
render() {
const screens = this.state.screens.map(this.renderScreen);
return (
{screens}
);
}
}
class App extends Component {
renderScreen = key => {
const color = key;
return (
);
};
render() {
return (
(this.tabs = tabs)}
renderScreen={this.renderScreen}
/>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#F5FCFF',
},
tabbar: {
alignSelf: 'stretch',
flexDirection: 'row',
justifyContent: 'space-around',
backgroundColor: '#eee',
borderTopWidth: 1,
borderColor: '#ddd',
},
textInput: {
backgroundColor: 'white',
borderWidth: 1,
padding: 10,
marginHorizontal: 20,
alignSelf: 'stretch',
borderColor: 'black',
},
});
export default App;