diff --git a/README.md b/README.md index d6c6b0d..07054d2 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # react-native-alert-notification +Forked from [text](https://github.com/CodingByJerez/react-native-alert-notification) +CodingByJerez no longer maintenance + ## Example Dialog Box | Theme Light | Theme Dark | diff --git a/bun.lockb b/bun.lockb new file mode 100755 index 0000000..0d4dc68 Binary files /dev/null and b/bun.lockb differ diff --git a/example/src/Page.tsx b/example/src/Page.tsx index d332f37..a51745a 100644 --- a/example/src/Page.tsx +++ b/example/src/Page.tsx @@ -47,6 +47,17 @@ const DATA = [ textBody: _textBody('danger'), }), }, + { + title: 'info', + onPress: () => + Dialog.show({ + type: ALERT_TYPE.INFO, + title: 'info', + button: 'no', + confirmButton: 'yes', + textBody: _textBody('info'), + }), + }, { title: 'no button', onPress: () => diff --git a/package.json b/package.json index fee0ecb..f86c06d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "react-native-alert-notification", - "version": "0.4.0", + "name": "@sokunsamnang/react-native-alert-notification", + "version": "1.0.0", "license": "MIT", "description": "Toast notification and dialog box notification for react native", "main": "lib/commonjs/index", @@ -28,7 +28,7 @@ "lint": "eslint \"**/*.{js,ts,tsx}\"", "prepare": "bob build", "commit": "git-cz", - "release": "release-it", + "release": "qrelease-it", "example": "yarn --cwd example", "pods": "cd example && pod-install --quiet", "bootstrap": "yarn example && yarn && yarn pods" @@ -45,15 +45,15 @@ "dialog", "modal" ], - "author": "Rodolphe Jerez (github.com/codingbyjerez)", + "author": "Sam Allen (github.com/sokunsamnang)", "repository": { "type": "git", - "url": "https://github.com/CodingByJerez/react-native-alert-notification" + "url": "https://github.com/sokunsamnang/react-native-alert-notification" }, "bugs": { - "url": "https://github.com/CodingByJerez/react-native-alert-notification/issues" + "url": "https://github.com/sokunsamnang/react-native-alert-notification/issues" }, - "homepage": "https://github.com/CodingByJerez/react-native-alert-notification#readme", + "homepage": "https://github.com/sokunsamnang/react-native-alert-notification#readme", "publishConfig": { "registry": "https://registry.npmjs.org/" }, @@ -169,5 +169,6 @@ } ] ] - } + }, + "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" } diff --git a/src/containers/Dialog.tsx b/src/containers/Dialog.tsx index a6afe15..e62e466 100644 --- a/src/containers/Dialog.tsx +++ b/src/containers/Dialog.tsx @@ -8,9 +8,11 @@ export type IConfigDialog = { title?: string; textBody?: string; button?: string; + confirmButton?: string; autoClose?: number | boolean; closeOnOverlayTap?: boolean; onPressButton?: () => void; + onConfirmPressButton?: () => void; onShow?: () => void; onHide?: () => void; }; @@ -178,15 +180,22 @@ export class Dialog extends React.Component { */ private _buttonRender = (): JSX.Element => { const { styles } = this.state; - const { type, onPressButton, button } = this.state.config!; - if (button) { - return ( - - {button} - - ); - } - return <>; + const { type, onPressButton, button, onConfirmPressButton, confirmButton } = this.state.config!; + + return ( + + {button && ( + + {button} + + )} + {confirmButton && ( + + {confirmButton} + + )} + + ); }; /** @@ -287,6 +296,10 @@ const __styles = (isDark: boolean) => textAlign: 'center', color: Color.get('label', isDark), }, + containerButton: { + flexDirection: 'row', + justifyContent: 'space-evenly', + }, button: { borderRadius: 50, height: 40, diff --git a/tsconfig.json b/tsconfig.json index b5bde70..f0930b0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -22,6 +22,6 @@ "resolveJsonModule": true, "skipLibCheck": true, "strict": true, - "target": "esnext", + "target": "esnext" } }