-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
33 lines (30 loc) · 808 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
import * as ExpoAndroidShell from "expo-android-shell";
import { Button, StyleSheet, View } from "react-native";
export default function App() {
return (
<View style={styles.container}>
<Button
title="Run shell command synchronously"
onPress={() => {
const output = ExpoAndroidShell.execCommand("whoami");
console.log(output);
}}
/>
<Button
title="Run shell command on a separate native thread"
onPress={async () => {
const output = await ExpoAndroidShell.execCommandAsync("whoami");
console.log(output);
}}
/>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
alignItems: "center",
justifyContent: "center",
},
});