import React from 'react';
import { Dimensions, Button, View, Text } from 'react-native';
import { withNavigation } from '@react-navigation/core';
import { createStackNavigator } from 'react-navigation-stack';
const Buttons = withNavigation(props => (
));
class ListScreen extends React.Component {
static navigationOptions = {
title: 'List',
};
componentDidMount() {
console.log('ListScreen didMount');
}
componentWillUnmount() {
console.log('ListScreen willUnmount');
}
render() {
return (
List Screen
A list may go here
);
}
}
class DetailsScreen extends React.Component {
static navigationOptions = {
title: 'Details',
gestureResponseDistance: {
horizontal: Dimensions.get('window').width,
},
};
componentDidMount() {
console.log('DetailsScreen didMount');
}
componentWillUnmount() {
console.log('DetailsScreen willUnmount');
}
render() {
return (
Details Screen
);
}
_goBackInTwoSeconds = () => {
setTimeout(() => {
this.props.navigation.goBack();
}, 2000);
};
}
class HeaderlessScreen extends React.Component {
static navigationOptions = {
header: null,
};
componentDidMount() {
console.log('HeaderlessScreen didMount');
}
componentWillUnmount() {
console.log('HeaderlessScreen willUnmount');
}
render() {
return (
Headerless Screen
);
}
}
export default createStackNavigator(
{
List: ListScreen,
Details: DetailsScreen,
Headerless: HeaderlessScreen,
},
{
initialRouteName: 'List',
// these are the defaults
cardShadowEnabled: true,
cardOverlayEnabled: false,
// headerTransitionPreset: 'uikit',
}
);