added simple websocket connection

This commit is contained in:
Niklas 2021-01-23 01:43:25 +01:00
parent 35b7a51ede
commit 66ae1bd758

View File

@ -7,18 +7,24 @@ import {
View,
} from 'react-native';
const ws = new WebSocket('ws://192.168.1.109:8069/ws');
interface Props {
text: string;
}
export default function DeckButton(props: Props) {
function pressed() {
ws.send(props.text);
}
return (
<>
<View style={style.view}>
<TouchableHighlight
style={style.touchable}
underlayColor={'#0e86d4'}
onPress={() => console.log(props.text)}
onPress={pressed}
onLongPress={() => console.log('long press')}>
<Text style={style.text}>{props.text}</Text>
</TouchableHighlight>