-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainPage.tsx
38 lines (34 loc) · 982 Bytes
/
MainPage.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import React, { Component } from 'react';
import { View, Button } from 'react-native';
import { MockDataNestedPromisesServicePage } from './MockDataNestedPromisesServicePage';
import { MockDataFlatPromisesServicePage } from './MockDataFlatPromisesServicePage';
interface IMainPageState {
page?: JSX.Element;
}
export class MainPage extends Component<Record<string, never>, IMainPageState> {
public override render(): JSX.Element {
if (this.state?.page) {
return this.state.page;
}
return (
<View>
<Button
title='Mock Data with Nested Promises'
onPress={() =>
this.setState({
page: <MockDataNestedPromisesServicePage onGoBack={() => this.setState({ page: undefined })} />,
})
}
/>
<Button
title='Mock Data with Flat Promises'
onPress={() =>
this.setState({
page: <MockDataFlatPromisesServicePage onGoBack={() => this.setState({ page: undefined })} />,
})
}
/>
</View>
);
}
}