-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
40 lines (37 loc) · 868 Bytes
/
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
import React from "react";
import { StyleSheet, View, Text } from "react-native";
import { NetworkProvider, NetworkConsumer } from "react-native-offline";
const App = () => {
return (
<View style={styles.container}>
<NetworkProvider shouldPing={true} pingInterval={100}>
<NetworkConsumer>
{({ isConnected }) =>
isConnected ? (
<Text style={styles.text}>hello</Text>
) : (
<Text> No Network</Text>
)
}
</NetworkConsumer>
</NetworkProvider>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
marginTop: 100,
padding: 20,
borderColor: "black",
height: 55,
alignItems: "center",
},
text: {
flex: 1,
fontSize: 24,
color: "black",
textAlign: "center",
},
});
export default App;