Skip to content

Commit

Permalink
Added readme
Browse files Browse the repository at this point in the history
  • Loading branch information
TheZoraiz committed Mar 3, 2021
1 parent 7119fd7 commit 77a58ad
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 21 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ web-build/

# macOS
.DS_Store

/server
constants.js
22 changes: 6 additions & 16 deletions App.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import io from 'socket.io-client'
import Constants from 'expo-constants';
import Dialog from "react-native-dialog";

const Stuff = require('./constants.js');

export default class App extends React.Component {

Expand All @@ -22,11 +23,10 @@ export default class App extends React.Component {
}

componentDidMount() {
// this.socket = io('http://192.168.43.81:3000');
this.socket = io('https://chat-app1111.herokuapp.com/');
// this.socket = io(Stuff.localhost);
this.socket = io(Stuff.remoteServer);
this.socket.on('chatmessage', texts => {
// ts = texts;
console.log(texts);
this.setState({ messages: [...texts], message: this.state.message, id: this.state.id + 1, deviceTemp: this.state.deviceTemp, connections: this.state.connections})
});
this.socket.on('connections', connection => {
Expand All @@ -53,14 +53,12 @@ export default class App extends React.Component {
}

render() {
let chatMsgs = this.state.messages.map(msg => (
<View style={styles.panel}>
let chatMsgs = this.state.messages.map((msg, key) => (
<View style={styles.panel} key={key}>
<Text style={styles.clients}>{msg.name + ':'}</Text>
<Text key={this.state.id} style={styles.messages}>{msg.message}</Text>
</View>));

console.log(this.state.messages);

return (
<View style={styles.container}>

Expand All @@ -72,14 +70,6 @@ export default class App extends React.Component {
></Dialog.Input>
<Dialog.Button label="Submit" onPress={() => {
if(this.state.username.length != 0)
Alert.alert(
'From Zoraiz:',
'Hello Guys. I set a remote server to record the messages for the app but it looks like that server can restart on its own haha. So please, don\'t trust the app to keep your record. I\'m really sorry :(',
[
{ text: 'OK Sempai', onPress: () => console.log('OK Pressed') }
],
{ cancelable: false }
);
this.setState( { visible: false } );
}}/>
</Dialog.Container>
Expand All @@ -104,7 +94,7 @@ export default class App extends React.Component {
onSubmitEditing={this.submitMessage}
onChangeText={this.changeMsg}
/>
{/* <StatusBar style="auto" /> */}
<StatusBar style='dark'/>
</View>
);
}
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# The Z Room

An android chatting app created with React Native.

The code for the backend end is available here: https://github.com/TheZoraiz/The-Z-Room-Backend
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-39.0.4.tar.gz",
"react-native-dialog": "^6.1.2",
"react-native-dialog": "^6.2.0",
"react-native-gesture-handler": "~1.7.0",
"react-native-reanimated": "~1.13.0",
"react-native-safe-area-context": "3.1.4",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4675,10 +4675,10 @@ react-is@^16.12.0, react-is@^16.13.0, react-is@^16.7.0, react-is@^16.8.1, react-
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==

react-native-dialog@^6.1.2:
version "6.1.2"
resolved "https://registry.yarnpkg.com/react-native-dialog/-/react-native-dialog-6.1.2.tgz#ddf261b85426fa77c91095b516e5dedd8f0c5c4b"
integrity sha512-9d/GDoCYAaEbiJZY832pw4z+c0SrFzbMT+aIBnSRqc122cIo+Sub2yE8ermj12vS+A0/898RSQIn0x7CnGnzMw==
react-native-dialog@^6.2.0:
version "6.2.0"
resolved "https://registry.yarnpkg.com/react-native-dialog/-/react-native-dialog-6.2.0.tgz#d84123d6b5a3485891ffd6db9f571502f76f84cb"
integrity sha512-J16bhTGTDTQYFtWbfKIMD5GM4QFIupNm3hFjm7/X/VZ1ZeOsiTKTRt/JGeX6QPTAOhRiN1A+IPIfXPzgUmhUVw==
dependencies:
prop-types "^15.7.2"

Expand Down

0 comments on commit 77a58ad

Please sign in to comment.