added simple websocket connection
This commit is contained in:
parent
35b7a51ede
commit
66ae1bd758
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user