-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
54 lines (47 loc) · 1.24 KB
/
App.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* Generated with the TypeScript template
* https://github.com/react-native-community/react-native-template-typescript
*
* @format
*/
import React from 'react';
import {StatusBar, View, Button, SafeAreaView, Text} from 'react-native';
import {createOvermind} from 'overmind';
import {Provider} from 'overmind-react';
import {config, useOvermind} from './store';
const overmindConfig = createOvermind(config, {
devtools: true,
});
const Container = () => {
const {state, actions} = useOvermind();
return (
<SafeAreaView>
<Button
title="Turn on loading"
onPress={() => {
actions.toggleLoading(true);
}}
/>
<Button
title="Turn off loading"
onPress={() => {
actions.toggleLoading(false);
}}
/>
{state.loading && <Text>Loading...</Text>}
<Text>You should turn on Debug mode, and press either button to see the behavior</Text>
<Text>You can go to ./store/HttpUserRepo.ts folder to see reproduce code</Text>
</SafeAreaView>
);
};
const App = () => {
return (
<Provider value={overmindConfig}>
<Container />
</Provider>
);
};
export default App;