Skip to content

Commit fc4cfe4

Browse files
authored
Merge pull request #3797 from sivaprasath2004/sivaprasath-closes-issue-3754
[Feature]: Add React Native Course
2 parents d66257c + f51ec2f commit fc4cfe4

Some content is hidden

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

61 files changed

+4504
-0
lines changed

courses/React Native/Overview.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
---
2+
title: Welcome to Learning Path
3+
sidebar_label: Course Overview
4+
sidebar_position: 1
5+
description: React Native Course Outline.
6+
tags: [courses,React Native,Overview]
7+
---
8+
9+
### React Native Course OVerview
10+
#### Beginner Level
11+
12+
**1. Introduction to React Native**
13+
- What is React Native?
14+
- Setting up the development environment
15+
16+
**2. Basic Components and Layout**
17+
- Introduction to React Native components
18+
- Styling components using StyleSheet
19+
20+
**3. Handling User Input**
21+
- Working with TextInput
22+
- Using TouchableOpacity and TouchableHighlight
23+
24+
**4. Navigation**
25+
- Introduction to React Navigation
26+
- Passing parameters between screens
27+
28+
**5. State Management**
29+
- Introduction to state in React Native
30+
- Basic state management patterns
31+
32+
**6. Networking and Data Fetching**
33+
- Fetching data from APIs using fetch
34+
- Displaying data in lists (FlatList, SectionList)
35+
36+
**7. Platform-Specific Code**
37+
- Using platform-specific code (iOS vs. Android)
38+
- Handling different screen sizes and orientations
39+
40+
#### Intermediate Level
41+
42+
**1. Advanced Components and Styling**
43+
- Creating custom components
44+
- Using third-party libraries for styling
45+
46+
**2. Advanced Navigation**
47+
- Implementing nested navigators
48+
- Handling deep linking
49+
50+
**3. State Management Libraries**
51+
- Introduction to Redux
52+
- Using Redux Thunk for asynchronous actions
53+
54+
**4. Native Modules and APIs**
55+
- Introduction to native modules
56+
- Creating custom native modules
57+
58+
**5. Animation and Gestures**
59+
- Introduction to React Native Animations
60+
- Gesture handling with React Native Gesture Handler
61+
62+
**6. Working with External Libraries**
63+
- Integrating with third-party libraries (e.g., maps, charts)
64+
- Managing library dependencies and versions
65+
66+
#### Advanced Level
67+
68+
**1. Building and Deploying Apps**
69+
- Building and configuring for iOS and Android
70+
- Signing and publishing apps to App Store and Google Play
71+
- Handling app updates and versioning
72+
- Continuous Integration/Continuous Deployment (CI/CD)
73+
74+
**2. Advanced Native Integration**
75+
- Creating complex native modules
76+
- Interacting with platform-specific features (Bluetooth, NFC)
77+
- Using native libraries and SDKs (e.g., Firebase, Stripe)
78+
79+
**3. Offline Capabilities and Data Storage**
80+
- Implementing offline storage (AsyncStorage, SQLite)
81+
- Syncing data between offline and online modes
82+
- Handling background tasks and push notifications
83+
84+
**4. Managing App State**
85+
- Advanced state management with Redux or MobX
86+
- Handling app state changes (background/foreground)
87+

