Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
nishkohli96 committed Sep 7, 2021
1 parent 9cad42f commit 8052656
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 297 deletions.
34 changes: 2 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,9 @@

**"An Ideal app-template to start your next `react-native` project."**

## Features
## Libraries Used

- Project code properly organized, and using `alias-imports`.
- Implemented Onboarding-screen.
- Stack, Tab and Drawer Navigation.
- Global state management using `mobx-react-lite`.
- Support for theme and language change.
- Added custom Google-font (Poppins).
- Added relevant links for easier & time-saving app development under the **Developer-Guide** section.

## Developer Guide

- To create react-native-app with custom package name, do a project-wide find and replace ```com.awesomeproject → com.mycompany.myapp``` Also in the `android` directory,
```src/main/java/com/awesomeproject → src/main/java/com/mycompany/myapp```

- Generate your app Icon using [MakeAppIcon](https://makeappicon.com/).Read More about app icon setup on this [Link](https://aboutreact.com/react-native-change-app-icon/).iOS icons can be generated using `Icon Set Creater` app available on the App Store. Make sure to also provide a round icon with the name `ic_launcher_round.png` in your android folder for various `mipmap-` directories.
Go to [easyappicon.com](https://easyappicon.com/).

- Import this statement at the topmost line of your root as per `react-navigation` docs.
```import 'react-native-gesture-handler';```

- Enable Hermes [link](https://reactnative.dev/docs/hermes)

- To make sure that the content doesn't overlap, especially in iPhones, use `SafeAreaProvider`. Import this stmt at the top of your app code.
```import { SafeAreaProvider } from 'react-native-safe-area-context';```

- Install [Async Storage](https://react-native-async-storage.github.io/async-storage/). Needs to be manually linked. Go to [this thread](https://stackoverflow.com/questions/61479644/invalid-podfile-file-unable-to-locate-the-executable-node) if `npx pod-install` fails to run.

- Dependencies for `@react-navigation/stack` -> `react-native-safe-area-context`, `react-native-gesture-handler`. Run `npx pod-install` after installing the dependencies.

- Using `react-native-reanimated` v-1.13.3 as v2 was not working fine.

- Manually link `react-native-vector-icons` in ios [link](https://medium.com/@vimniky/how-to-use-vector-icons-in-your-react-native-project-8212ac6a8f06). Check [this link](https://medium.com/@danielskripnik/how-to-add-and-remove-custom-fonts-in-react-native-b2830084b0e4) to add/remove fonts.
- [@react-native-community/clipboard](https://www.npmjs.com/package/@react-native-community/clipboard)

# Support Me

Expand Down
65 changes: 65 additions & 0 deletions app/screens/home/Home.ios.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import React from 'react';
import { View, TouchableOpacity, Pressable, StyleSheet } from 'react-native';
import { useTranslation } from 'react-i18next';
import Clipboard from '@react-native-community/clipboard';

import Header from '_Shared/Header';
import {
ThemedContainer,
Expand All @@ -10,6 +13,18 @@ import {

const App = () => {
const { t } = useTranslation('common');
const [pressText, setPressText] = React.useState('Press me');
const [copiedText, setCopiedText] = React.useState('');

const copyToClipboard = () => {
Clipboard.setString('this is a copied string');
};

const fetchCopiedText = async () => {
const text = await Clipboard.getString();
console.log('text: ', text);
setCopiedText(text);
};

return (
<ThemedContainer>
Expand All @@ -18,9 +33,59 @@ const App = () => {
<ThemedCard>
<ThemedText>Welcome to the HomeScreen !!!</ThemedText>
</ThemedCard>

<ThemedCard style={styles.copyCard}>
<ThemedText style={styles.headerText}>
Click The Appropriate Btn to see their functionality
</ThemedText>

<Pressable
onPressIn={() => setPressText('normal press')}
onPressOut={() => setPressText('Press Me')}
onLongPress={() => setPressText('On Long Press...')}>
<View style={styles.pressView}>
<ThemedText style={styles.pressedText}>
{pressText}
</ThemedText>
</View>
</Pressable>

<TouchableOpacity onPress={copyToClipboard}>
<View style={styles.pressView}>
<ThemedText>
Click here to copy to Clipboard
</ThemedText>
</View>
</TouchableOpacity>
<TouchableOpacity onPress={fetchCopiedText}>
<ThemedText>View copied text</ThemedText>
</TouchableOpacity>

<ThemedText>
{copiedText}
</ThemedText>
</ThemedCard>
</ThemedBody>
</ThemedContainer>
);
};

const styles = StyleSheet.create({
copyCard: { marginTop: 30 },
pressView: {
borderColor: 'grey',
padding: 10,
backgroundColor: 'silver',
marginTop: 10,
marginBottom: 10,
},
pressedText: {
color: 'red',
},
copiedText: {
marginTop: 10,
color: '#007aba',
},
});

export default App;
12 changes: 12 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,10 @@ PODS:
- React-perflogger (= 0.65.1)
- RNCAsyncStorage (1.15.7):
- React-Core
- RNCClipboard (1.5.1):
- React-Core
- RNCPicker (1.16.7):
- React-Core
- RNGestureHandler (1.10.3):
- React-Core
- RNReanimated (1.13.3):
Expand Down Expand Up @@ -432,6 +436,8 @@ DEPENDENCIES:
- React-runtimeexecutor (from `../node_modules/react-native/ReactCommon/runtimeexecutor`)
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- "RNCAsyncStorage (from `../node_modules/@react-native-async-storage/async-storage`)"
- "RNCClipboard (from `../node_modules/@react-native-community/clipboard`)"
- "RNCPicker (from `../node_modules/@react-native-picker/picker`)"
- RNGestureHandler (from `../node_modules/react-native-gesture-handler`)
- RNReanimated (from `../node_modules/react-native-reanimated`)
- RNScreens (from `../node_modules/react-native-screens`)
Expand Down Expand Up @@ -522,6 +528,10 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon"
RNCAsyncStorage:
:path: "../node_modules/@react-native-async-storage/async-storage"
RNCClipboard:
:path: "../node_modules/@react-native-community/clipboard"
RNCPicker:
:path: "../node_modules/@react-native-picker/picker"
RNGestureHandler:
:path: "../node_modules/react-native-gesture-handler"
RNReanimated:
Expand Down Expand Up @@ -581,6 +591,8 @@ SPEC CHECKSUMS:
React-runtimeexecutor: 85187f19dd9c47a7c102f9994f9d14e4dc2110de
ReactCommon: eafed38eec7b591c31751bfa7494801618460459
RNCAsyncStorage: 7102fe8985f889579a3ae148d957bbb3f308122b
RNCClipboard: 41d8d918092ae8e676f18adada19104fa3e68495
RNCPicker: 9865e85857650bbc553c660acc580ff86abd056a
RNGestureHandler: a479ebd5ed4221a810967000735517df0d2db211
RNReanimated: 514a11da3a2bcc6c3dfd9de32b38e2b9bf101926
RNScreens: eb0dfb2d6b21d2d7f980ad46b14eb306d2f1062e
Expand Down
14 changes: 1 addition & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
},
"dependencies": {
"@react-native-async-storage/async-storage": "^1.15.7",
"@react-native-community/clipboard": "^1.5.1",
"@react-native-community/netinfo": "^6.0.1",
"@react-native-picker/picker": "^1.16.7",
"@react-navigation/drawer": "^6.1.4",
Expand Down Expand Up @@ -49,24 +50,11 @@
"babel-jest": "^26.6.3",
"eslint": "7.14.0",
"eslint-plugin-react": "^7.25.1",
"husky": "^7.0.2",
"jest": "^26.6.3",
"lint-staged": "^11.1.2",
"metro-react-native-babel-preset": "^0.66.0",
"react-native-codegen": "^0.0.7",
"react-test-renderer": "17.0.2"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.js": [
"eslint --fix",
"prettier --write ."
]
},
"jest": {
"preset": "react-native"
}
Expand Down
Loading

0 comments on commit 8052656

Please sign in to comment.