Skip to content

Commit e80e28d

Browse files
committed
Initial Commit
0 parents  commit e80e28d

File tree

84 files changed

+23695
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+23695
-0
lines changed

.bundle/config

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
BUNDLE_PATH: "vendor/bundle"
2+
BUNDLE_FORCE_RUBY_PLATFORM: 1

.eslintrc.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
root: true,
3+
extends: '@react-native',
4+
};

.gitignore

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# OSX
2+
#
3+
.DS_Store
4+
5+
# Xcode
6+
#
7+
build/
8+
*.pbxuser
9+
!default.pbxuser
10+
*.mode1v3
11+
!default.mode1v3
12+
*.mode2v3
13+
!default.mode2v3
14+
*.perspectivev3
15+
!default.perspectivev3
16+
xcuserdata
17+
*.xccheckout
18+
*.moved-aside
19+
DerivedData
20+
*.hmap
21+
*.ipa
22+
*.xcuserstate
23+
ios/.xcode.env.local
24+
25+
# Android/IntelliJ
26+
#
27+
build/
28+
.idea
29+
.gradle
30+
local.properties
31+
*.iml
32+
*.hprof
33+
.cxx/
34+
*.keystore
35+
!debug.keystore
36+
37+
# node.js
38+
#
39+
node_modules/
40+
npm-debug.log
41+
yarn-error.log
42+
43+
# fastlane
44+
#
45+
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
46+
# screenshots whenever they are needed.
47+
# For more information about the recommended setup visit:
48+
# https://docs.fastlane.tools/best-practices/source-control/
49+
50+
**/fastlane/report.xml
51+
**/fastlane/Preview.html
52+
**/fastlane/screenshots
53+
**/fastlane/test_output
54+
55+
# Bundle artifact
56+
*.jsbundle
57+
58+
# Ruby / CocoaPods
59+
/ios/Pods/
60+
/vendor/bundle/
61+
62+
# Temporary files created by Metro to check the health of the file watcher
63+
.metro-health-check*
64+
65+
# testing
66+
/coverage

.prettierrc.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
arrowParens: 'avoid',
3+
bracketSameLine: true,
4+
bracketSpacing: false,
5+
singleQuote: true,
6+
trailingComma: 'all',
7+
};

.watchmanconfig

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

App.tsx

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
/**
2+
* Sample React Native App
3+
* https://github.com/facebook/react-native
4+
*
5+
* @format
6+
*/
7+
8+
import React, {
9+
useEffect,
10+
} from 'react';
11+
import {
12+
View,
13+
StatusBar
14+
} from 'react-native';
15+
16+
import "./src/api/index.ts";
17+
18+
import { Provider } from 'react-redux';
19+
20+
import Router from './src/router';
21+
22+
import socket from './src/socket/index.tsx';
23+
24+
import store from './src/store/index.ts';
25+
import {
26+
ADD_MESSAGE,
27+
ConversationType,
28+
MessageType,
29+
UPDATE_LAST_MESSAGE,
30+
UPDATE_MESSAGE
31+
} from './src/store/conversation/reducer.ts';
32+
import { UserType } from './src/store/user/reducer.ts';
33+
import { ADD_SEARCH_USERS } from './src/store/search/reducer.ts';
34+
35+
const App = (): JSX.Element => {
36+
37+
useEffect(() => {
38+
socket.on('connect', () => {
39+
console.log('Socket Connected!!!');
40+
});
41+
socket.on('disconnect', (data) => {
42+
console.log('Socket Disconnected!!!');
43+
});
44+
socket.io.on('reconnect_attempt', () => {
45+
console.log('reconnecting');
46+
});
47+
socket.on('room_joined', (data) => {
48+
console.log(`room_joined ${data}`);
49+
});
50+
socket.on('set_user_success', (data) => {
51+
console.log(`set_user_success ${JSON.stringify(data)}`);
52+
});
53+
socket.on('new_message', (data: MessageType) => {
54+
console.log(`new_message ${JSON.stringify(data)}`);
55+
store.dispatch(ADD_MESSAGE(data));
56+
});
57+
socket.on('new_message_error', (data: Object) => {
58+
console.error(`new_message_error ${JSON.stringify(data)}`);
59+
})
60+
socket.on('update_message', (data: MessageType) => {
61+
console.log(`update_message ${JSON.stringify(data)}`);
62+
});
63+
socket.on('see_message_success', (data: MessageType) => {
64+
console.log(`see_message_success ${JSON.stringify(data)}`);
65+
store.dispatch(UPDATE_MESSAGE(data));
66+
});
67+
socket.on('see_message_error', (data: Object) => {
68+
console.error(`see_message_error ${JSON.stringify(data)}`);
69+
});
70+
socket.on('new_conversation', (data: ConversationType) => {
71+
console.log(`new_conversation ${JSON.stringify(data)}`);
72+
});
73+
socket.on('new_conversation_error', (data: Object) => {
74+
console.error(`new_conversation_error ${JSON.stringify(data)}`);
75+
});
76+
socket.on('update_conversation', (data: ConversationType) => {
77+
console.log(`update_conversation ${JSON.stringify(data)}`);
78+
store.dispatch(UPDATE_LAST_MESSAGE(data.last_message));
79+
});
80+
socket.on('search_user', (data: Array<UserType>) => {
81+
console.log(`search_user fetched`);
82+
store.dispatch(ADD_SEARCH_USERS(data));
83+
});
84+
}, [false]);
85+
86+
return (
87+
<View style={{ flex: 1, backgroundColor: 'white' }}>
88+
<StatusBar
89+
translucent
90+
backgroundColor={'transparent'}
91+
barStyle={'dark-content'} />
92+
<Provider store={store}>
93+
<Router />
94+
</Provider>
95+
</View>
96+
);
97+
}
98+
99+
export default App;