courses/React Native/_category_.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"label": "React Native",
3+
"position": 12,
4+
"link": {
5+
"type": "generated-index",
6+
"description": "Learn React Native."
7+
}
8+
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
id: lesson-3
3+
title: "Handling Background Tasks and Push Notifications"
4+
sidebar_label: Background Tasks and Push Notifications
5+
sidebar_position: 3
6+
description: "Learn Handling Background Tasks and Push Notifications"
7+
tags: [courses,Advance-level,Introduction]
8+
---
9+
10+
11+
**1.1. Background Tasks**
12+
13+
Background tasks enable you to perform operations like syncing data or fetching updates even when the app is not active.
14+
15+
**Using `react-native-background-fetch`:**
16+
17+
**Installation:**
18+
19+
```bash
20+
npm install react-native-background-fetch
21+
```
22+
23+
**Usage Example:**
24+
25+
```javascript
26+
import BackgroundFetch from 'react-native-background-fetch';
27+
28+
BackgroundFetch.configure(
29+
{
30+
minimumFetchInterval: 15, // Minutes
31+
stopOnTerminate: false, // Continue running in background
32+
},
33+
async () => {
34+
console.log('Background fetch event received');
35+
// Perform background tasks such as syncing data
36+
BackgroundFetch.finish();
37+
},
38+
error => {
39+
console.log('Background fetch failed', error);
40+
}
41+
);
42+
```
43+
44+
**1.2. Push Notifications**
45+
46+
Push notifications are used to alert users about important updates even when the app is not in the foreground.
47+
48+
**Using `react-native-push-notification`:**
49+
50+
**Installation:**
51+
52+
```bash
53+
npm install react-native-push-notification
54+
```
55+
56+
**Usage Example:**
57+
58+
```javascript
59+
import PushNotification from 'react-native-push-notification';
60+
61+
PushNotification.configure({
62+
onNotification: function (notification) {
63+
console.log('Notification:', notification);
64+
// Process the notification
65+
},
66+
requestPermissions: true,
67+
});
68+
69+
// Create a notification
70+
PushNotification.localNotification({
71+
title: 'My Notification',
72+
message: 'This is a test notification',
73+
});
74+
```
75+
76+
:::tip
77+
- **Offline Storage:** Use `AsyncStorage` for simple key-value storage and `SQLite` for more complex data needs.
78+
- **Data Syncing:** Implement an offline-first strategy with local storage and sync when connectivity is restored. Use network status monitoring and background tasks for reliable data syncing.
79+
- **Background Tasks and Push Notifications:** Use libraries to handle background tasks and push notifications to keep users informed and manage app updates efficiently.
80+
:::
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
---
2+
id: lesson-1
3+
title: "Offline Capabilities and Data Storage in React Native"
4+
sidebar_label: Implementing Offline Storage
5+
sidebar_position: 1
6+
description: "Learn Offline Capabilities and Data Storage in React Native"
7+
tags: [courses,Advance-level,Introduction]
8+
---
9+
10+
11+
Implementing offline capabilities and managing data storage are crucial for ensuring a seamless user experience in mobile applications. React Native provides several tools and libraries for handling offline storage, synchronizing data, and managing background tasks.
12+
13+
14+
#### 1. Implementing Offline Storage
15+
16+
**1.1. AsyncStorage**
17+
18+
`AsyncStorage` is a simple, key-value storage system that is often used for persisting small amounts of data.
19+
20+
**Installation:**
21+
22+
For React Native CLI:
23+
```bash
24+
npm install @react-native-async-storage/async-storage
25+
```
26+
27+
**Usage Example:**
28+
29+
```javascript
30+
import AsyncStorage from '@react-native-async-storage/async-storage';
31+
32+
// Save data
33+
const saveData = async () => {
34+
try {
35+
await AsyncStorage.setItem('@storage_Key', 'stored_value');
36+
} catch (e) {
37+
// saving error
38+
}
39+
};
40+
41+
// Retrieve data
42+
const getData = async () => {
43+
try {
44+
const value = await AsyncStorage.getItem('@storage_Key');
45+
if (value !== null) {
46+
console.log(value); // Display retrieved value
47+
}
48+
} catch (e) {
49+
// error reading value
50+
}
51+
};
52+
```
53+
54+
**1.2. SQLite**
55+
56+
SQLite is useful for more complex data storage needs and supports SQL queries.
57+
58+
**Installation:**
59+
60+
For React Native CLI:
61+
```bash
62+
npm install react-native-sqlite-storage
63+
```
64+
65+
**Usage Example:**
66+
67+
```javascript
68+
import SQLite from 'react-native-sqlite-storage';
69+
70+
// Open database
71+
const db = SQLite.openDatabase(
72+
{ name: 'my.db', location: 'default' },
73+
() => console.log('Database opened'),
74+
error => console.log('Error opening database: ', error)
75+
);
76+
77+
// Create a table
78+
db.transaction(tx => {
79+
tx.executeSql(
80+
'CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER)',
81+
[],
82+
() => console.log('Table created'),
83+
error => console.log('Error creating table: ', error)
84+
);
85+
});
86+
87+
// Insert data
88+
db.transaction(tx => {
89+
tx.executeSql(
90+
'INSERT INTO users (name, age) VALUES (?, ?)',
91+
['John Doe', 30],
92+
() => console.log('Data inserted'),
93+
error => console.log('Error inserting data: ', error)
94+
);
95+
});
96+
```
97+
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
id: lesson-2
3+
title: "Syncing Data Between Offline and Online Modes"
4+
sidebar_label: Syncing Data
5+
sidebar_position: 2
6+
description: "Learn Syncing Data Between Offline and Online Modes"
7+
tags: [courses,Advance-level,Introduction]
8+
---
9+
10+
11+
12+
**1.1. Offline-First Approach**
13+
14+
Design your application to work offline by default, and sync data when connectivity is restored.
15+
16+
**Example Workflow:**
17+
18+
1. **Store Changes Locally:** Save user actions and data changes in local storage.
19+
2. **Check Network Status:** Use libraries like `@react-native-community/netinfo` to detect network status.
20+
21+
```bash
22+
npm install @react-native-community/netinfo
23+
```
24+
25+
```javascript
26+
import NetInfo from '@react-native-community/netinfo';
27+
28+
NetInfo.addEventListener(state => {
29+
console.log('Connection type', state.type);
30+
console.log('Is connected?', state.isConnected);
31+
});
32+
```
33+
34+
3. **Sync Data:** When the app detects a network connection, send local changes to the server and update local storage with the server’s response.
35+
36+
```javascript
37+
const syncData = async () => {
38+
const isConnected = await NetInfo.fetch().then(state => state.isConnected);
39+
if (isConnected) {
40+
// Sync data with server
41+
// Example: POST local data to server
42+
}
43+
};
44+
```
45+
46+
**1.2. Background Sync**
47+
48+
Use libraries and services to handle background tasks for data synchronization.
49+
50+
**Example:**
51+
52+
**React Native Background Task:**
53+
54+
```bash
55+
npm install react-native-background-task
56+
```
57+
58+
```javascript
59+
import BackgroundTask from 'react-native-background-task';
60+
61+
BackgroundTask.define(() => {
62+
// Perform background task
63+
BackgroundTask.finish();
64+
});
65+
66+
BackgroundTask.schedule();
67+
```
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"label": "Offline Capabilities and Data Storage",
3+
"position": 3,
4+
"link": {
5+
"type": "generated-index",
6+
"description": "Learn Offline Capabilities and Data Storage."
7+
}
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"label": "Advanced Native Integration",
3+
"position": 2,
4+
"link": {
5+
"type": "generated-index",
6+
"description": "Learn Advanced Native Integration."
7+
}
8+
}

0 commit comments

Comments
 (0)