-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.tsx
More file actions
51 lines (45 loc) · 1.23 KB
/
App.tsx
File metadata and controls
51 lines (45 loc) · 1.23 KB
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
import { useEffect } from 'react';
import { StatusBar } from 'expo-status-bar';
import { StyleSheet, Text, View } from 'react-native';
import { createWorkletRuntime, scheduleOnRuntime } from 'react-native-worklets';
function testWorkletFetch() {
const fetchRuntime = createWorkletRuntime({ name: 'fetchRuntime' });
scheduleOnRuntime(fetchRuntime, () => {
'worklet';
console.log('[Worklet Fetch] Starting fetch test...');
fetch('https://jsonplaceholder.typicode.com/todos/1', {
method: 'GET',
})
.then((data) => {
console.log('[Worklet Fetch] Success:', data);
})
.catch((error) => {
console.error('[Worklet Fetch] Error:', error.message);
});
});
}
export default function App() {
useEffect(() => {
testWorkletFetch();
}, []);
return (
<View style={styles.container}>
<Text>Testing Worklet Fetch</Text>
<Text style={styles.subtitle}>Check console for logs (or crash)</Text>
<StatusBar style="auto" />
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
subtitle: {
marginTop: 8,
fontSize: 12,
color: '#666',
},
});