├── example ├── .gitattributes ├── sync-local-package.sh ├── android │ ├── app │ │ ├── src │ │ │ ├── main │ │ │ │ ├── res │ │ │ │ │ ├── values │ │ │ │ │ │ ├── strings.xml │ │ │ │ │ │ ├── colors.xml │ │ │ │ │ │ └── styles.xml │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ └── drawable │ │ │ │ │ │ ├── splashscreen_image.png │ │ │ │ │ │ └── splashscreen.xml │ │ │ │ ├── java │ │ │ │ │ └── com │ │ │ │ │ │ └── example │ │ │ │ │ │ ├── generated │ │ │ │ │ │ └── BasePackageList.java │ │ │ │ │ │ ├── MainActivity.java │ │ │ │ │ │ └── MainApplication.java │ │ │ │ └── AndroidManifest.xml │ │ │ └── debug │ │ │ │ ├── AndroidManifest.xml │ │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── ReactNativeFlipper.java │ │ ├── proguard-rules.pro │ │ ├── build_defs.bzl │ │ ├── BUCK │ │ └── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── settings.gradle │ ├── build.gradle │ ├── gradle.properties │ ├── gradlew.bat │ └── gradlew ├── ios │ ├── example │ │ ├── Images.xcassets │ │ │ ├── Contents.json │ │ │ ├── SplashScreen.imageset │ │ │ │ ├── splashscreen.png │ │ │ │ └── Contents.json │ │ │ ├── SplashScreenBackground.imageset │ │ │ │ ├── background.png │ │ │ │ └── Contents.json │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── main.m │ │ ├── AppDelegate.h │ │ ├── Supporting │ │ │ └── Expo.plist │ │ ├── Info.plist │ │ ├── Base.lproj │ │ │ └── LaunchScreen.xib │ │ ├── AppDelegate.m │ │ └── SplashScreen.storyboard │ ├── example.xcworkspace │ │ └── contents.xcworkspacedata │ ├── Podfile │ ├── example.xcodeproj │ │ ├── xcshareddata │ │ │ └── xcschemes │ │ │ │ └── example.xcscheme │ │ └── project.pbxproj │ └── Podfile.lock ├── metro.config.js ├── .buckconfig ├── babel.config.js ├── README.md ├── app.json ├── index.js ├── package.json ├── .gitignore └── App.js ├── .github ├── docs-images │ ├── react-native-dialog-ios-alert.png │ ├── react-native-dialog-ios-input.png │ ├── react-native-dialog-android-alert.png │ └── react-native-dialog-android-input.png ├── ISSUE_TEMPLATE │ ├── QUESTION.md │ └── BUG_REPORT.md ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── test.yml │ └── release.yml ├── .gitignore ├── src ├── index.ts ├── useTheme.ts ├── Title.tsx ├── Description.tsx ├── Switch.tsx ├── Button.tsx ├── Input.tsx ├── CodeInput.tsx ├── Modal.tsx └── Container.tsx ├── .eslintrc ├── LICENSE.md ├── package.json ├── tsconfig.json ├── CHANGELOG.md └── README.md /example/.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /example/sync-local-package.sh: -------------------------------------------------------------------------------- 1 | rm -rf ./node_modules/react-native-dialog/lib 2 | cp -r ../lib ./node_modules/react-native-dialog/ -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | example 3 | 4 | -------------------------------------------------------------------------------- /example/ios/example/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /example/metro.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | transformer: { 3 | assetPlugins: ["expo-asset/tools/hashAssetFiles"], 4 | }, 5 | }; 6 | -------------------------------------------------------------------------------- /example/.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /example/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = function (api) { 2 | api.cache(true); 3 | return { 4 | presets: ["babel-preset-expo"], 5 | }; 6 | }; 7 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmazzarolo/react-native-dialog/HEAD/example/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /.github/docs-images/react-native-dialog-ios-alert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmazzarolo/react-native-dialog/HEAD/.github/docs-images/react-native-dialog-ios-alert.png -------------------------------------------------------------------------------- /.github/docs-images/react-native-dialog-ios-input.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmazzarolo/react-native-dialog/HEAD/.github/docs-images/react-native-dialog-ios-input.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Node.js 6 | node_modules/ 7 | npm-debug.log 8 | jsconfig.json 9 | dump.rdb 10 | .vscode 11 | .idea 12 | 13 | /lib 14 | -------------------------------------------------------------------------------- /.github/docs-images/react-native-dialog-android-alert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmazzarolo/react-native-dialog/HEAD/.github/docs-images/react-native-dialog-android-alert.png -------------------------------------------------------------------------------- /.github/docs-images/react-native-dialog-android-input.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmazzarolo/react-native-dialog/HEAD/.github/docs-images/react-native-dialog-android-input.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmazzarolo/react-native-dialog/HEAD/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmazzarolo/react-native-dialog/HEAD/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmazzarolo/react-native-dialog/HEAD/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmazzarolo/react-native-dialog/HEAD/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmazzarolo/react-native-dialog/HEAD/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/splashscreen_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmazzarolo/react-native-dialog/HEAD/example/android/app/src/main/res/drawable/splashscreen_image.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmazzarolo/react-native-dialog/HEAD/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmazzarolo/react-native-dialog/HEAD/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmazzarolo/react-native-dialog/HEAD/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmazzarolo/react-native-dialog/HEAD/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmazzarolo/react-native-dialog/HEAD/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/ios/example/Images.xcassets/SplashScreen.imageset/splashscreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmazzarolo/react-native-dialog/HEAD/example/ios/example/Images.xcassets/SplashScreen.imageset/splashscreen.png -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # Example 2 | 3 | An example project that can be used to develop `react-native-dialog`. 4 | To sync the changes made in `src`, you need to run `npm run sync` from this project (each time you make a change). 5 | -------------------------------------------------------------------------------- /example/ios/example/Images.xcassets/SplashScreenBackground.imageset/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmazzarolo/react-native-dialog/HEAD/example/ios/example/Images.xcassets/SplashScreenBackground.imageset/background.png -------------------------------------------------------------------------------- /example/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example", 3 | "displayName": "example", 4 | "expo": { 5 | "name": "example", 6 | "slug": "example", 7 | "version": "1.0.0", 8 | "assetBundlePatterns": [ 9 | "**/*" 10 | ] 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /example/ios/example/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char * argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | 11 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #FFFFFF 5 | 6 | -------------------------------------------------------------------------------- /example/ios/example.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/index.js: -------------------------------------------------------------------------------- 1 | import { registerRootComponent } from "expo"; 2 | 3 | import App from "./App"; 4 | 5 | // registerRootComponent calls AppRegistry.registerComponent('main', () => App); 6 | // It also ensures that whether you load the app in the Expo client or in a native build, 7 | // the environment is set up appropriately 8 | registerRootComponent(App); 9 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'example' 2 | 3 | apply from: '../node_modules/react-native-unimodules/gradle.groovy' 4 | includeUnimodulesProjects() 5 | 6 | apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); 7 | applyNativeModulesSettingsGradle(settings) 8 | 9 | include ':app' 10 | -------------------------------------------------------------------------------- /example/ios/example/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | #import 5 | 6 | #import 7 | 8 | @interface AppDelegate : UMAppDelegateWrapper 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/splashscreen.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/example/Supporting/Expo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | EXUpdatesSDKVersion 6 | YOUR-APP-SDK-VERSION-HERE 7 | EXUpdatesURL 8 | YOUR-APP-URL-HERE 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/ios/example/Images.xcassets/SplashScreen.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "idiom": "universal", 5 | "filename": "splashscreen.png", 6 | "scale": "1x" 7 | }, 8 | { 9 | "idiom": "universal", 10 | "scale": "2x" 11 | }, 12 | { 13 | "idiom": "universal", 14 | "scale": "3x" 15 | } 16 | ], 17 | "info": { 18 | "version": 1, 19 | "author": "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /example/ios/example/Images.xcassets/SplashScreenBackground.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "idiom": "universal", 5 | "filename": "background.png", 6 | "scale": "1x" 7 | }, 8 | { 9 | "idiom": "universal", 10 | "scale": "2x" 11 | }, 12 | { 13 | "idiom": "universal", 14 | "scale": "3x" 15 | } 16 | ], 17 | "info": { 18 | "version": 1, 19 | "author": "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/QUESTION.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 💬 Question 3 | about: Need a new feature? Have a quick question about the library? 4 | labels: "question" 5 | --- 6 | 7 | ## Ask your Question 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /example/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import DialogButton from "./Button"; 2 | import DialogContainer from "./Container"; 3 | import DialogDescription from "./Description"; 4 | import DialogInput from "./Input"; 5 | import DialogCodeInput from "./CodeInput"; 6 | import DialogSwitch from "./Switch"; 7 | import DialogTitle from "./Title"; 8 | 9 | export default { 10 | Button: DialogButton, 11 | Container: DialogContainer, 12 | Description: DialogDescription, 13 | Input: DialogInput, 14 | CodeInput: DialogCodeInput, 15 | Switch: DialogSwitch, 16 | Title: DialogTitle, 17 | }; 18 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/build_defs.bzl: -------------------------------------------------------------------------------- 1 | """Helper definitions to glob .aar and .jar targets""" 2 | 3 | def create_aar_targets(aarfiles): 4 | for aarfile in aarfiles: 5 | name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")] 6 | lib_deps.append(":" + name) 7 | android_prebuilt_aar( 8 | name = name, 9 | aar = aarfile, 10 | ) 11 | 12 | def create_jar_targets(jarfiles): 13 | for jarfile in jarfiles: 14 | name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")] 15 | lib_deps.append(":" + name) 16 | prebuilt_jar( 17 | name = name, 18 | binary_jar = jarfile, 19 | ) 20 | -------------------------------------------------------------------------------- /example/ios/Podfile: -------------------------------------------------------------------------------- 1 | require_relative '../node_modules/react-native/scripts/react_native_pods' 2 | require_relative '../node_modules/react-native-unimodules/cocoapods.rb' 3 | require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' 4 | 5 | platform :ios, '10.0' 6 | 7 | target 'example' do 8 | use_unimodules! 9 | config = use_native_modules! 10 | 11 | use_react_native!(:path => config["reactNativePath"]) 12 | 13 | # Enables Flipper. 14 | # 15 | # Note that if you have use_frameworks! enabled, Flipper will not work and 16 | # you should disable these next few lines. 17 | use_flipper! 18 | post_install do |installer| 19 | flipper_post_install(installer) 20 | end 21 | end -------------------------------------------------------------------------------- /src/useTheme.ts: -------------------------------------------------------------------------------- 1 | import { useMemo } from "react"; 2 | import { ColorSchemeName, StyleSheet, useColorScheme } from "react-native"; 3 | 4 | export type StyleBuilder = (isDark: boolean) => StyleSheet.NamedStyles; 5 | 6 | export interface UseTheme { 7 | theme: ColorSchemeName; 8 | isDark: boolean; 9 | styles: StyleSheet.NamedStyles; 10 | } 11 | 12 | const useTheme = (buildStyles: StyleBuilder): UseTheme => { 13 | const colorScheme = useColorScheme(); 14 | const isDark = colorScheme === "dark"; 15 | 16 | const styles = useMemo(() => { 17 | return buildStyles(isDark); 18 | }, [buildStyles, isDark]); 19 | 20 | return { theme: colorScheme, isDark, styles }; 21 | }; 22 | 23 | export default useTheme; 24 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | # Overview 2 | 3 | 4 | 5 | 6 | # Test Plan 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/ios/example/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "parser": "@typescript-eslint/parser", 4 | "parserOptions": { 5 | "ecmaVersion": 2017, 6 | "sourceType": "module", 7 | "ecmaFeatures": { 8 | "jsx": true 9 | } 10 | }, 11 | "plugins": [ 12 | "@typescript-eslint", 13 | "react-native" 14 | ], 15 | "extends": [ 16 | "plugin:react/recommended", 17 | "prettier/@typescript-eslint", 18 | "plugin:@typescript-eslint/eslint-recommended", 19 | "plugin:@typescript-eslint/recommended", 20 | "plugin:prettier/recommended" 21 | ], 22 | "settings": { 23 | "react": { 24 | "version": "detect" 25 | } 26 | }, 27 | "rules": { 28 | "@typescript-eslint/explicit-module-boundary-types": 0, 29 | "@typescript-eslint/no-explicit-any": 0, 30 | "react/prop-types": 0 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Build & Test 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - master 10 | 11 | jobs: 12 | test: 13 | runs-on: ubuntu-latest 14 | name: Build & Lint 15 | steps: 16 | - name: Checkout 17 | uses: actions/checkout@v2 18 | 19 | - name: Setup node 20 | uses: actions/setup-node@v1 21 | with: 22 | node-version: '12.x' 23 | 24 | - name: Restore ~/.npm cache 25 | uses: actions/cache@v2 26 | with: 27 | path: ~/.npm 28 | key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} 29 | restore-keys: | 30 | ${{ runner.os }}-node- 31 | 32 | - name: Install dependencies 33 | run: npm ci 34 | 35 | - name: Run build 36 | run: npm run build 37 | 38 | - name: Run lint 39 | run: npm run lint 40 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | jobs: 8 | release: 9 | name: Release 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Checkout 13 | uses: actions/checkout@v2 14 | 15 | - name: Setup node 16 | uses: actions/setup-node@v1 17 | with: 18 | node-version: '12.x' 19 | 20 | - name: Restore ~/.npm cache 21 | uses: actions/cache@v2 22 | with: 23 | path: ~/.npm 24 | key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} 25 | restore-keys: | 26 | ${{ runner.os }}-node- 27 | 28 | - name: Install dependencies 29 | run: npm ci 30 | 31 | - name: Build 32 | run: npm run build 33 | 34 | - name: Release 35 | env: 36 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 37 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }} 38 | run: npx semantic-release -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/BUG_REPORT.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 🐛 Report a bug 3 | about: Report a reproducible or regression bug. 4 | labels: "bug" 5 | --- 6 | 7 | ## Environment 8 | 9 | 10 | 11 | ## Platforms 12 | 13 | 14 | 15 | ## Versions 16 | 17 | 18 | 19 | - Android: 20 | - iOS: 21 | - react-native-dialog: 22 | - react-native: 23 | - react: 24 | 25 | ## Description 26 | 27 | 28 | 29 | ## Reproducible Demo 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/example/generated/BasePackageList.java: -------------------------------------------------------------------------------- 1 | package com.example.generated; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | import org.unimodules.core.interfaces.Package; 6 | 7 | public class BasePackageList { 8 | public List getPackageList() { 9 | return Arrays.asList( 10 | new expo.modules.constants.ConstantsPackage(), 11 | new expo.modules.errorrecovery.ErrorRecoveryPackage(), 12 | new expo.modules.filesystem.FileSystemPackage(), 13 | new expo.modules.font.FontLoaderPackage(), 14 | new expo.modules.imageloader.ImageLoaderPackage(), 15 | new expo.modules.keepawake.KeepAwakePackage(), 16 | new expo.modules.lineargradient.LinearGradientPackage(), 17 | new expo.modules.location.LocationPackage(), 18 | new expo.modules.permissions.PermissionsPackage(), 19 | new expo.modules.splashscreen.SplashScreenPackage(), 20 | new expo.modules.sqlite.SQLitePackage(), 21 | new expo.modules.updates.UpdatesPackage() 22 | ); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "index.js", 3 | "scripts": { 4 | "android": "react-native run-android", 5 | "ios": "react-native run-ios", 6 | "web": "expo start --web", 7 | "start": "react-native start", 8 | "test": "jest", 9 | "sync": "./sync-local-package.sh" 10 | }, 11 | "dependencies": { 12 | "expo": "~39.0.2", 13 | "expo-splash-screen": "~0.6.2", 14 | "expo-status-bar": "~1.0.2", 15 | "expo-updates": "~0.3.2", 16 | "react": "16.13.1", 17 | "react-dom": "16.13.1", 18 | "react-native": "~0.63.3", 19 | "react-native-dialog": "*", 20 | "react-native-gesture-handler": "~1.7.0", 21 | "react-native-reanimated": "~1.13.0", 22 | "react-native-screens": "~2.10.1", 23 | "react-native-unimodules": "~0.11.0", 24 | "react-native-web": "~0.13.12" 25 | }, 26 | "devDependencies": { 27 | "@babel/core": "~7.9.0", 28 | "babel-jest": "~25.2.6", 29 | "jest": "~25.2.6", 30 | "react-test-renderer": "~16.13.1" 31 | }, 32 | "jest": { 33 | "preset": "react-native" 34 | }, 35 | "private": true 36 | } 37 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | project.xcworkspace 24 | 25 | # Android/IntelliJ 26 | # 27 | build/ 28 | .idea 29 | .gradle 30 | local.properties 31 | *.iml 32 | 33 | # node.js 34 | # 35 | node_modules/ 36 | npm-debug.log 37 | yarn-error.log 38 | 39 | # BUCK 40 | buck-out/ 41 | \.buckd/ 42 | *.keystore 43 | 44 | # fastlane 45 | # 46 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 47 | # screenshots whenever they are needed. 48 | # For more information about the recommended setup visit: 49 | # https://docs.fastlane.tools/best-practices/source-control/ 50 | 51 | */fastlane/report.xml 52 | */fastlane/Preview.html 53 | */fastlane/screenshots 54 | 55 | # Bundle artifacts 56 | *.jsbundle 57 | 58 | # CocoaPods 59 | /ios/Pods/ 60 | 61 | # Expo 62 | .expo/* 63 | web-build/ 64 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 React Native Community 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext { 5 | buildToolsVersion = "29.0.2" 6 | minSdkVersion = 21 7 | compileSdkVersion = 29 8 | targetSdkVersion = 29 9 | } 10 | repositories { 11 | google() 12 | jcenter() 13 | } 14 | dependencies { 15 | classpath("com.android.tools.build:gradle:3.5.3") 16 | 17 | // NOTE: Do not place your application dependencies here; they belong 18 | // in the individual module build.gradle files 19 | } 20 | } 21 | 22 | allprojects { 23 | repositories { 24 | mavenLocal() 25 | maven { 26 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 27 | url("$rootDir/../node_modules/react-native/android") 28 | } 29 | maven { 30 | // Android JSC is installed from npm 31 | url("$rootDir/../node_modules/jsc-android/dist") 32 | } 33 | 34 | google() 35 | jcenter() 36 | maven { url 'https://www.jitpack.io' } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Title.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { 3 | Platform, 4 | StyleSheet, 5 | Text, 6 | PlatformColor, 7 | TextProps, 8 | } from "react-native"; 9 | import useTheme, { StyleBuilder } from "./useTheme"; 10 | 11 | export type DialogTitleProps = TextProps; 12 | 13 | const DialogTitle: React.FC = (props) => { 14 | const { style, children, ...nodeProps } = props; 15 | const { styles } = useTheme(buildStyles); 16 | 17 | return ( 18 | 19 | {children} 20 | 21 | ); 22 | }; 23 | 24 | DialogTitle.displayName = "DialogTitle"; 25 | 26 | const buildStyles: StyleBuilder = (isDark) => 27 | StyleSheet.create({ 28 | text: Platform.select({ 29 | ios: { 30 | color: PlatformColor("label"), 31 | textAlign: "center", 32 | fontSize: 18, 33 | fontWeight: "600", 34 | }, 35 | android: { 36 | color: PlatformColor( 37 | `@android:color/${ 38 | isDark ? "primary_text_dark" : "primary_text_light" 39 | }` 40 | ), 41 | fontWeight: "500", 42 | fontSize: 18, 43 | }, 44 | web: { 45 | fontWeight: "500", 46 | fontSize: 18, 47 | }, 48 | default: {}, 49 | }), 50 | }); 51 | 52 | export default DialogTitle; 53 | -------------------------------------------------------------------------------- /example/App.js: -------------------------------------------------------------------------------- 1 | import React, { useState } from "react"; 2 | import { Button, StyleSheet, View } from "react-native"; 3 | import Dialog from "react-native-dialog"; 4 | 5 | export default function App() { 6 | const [visible, setVisible] = useState(false); 7 | 8 | const showDialog = () => { 9 | setVisible(true); 10 | }; 11 | 12 | const handleCancel = () => { 13 | setVisible(false); 14 | }; 15 | 16 | const handleDelete = () => { 17 | // The user has pressed the "Delete" button, so here you can do your own logic. 18 | // ...Your logic 19 | setVisible(false); 20 | }; 21 | 22 | return ( 23 | 24 |