Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ngocle2497 committed Oct 1, 2021
1 parent 10ea996 commit b9fee70
Show file tree
Hide file tree
Showing 5 changed files with 128 additions and 6 deletions.
123 changes: 123 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- Consistent with the default React Native template
- Minimal additional dependencies
- Lots of built-in components
- Native modules

## :arrow_forward: Usage

Expand All @@ -19,6 +20,128 @@ npx rn-boiler MyApp

<h3>Preview</h3>
<img src="./preview.gif">
## Native module

```
import {<function_name>} from "@common"
```

- getVersion : Get app version

```tsx
const version = getVersion();
```

- getAppName : Get app name

```tsx
const appName = getAppName();
```

- getDeviceId : Get device id

```tsx
const deviceId = getDeviceId();
```

- getBuildNumber : Get build number

```tsx
const buildNumber = getBuildNumber();
```

- setAppBadges : Set app badges (IOS)

```tsx
const countBadges = 10; // 0 to clear
setAppBadges(countBadges);
```

- clearNotification : Clear notification on notification center

```tsx
clearNotification();
```

- clearCache : Clear cache folder

```tsx
clearCache();
```

- checkChannelExist : Check channel Exist (Android)

```tsx
const exist: boolean = await checkChannelExist(channelId);
```

- deleteChannel : Delete channel (Android)

```tsx
deleteChannel();
```

- createChannel : Create channel (Android)

```tsx
type Channel = {
channelId: string;
channelName: string;
channelDescription?: string;
playSound?: boolean;
soundName?: string; // "default"
importance?: "DEFAULT" | "HIGH" | "MAX" | "LOW" | "MIN" | "NONE" | "UNSPECIFIED" | undefined; // default HIGH
vibrate?: boolean;
};
createChannel(channel: Channel);
```

- fixRotation : Fix image rotate when upload

```tsx
type Image = {
uri: string;
width?: number;// default 600
height?: number;// default 800
};
type ImageResponse = {
uri: string;
name: string;
};
const fixedImage = await fixRotation(image: Image);
```

- registerPhotosChanges : Register photos changes (IOS) (1)

```tsx
registerPhotosChanges();
```

- usePhotosPermissionChange : Hook to check photos permission changes (IOS). ex: Photo selected changes when ask permission (1)

```tsx
usePhotosPermissionChange(() => {
console.log("Changed");
});
```

>(1): Open AppModule.swift, uncomment code to use 2 function

## Library

- [react-navigation-v6](https://reactnavigation.org)
- [axios](https://axios-http.com)
- [react-hook-form](https://www.react-hook-form.com)
- [yup](https://github.com/jquense/yup)
- [react-native-bootsplash](https://github.com/zoontek/react-native-bootsplash)
- [react-native-reanimated-v2](https://github.com/software-mansion/react-native-reanimated#readme)
- [redux](http://redux.js.org)
- [redux-saga](https://redux-saga.js.org/)
- [react-native-fast-image](https://github.com/DylanVann/react-native-fast-image#readme)
- [react-native-sensitive-info](https://mcodex.dev/react-native-sensitive-info/)
- [react-fast-compare](https://github.com/FormidableLabs/react-fast-compare)

... and more

## :bookmark: License

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rn-boiler-template",
"version": "1.64.53",
"version": "1.64.54",
"description": "Clean and minimalist React Native template for a quick start with TypeScript and components",
"scripts": {
"test": "exit 0"
Expand Down
2 changes: 0 additions & 2 deletions template/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.helloworld">

<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.INTERNET" />

<application
Expand Down
5 changes: 3 additions & 2 deletions template/ios/AppModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ import UIKit
import Photos

@objc(AppModule)
// PHPhotoLibraryChangeObserver
// Use this to listen photo change
// class AppModule: RCTEventEmitter, PHPhotoLibraryChangeObserver
class AppModule: RCTEventEmitter {
private static var DefaultStringReturnType: String = "Unknown";
private var PhotoChangeEvent: String = "PhotosChange"

override func supportedEvents() -> [String]! {
return []
}

// Sent event when photos change
// func photoLibraryDidChange(_ changeInstance: PHChange) {
// sendEvent(withName: PhotoChangeEvent, body: nil)
// }
Expand Down
2 changes: 1 addition & 1 deletion template/src/app/common/nativeModule/AppModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const setAppBadges = (count: number) => {
if (typeof count !== 'number' || !isIos) {
return;
}
return AppModule.setBadges(count);
AppModule.setBadges(count);
};
export const clearNotification = () => {
AppModule.clearNotification();
Expand Down

0 comments on commit b9fee70

Please sign in to comment.