Gemfile

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
source 'https://rubygems.org'
2+
3+
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
4+
ruby ">= 2.6.10"
5+
6+
gem 'cocoapods', '~> 1.12'

README.md

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
This is a new [**React Native**](https://reactnative.dev) project, bootstrapped using [`@react-native-community/cli`](https://github.com/react-native-community/cli).
2+
3+
# Getting Started
4+
5+
>**Note**: Make sure you have completed the [React Native - Environment Setup](https://reactnative.dev/docs/environment-setup) instructions till "Creating a new application" step, before proceeding.
6+
7+
## Step 1: Start the Metro Server
8+
9+
First, you will need to start **Metro**, the JavaScript _bundler_ that ships _with_ React Native.
10+
11+
To start Metro, run the following command from the _root_ of your React Native project:
12+
13+
```bash
14+
# using npm
15+
npm start
16+
17+
# OR using Yarn
18+
yarn start
19+
```
20+
21+
## Step 2: Start your Application
22+
23+
Let Metro Bundler run in its _own_ terminal. Open a _new_ terminal from the _root_ of your React Native project. Run the following command to start your _Android_ or _iOS_ app:
24+
25+
### For Android
26+
27+
```bash
28+
# using npm
29+
npm run android
30+
31+
# OR using Yarn
32+
yarn android
33+
```
34+
35+
### For iOS
36+
37+
```bash
38+
# using npm
39+
npm run ios
40+
41+
# OR using Yarn
42+
yarn ios
43+
```
44+
45+
If everything is set up _correctly_, you should see your new app running in your _Android Emulator_ or _iOS Simulator_ shortly provided you have set up your emulator/simulator correctly.
46+
47+
This is one way to run your app — you can also run it directly from within Android Studio and Xcode respectively.
48+
49+
## Step 3: Modifying your App
50+
51+
Now that you have successfully run the app, let's modify it.
52+
53+
1. Open `App.tsx` in your text editor of choice and edit some lines.
54+
2. For **Android**: Press the <kbd>R</kbd> key twice or select **"Reload"** from the **Developer Menu** (<kbd>Ctrl</kbd> + <kbd>M</kbd> (on Window and Linux) or <kbd>Cmd ⌘</kbd> + <kbd>M</kbd> (on macOS)) to see your changes!
55+
56+
For **iOS**: Hit <kbd>Cmd ⌘</kbd> + <kbd>R</kbd> in your iOS Simulator to reload the app and see your changes!
57+
58+
## Congratulations! :tada:
59+
60+
You've successfully run and modified your React Native App. :partying_face:
61+
62+
### Now what?
63+
64+
- If you want to add this new React Native code to an existing application, check out the [Integration guide](https://reactnative.dev/docs/integration-with-existing-apps).
65+
- If you're curious to learn more about React Native, check out the [Introduction to React Native](https://reactnative.dev/docs/getting-started).
66+
67+
# Troubleshooting
68+
69+
If you can't get this to work, see the [Troubleshooting](https://reactnative.dev/docs/troubleshooting) page.
70+
71+
# Learn More
72+
73+
To learn more about React Native, take a look at the following resources:
74+
75+
- [React Native Website](https://reactnative.dev) - learn more about React Native.
76+
- [Getting Started](https://reactnative.dev/docs/environment-setup) - an **overview** of React Native and how setup your environment.
77+
- [Learn the Basics](https://reactnative.dev/docs/getting-started) - a **guided tour** of the React Native **basics**.
78+
- [Blog](https://reactnative.dev/blog) - read the latest official React Native **Blog** posts.
79+
- [`@facebook/react-native`](https://github.com/facebook/react-native) - the Open Source; GitHub **repository** for React Native.

__tests__/App.test.tsx

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* @format
3+
*/
4+
5+
import 'react-native';
6+
import React from 'react';
7+
import App from '../App';
8+
9+
// Note: import explicitly to use the types shiped with jest.
10+
import {it} from '@jest/globals';
11+
12+
// Note: test renderer must be required after react-native.
13+
import renderer from 'react-test-renderer';
14+
15+
it('renders correctly', () => {
16+
renderer.create(<App />);
17+
});

0 commit comments

Comments
 (0)