From 6974d6cea3c93c267691514ca43952e2e3405cfc Mon Sep 17 00:00:00 2001 From: "rvenky@125" Date: Thu, 15 Jun 2023 13:02:09 +0530 Subject: [PATCH] first commit --- .bundle/config | 2 + .eslintrc.js | 4 ++ .github/workflows/npm-publish.yml | 33 ++++++++++ .gitignore | 63 ++++++++++++++++++ .node-version | 1 + .npmignore | 12 ++++ .prettierrc.js | 7 ++ AlertProvider.js | 21 ++++++ App.js | 47 ++++++++++++++ AsyncAlert.js | 78 ++++++++++++++++++++++ DefAlert.js | 103 ++++++++++++++++++++++++++++++ Gemfile | 6 ++ LICENSE.md | 21 ++++++ Spacing.js | 8 +++ __tests__/App-test.tsx | 14 ++++ app.json | 4 ++ babel.config.js | 3 + index.js | 5 ++ package.json | 28 ++++++++ 19 files changed, 460 insertions(+) create mode 100644 .bundle/config create mode 100644 .eslintrc.js create mode 100644 .github/workflows/npm-publish.yml create mode 100644 .gitignore create mode 100644 .node-version create mode 100644 .npmignore create mode 100644 .prettierrc.js create mode 100644 AlertProvider.js create mode 100644 App.js create mode 100644 AsyncAlert.js create mode 100644 DefAlert.js create mode 100644 Gemfile create mode 100644 LICENSE.md create mode 100644 Spacing.js create mode 100644 __tests__/App-test.tsx create mode 100644 app.json create mode 100644 babel.config.js create mode 100644 index.js create mode 100644 package.json diff --git a/.bundle/config b/.bundle/config new file mode 100644 index 0000000..848943b --- /dev/null +++ b/.bundle/config @@ -0,0 +1,2 @@ +BUNDLE_PATH: "vendor/bundle" +BUNDLE_FORCE_RUBY_PLATFORM: 1 diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..40c6dcd --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,4 @@ +module.exports = { + root: true, + extends: '@react-native-community', +}; diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml new file mode 100644 index 0000000..6cdebaf --- /dev/null +++ b/.github/workflows/npm-publish.yml @@ -0,0 +1,33 @@ +# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created +# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages + +name: Node.js Package + +on: + release: + types: [created] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + - run: npm ci + - run: npm test + + publish-npm: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + registry-url: https://registry.npmjs.org/ + - run: npm ci + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.npm_token}} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..16f8c30 --- /dev/null +++ b/.gitignore @@ -0,0 +1,63 @@ +# OSX +# +.DS_Store + +# Xcode +# +build/ +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata +*.xccheckout +*.moved-aside +DerivedData +*.hmap +*.ipa +*.xcuserstate +ios/.xcode.env.local + +# Android/IntelliJ +# +build/ +.idea +.gradle +local.properties +*.iml +*.hprof +.cxx/ +*.keystore +!debug.keystore + +# node.js +# +node_modules/ +npm-debug.log +yarn-error.log + +# fastlane +# +# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the +# screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://docs.fastlane.tools/best-practices/source-control/ + +**/fastlane/report.xml +**/fastlane/Preview.html +**/fastlane/screenshots +**/fastlane/test_output + +# Bundle artifact +*.jsbundle + +# Ruby / CocoaPods +/ios/Pods/ +/vendor/bundle/ + +# Temporary files created by Metro to check the health of the file watcher +.metro-health-check* diff --git a/.node-version b/.node-version new file mode 100644 index 0000000..3c03207 --- /dev/null +++ b/.node-version @@ -0,0 +1 @@ +18 diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..0fdb134 --- /dev/null +++ b/.npmignore @@ -0,0 +1,12 @@ +# Logs +*.log +npm-debug.log + +# Dependency directory +node_modules + +# Runtime data +tmp + +# Examples (If applicable to your project) +examples \ No newline at end of file diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 0000000..2b54074 --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,7 @@ +module.exports = { + arrowParens: 'avoid', + bracketSameLine: true, + bracketSpacing: false, + singleQuote: true, + trailingComma: 'all', +}; diff --git a/AlertProvider.js b/AlertProvider.js new file mode 100644 index 0000000..a8c0e9f --- /dev/null +++ b/AlertProvider.js @@ -0,0 +1,21 @@ +import React, {createContext, useContext} from 'react'; +import useAlert from './AsyncAlert'; + +const AlertContext = createContext(); + +export const useShowAlert = () => useContext(AlertContext); + +const AlertProvider = ({children, Alert}) => { + const {showAlert, AlertComp} = useAlert({ + AlertComponent: Alert + }); + + return ( + + {children} + + + ); +}; + +export default AlertProvider; diff --git a/App.js b/App.js new file mode 100644 index 0000000..c1e73e8 --- /dev/null +++ b/App.js @@ -0,0 +1,47 @@ +import React from 'react'; +import {Button, StyleSheet} from 'react-native'; +import AlertProvider, {useShowAlert} from './AlertProvider'; + +function App() { + const showAlert = useShowAlert(); + return ( +