chore: migrate to monorepo

This commit is contained in:
Satyajit Sahoo
2020-02-07 23:20:57 +01:00
parent a7305b1413
commit 72e8160537
477 changed files with 155789 additions and 170280 deletions

View File

@@ -0,0 +1,117 @@
import * as React from 'react';
import { SafeAreaView, Themed } from 'react-navigation';
import {
createStackNavigator,
NavigationStackScreenProps,
TransitionPresets,
HeaderStyleInterpolators,
} from 'react-navigation-stack';
import { Button } from './Shared/ButtonWithMargin';
class HomeScreen extends React.Component<NavigationStackScreenProps> {
static navigationOptions = {
title: 'Welcome',
};
render() {
const { navigation } = this.props;
const { push } = navigation;
return (
<SafeAreaView style={{ paddingTop: 30 }}>
<Button onPress={() => push('Other')} title="Push another screen" />
<Button
onPress={() => push('ScreenWithNoHeader')}
title="Push screen with no header"
/>
<Button onPress={() => navigation.goBack(null)} title="Go Home" />
<Themed.StatusBar />
</SafeAreaView>
);
}
}
class OtherScreen extends React.Component<NavigationStackScreenProps> {
static navigationOptions = {
title: 'Your title here',
};
render() {
const { navigation } = this.props;
const { push, pop } = navigation;
return (
<SafeAreaView style={{ paddingTop: 30 }}>
<Button
onPress={() => push('ScreenWithLongTitle')}
title="Push another screen"
/>
<Button
onPress={() => push('ScreenWithNoHeader')}
title="Push screen with no header"
/>
<Button onPress={() => pop()} title="Pop" />
<Button onPress={() => navigation.goBack(null)} title="Go back" />
<Themed.StatusBar />
</SafeAreaView>
);
}
}
class ScreenWithLongTitle extends React.Component<NavigationStackScreenProps> {
static navigationOptions = {
title: "Another title that's kind of long",
};
render() {
const { navigation } = this.props;
const { pop } = navigation;
return (
<SafeAreaView style={{ paddingTop: 30 }}>
<Button onPress={() => pop()} title="Pop" />
<Button onPress={() => navigation.goBack(null)} title="Go back" />
<Themed.StatusBar />
</SafeAreaView>
);
}
}
class ScreenWithNoHeader extends React.Component<NavigationStackScreenProps> {
static navigationOptions = {
headerShown: false,
title: 'No Header',
};
render() {
const { navigation } = this.props;
const { push, pop } = navigation;
return (
<SafeAreaView style={{ paddingTop: 30 }}>
<Button onPress={() => push('Other')} title="Push another screen" />
<Button onPress={() => pop()} title="Pop" />
<Button onPress={() => navigation.goBack(null)} title="Go back" />
<Themed.StatusBar />
</SafeAreaView>
);
}
}
const StackWithHeaderPreset = createStackNavigator(
{
Home: HomeScreen,
Other: OtherScreen,
ScreenWithLongTitle,
ScreenWithNoHeader,
},
{
defaultNavigationOptions: {
...TransitionPresets.SlideFromRightIOS,
headerStyleInterpolator: HeaderStyleInterpolators.forUIKit,
},
}
);
export default StackWithHeaderPreset;