first commit
This commit is contained in:
38
App.js
Normal file
38
App.js
Normal file
@@ -0,0 +1,38 @@
|
||||
import React from 'react';
|
||||
import { TouchableWithoutFeedback, View, Text, Alert } from 'react-native';
|
||||
|
||||
const MyButton = () => {
|
||||
const handleLongPress = () => {
|
||||
// Obsługa przytrzymania guzika
|
||||
Alert.alert('Button Long Pressed', 'You long pressed the button');
|
||||
};
|
||||
|
||||
const handlePress = () => {
|
||||
// Obsługa zwykłego kliknięcia guzika
|
||||
fetch('https://wol.turtel.xyz/wolweb/wake/pajonk')
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error('Network response was not ok');
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then(data => {
|
||||
console.log(data);
|
||||
Alert.alert('Response', JSON.stringify(data));
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('There was a problem with the fetch operation:', error);
|
||||
Alert.alert('Error', 'There was a problem with the request');
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<TouchableWithoutFeedback onPress={handlePress} onLongPress={handleLongPress}>
|
||||
<View style={{ padding: 10, backgroundColor: 'blue', borderRadius: 5 }}>
|
||||
<Text style={{ color: 'white' }}>Send Request</Text>
|
||||
</View>
|
||||
</TouchableWithoutFeedback>
|
||||
);
|
||||
};
|
||||
|
||||
export default MyButton;
|
||||
Reference in New Issue
Block a user