-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathtest-web.sh
executable file
·79 lines (67 loc) · 1.54 KB
/
test-web.sh
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
set -e
set -o pipefail
set -x
VERSION=beta
rm -rf react-native-web-demo
npx create-react-app react-native-web-demo
cd react-native-web-demo
npm install react-native-web @bugfender/rn-bugfender@${VERSION} @bugfender/sdk @bugfender/common
cat > src/App.js <<EOF
import React, {useState} from 'react';
import {
StyleSheet,
Text,
View,
Pressable,
useWindowDimensions,
} from 'react-native';
import {Bugfender, LogLevel} from '@bugfender/rn-bugfender';
// Init Bugfender with your APP key
Bugfender.init({
appKey: '$APP_KEY',
});
Bugfender.log('This is a debug log in Bugfender from React Native Web');
export default function App() {
const {height} = useWindowDimensions();
const [number, setNumber] = useState(0);
function handlePress() {
setNumber(parseInt(Math.random() * 10000, 10) % 100);
}
return (
<View style={[styles.container, {height}, StyleSheet.absoluteFill]}>
<Text>Random number: {number}</Text>
<View style={styles.br} />
<Pressable
style={({pressed}) => [
{
opacity: pressed ? 0.7 : 1,
},
styles.btn,
]}
onPress={handlePress}>
<Text style={styles.btnText}>Generate a number</Text>
</Pressable>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
br: {
height: 12,
},
btn: {
backgroundColor: '#222',
padding: 10,
},
btnText: {
color: '#fff',
},
});
EOF
npm start