added simple websocket connection
This commit is contained in:
parent
35b7a51ede
commit
66ae1bd758
@ -7,18 +7,24 @@ import {
|
|||||||
View,
|
View,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
|
|
||||||
|
const ws = new WebSocket('ws://192.168.1.109:8069/ws');
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
text: string;
|
text: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function DeckButton(props: Props) {
|
export default function DeckButton(props: Props) {
|
||||||
|
function pressed() {
|
||||||
|
ws.send(props.text);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<View style={style.view}>
|
<View style={style.view}>
|
||||||
<TouchableHighlight
|
<TouchableHighlight
|
||||||
style={style.touchable}
|
style={style.touchable}
|
||||||
underlayColor={'#0e86d4'}
|
underlayColor={'#0e86d4'}
|
||||||
onPress={() => console.log(props.text)}
|
onPress={pressed}
|
||||||
onLongPress={() => console.log('long press')}>
|
onLongPress={() => console.log('long press')}>
|
||||||
<Text style={style.text}>{props.text}</Text>
|
<Text style={style.text}>{props.text}</Text>
|
||||||
</TouchableHighlight>
|
</TouchableHighlight>
|
||||||
|
Loading…
Reference in New Issue
Block a user