├── .eslintrc ├── .gitignore ├── .vscode └── settings.json ├── Example ├── .buckconfig ├── .editorconfig ├── .eslintrc.js ├── .flowconfig ├── .gitattributes ├── .gitignore ├── .prettierrc.js ├── .watchmanconfig ├── App.js ├── __tests__ │ └── App-test.js ├── android │ ├── app │ │ ├── BUCK │ │ ├── build.gradle │ │ ├── build_defs.bzl │ │ ├── debug.keystore │ │ ├── proguard-rules.pro │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── example │ │ │ │ ├── MainActivity.java │ │ │ │ └── MainApplication.java │ │ │ └── res │ │ │ ├── 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 │ │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle ├── app.json ├── babel.config.js ├── index.js ├── ios │ ├── Example.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Example.xcscheme │ ├── Example.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ ├── Example │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Images.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ │ └── Contents.json │ │ ├── Info.plist │ │ ├── LaunchScreen.storyboard │ │ └── main.m │ └── Podfile ├── metro.config.js └── package.json ├── LICENSE ├── README.md ├── android ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── ui │ └── toasty │ ├── RNToastyModule.java │ └── RNToastyPackage.java ├── index.d.ts ├── ios ├── RNToasty.h ├── RNToasty.m ├── RNToasty.podspec ├── RNToasty.xcodeproj │ └── project.pbxproj └── RNToasty.xcworkspace │ └── contents.xcworkspacedata ├── js ├── RNToasty.js └── RNVectorHelper.js └── package.json /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": ["prettier"], 3 | "rules": { 4 | "prettier/prettier": "error" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # OSX 3 | # 4 | .DS_Store 5 | 6 | # node.js 7 | # 8 | node_modules/ 9 | npm-debug.log 10 | yarn-error.log 11 | 12 | 13 | # Xcode 14 | # 15 | build/ 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | xcuserdata 25 | *.xccheckout 26 | *.moved-aside 27 | DerivedData 28 | *.hmap 29 | *.ipa 30 | *.xcuserstate 31 | project.xcworkspace 32 | 33 | 34 | # Android/IntelliJ 35 | # 36 | build/ 37 | .idea 38 | .gradle 39 | local.properties 40 | *.iml 41 | 42 | # BUCK 43 | buck-out/ 44 | \.buckd/ 45 | *.keystore 46 | 47 | .history/* -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.formatOnSave": true, 3 | "prettier.eslintIntegration": true, 4 | "prettier.singleQuote": true, 5 | "prettier.semi": false, 6 | "prettier.bracketSpacing": true 7 | } -------------------------------------------------------------------------------- /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/.editorconfig: -------------------------------------------------------------------------------- 1 | # Windows files 2 | [*.bat] 3 | end_of_line = crlf 4 | -------------------------------------------------------------------------------- /Example/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | extends: '@react-native-community', 4 | }; 5 | -------------------------------------------------------------------------------- /Example/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | ; We fork some components by platform 3 | .*/*[.]android.js 4 | 5 | ; Ignore "BUCK" generated dirs 6 | /\.buckd/ 7 | 8 | ; Ignore polyfills 9 | node_modules/react-native/Libraries/polyfills/.* 10 | 11 | ; Flow doesn't support platforms 12 | .*/Libraries/Utilities/LoadingView.js 13 | 14 | [untyped] 15 | .*/node_modules/@react-native-community/cli/.*/.* 16 | 17 | [include] 18 | 19 | [libs] 20 | node_modules/react-native/interface.js 21 | node_modules/react-native/flow/ 22 | 23 | [options] 24 | emoji=true 25 | 26 | esproposal.optional_chaining=enable 27 | esproposal.nullish_coalescing=enable 28 | 29 | exact_by_default=true 30 | 31 | module.file_ext=.js 32 | module.file_ext=.json 33 | module.file_ext=.ios.js 34 | 35 | munge_underscores=true 36 | 37 | module.name_mapper='^react-native/\(.*\)$' -> '/node_modules/react-native/\1' 38 | module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '/node_modules/react-native/Libraries/Image/RelativeImageStub' 39 | 40 | suppress_type=$FlowIssue 41 | suppress_type=$FlowFixMe 42 | suppress_type=$FlowFixMeProps 43 | suppress_type=$FlowFixMeState 44 | 45 | [lints] 46 | sketchy-null-number=warn 47 | sketchy-null-mixed=warn 48 | sketchy-number=warn 49 | untyped-type-import=warn 50 | nonstrict-import=warn 51 | deprecated-type=warn 52 | unsafe-getters-setters=warn 53 | unnecessary-invariant=warn 54 | signature-verification-failure=warn 55 | 56 | [strict] 57 | deprecated-type 58 | nonstrict-import 59 | sketchy-null 60 | unclear-type 61 | unsafe-getters-setters 62 | untyped-import 63 | untyped-type-import 64 | 65 | [version] 66 | ^0.137.0 67 | -------------------------------------------------------------------------------- /Example/.gitattributes: -------------------------------------------------------------------------------- 1 | # Windows files should use crlf line endings 2 | # https://help.github.com/articles/dealing-with-line-endings/ 3 | *.bat text eol=crlf 4 | -------------------------------------------------------------------------------- /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 | 24 | # Android/IntelliJ 25 | # 26 | build/ 27 | .idea 28 | .gradle 29 | local.properties 30 | *.iml 31 | 32 | # node.js 33 | # 34 | node_modules/ 35 | npm-debug.log 36 | yarn-error.log 37 | 38 | # BUCK 39 | buck-out/ 40 | \.buckd/ 41 | *.keystore 42 | !debug.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 artifact 56 | *.jsbundle 57 | 58 | # CocoaPods 59 | /ios/Pods/ 60 | -------------------------------------------------------------------------------- /Example/.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | bracketSpacing: false, 3 | jsxBracketSameLine: true, 4 | singleQuote: true, 5 | trailingComma: 'all', 6 | arrowParens: 'avoid', 7 | }; 8 | -------------------------------------------------------------------------------- /Example/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /Example/App.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | * @flow 5 | */ 6 | 7 | import React, {Component} from 'react'; 8 | import {Platform, StyleSheet, Text, View, TouchableOpacity} from 'react-native'; 9 | 10 | import {RNToasty} from 'react-native-toasty'; 11 | import Icon from 'react-native-vector-icons/FontAwesome'; 12 | 13 | type Props = {}; 14 | export default class App extends Component { 15 | render() { 16 | let copy = ( 17 | 18 | ); 19 | 20 | return ( 21 | 22 | { 24 | RNToasty.Normal({title: 'Message'}); 25 | }}> 26 | {'Normal'} 27 | 28 | { 30 | RNToasty.Info({title: 'Message'}); 31 | }}> 32 | {'Info'} 33 | 34 | { 36 | RNToasty.Success({title: 'Message'}); 37 | }}> 38 | {'Success'} 39 | 40 | { 42 | RNToasty.Warn({title: 'Message'}); 43 | }}> 44 | {'Warning'} 45 | 46 | { 48 | RNToasty.Error({title: 'Message'}); 49 | }}> 50 | {'Error'} 51 | 52 | { 54 | RNToasty.Show({ 55 | title: 'Message', 56 | titleSize: 50, 57 | titleColor: '#555555', 58 | withIcon: true, 59 | duration: 1, 60 | tintColor: '#000000', 61 | icon: copy, 62 | }); 63 | }}> 64 | {'Custom'} 65 | 66 | 67 | ); 68 | } 69 | } 70 | 71 | const styles = StyleSheet.create({ 72 | container: { 73 | flex: 1, 74 | justifyContent: 'center', 75 | alignItems: 'center', 76 | backgroundColor: '#F5FCFF', 77 | }, 78 | }); 79 | -------------------------------------------------------------------------------- /Example/__tests__/App-test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | 5 | import 'react-native'; 6 | import React from 'react'; 7 | import App from '../App'; 8 | 9 | // Note: test renderer must be required after react-native. 10 | import renderer from 'react-test-renderer'; 11 | 12 | it('renders correctly', () => { 13 | renderer.create(); 14 | }); 15 | -------------------------------------------------------------------------------- /Example/android/app/BUCK: -------------------------------------------------------------------------------- 1 | # To learn about Buck see [Docs](https://buckbuild.com/). 2 | # To run your application with Buck: 3 | # - install Buck 4 | # - `npm start` - to start the packager 5 | # - `cd android` 6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` 7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck 8 | # - `buck install -r android/app` - compile, install and run application 9 | # 10 | 11 | load(":build_defs.bzl", "create_aar_targets", "create_jar_targets") 12 | 13 | lib_deps = [] 14 | 15 | create_aar_targets(glob(["libs/*.aar"])) 16 | 17 | create_jar_targets(glob(["libs/*.jar"])) 18 | 19 | android_library( 20 | name = "all-libs", 21 | exported_deps = lib_deps, 22 | ) 23 | 24 | android_library( 25 | name = "app-code", 26 | srcs = glob([ 27 | "src/main/java/**/*.java", 28 | ]), 29 | deps = [ 30 | ":all-libs", 31 | ":build_config", 32 | ":res", 33 | ], 34 | ) 35 | 36 | android_build_config( 37 | name = "build_config", 38 | package = "com.example", 39 | ) 40 | 41 | android_resource( 42 | name = "res", 43 | package = "com.example", 44 | res = "src/main/res", 45 | ) 46 | 47 | android_binary( 48 | name = "app", 49 | keystore = "//android/keystores:debug", 50 | manifest = "src/main/AndroidManifest.xml", 51 | package_type = "debug", 52 | deps = [ 53 | ":app-code", 54 | ], 55 | ) 56 | -------------------------------------------------------------------------------- /Example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.application" 2 | 3 | import com.android.build.OutputFile 4 | 5 | /** 6 | * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets 7 | * and bundleReleaseJsAndAssets). 8 | * These basically call `react-native bundle` with the correct arguments during the Android build 9 | * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the 10 | * bundle directly from the development server. Below you can see all the possible configurations 11 | * and their defaults. If you decide to add a configuration block, make sure to add it before the 12 | * `apply from: "../../node_modules/react-native/react.gradle"` line. 13 | * 14 | * project.ext.react = [ 15 | * // the name of the generated asset file containing your JS bundle 16 | * bundleAssetName: "index.android.bundle", 17 | * 18 | * // the entry file for bundle generation. If none specified and 19 | * // "index.android.js" exists, it will be used. Otherwise "index.js" is 20 | * // default. Can be overridden with ENTRY_FILE environment variable. 21 | * entryFile: "index.android.js", 22 | * 23 | * // https://reactnative.dev/docs/performance#enable-the-ram-format 24 | * bundleCommand: "ram-bundle", 25 | * 26 | * // whether to bundle JS and assets in debug mode 27 | * bundleInDebug: false, 28 | * 29 | * // whether to bundle JS and assets in release mode 30 | * bundleInRelease: true, 31 | * 32 | * // whether to bundle JS and assets in another build variant (if configured). 33 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants 34 | * // The configuration property can be in the following formats 35 | * // 'bundleIn${productFlavor}${buildType}' 36 | * // 'bundleIn${buildType}' 37 | * // bundleInFreeDebug: true, 38 | * // bundleInPaidRelease: true, 39 | * // bundleInBeta: true, 40 | * 41 | * // whether to disable dev mode in custom build variants (by default only disabled in release) 42 | * // for example: to disable dev mode in the staging build type (if configured) 43 | * devDisabledInStaging: true, 44 | * // The configuration property can be in the following formats 45 | * // 'devDisabledIn${productFlavor}${buildType}' 46 | * // 'devDisabledIn${buildType}' 47 | * 48 | * // the root of your project, i.e. where "package.json" lives 49 | * root: "../../", 50 | * 51 | * // where to put the JS bundle asset in debug mode 52 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", 53 | * 54 | * // where to put the JS bundle asset in release mode 55 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release", 56 | * 57 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 58 | * // require('./image.png')), in debug mode 59 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", 60 | * 61 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 62 | * // require('./image.png')), in release mode 63 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", 64 | * 65 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means 66 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to 67 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle 68 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ 69 | * // for example, you might want to remove it from here. 70 | * inputExcludes: ["android/**", "ios/**"], 71 | * 72 | * // override which node gets called and with what additional arguments 73 | * nodeExecutableAndArgs: ["node"], 74 | * 75 | * // supply additional arguments to the packager 76 | * extraPackagerArgs: [] 77 | * ] 78 | */ 79 | 80 | project.ext.react = [ 81 | enableHermes: false, // clean and rebuild if changing 82 | ] 83 | 84 | apply from: "../../node_modules/react-native/react.gradle" 85 | apply from: "../../node_modules/react-native-vector-icons/fonts.gradle" 86 | 87 | /** 88 | * Set this to true to create two separate APKs instead of one: 89 | * - An APK that only works on ARM devices 90 | * - An APK that only works on x86 devices 91 | * The advantage is the size of the APK is reduced by about 4MB. 92 | * Upload all the APKs to the Play Store and people will download 93 | * the correct one based on the CPU architecture of their device. 94 | */ 95 | def enableSeparateBuildPerCPUArchitecture = false 96 | 97 | /** 98 | * Run Proguard to shrink the Java bytecode in release builds. 99 | */ 100 | def enableProguardInReleaseBuilds = false 101 | 102 | /** 103 | * The preferred build flavor of JavaScriptCore. 104 | * 105 | * For example, to use the international variant, you can use: 106 | * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` 107 | * 108 | * The international variant includes ICU i18n library and necessary data 109 | * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that 110 | * give correct results when using with locales other than en-US. Note that 111 | * this variant is about 6MiB larger per architecture than default. 112 | */ 113 | def jscFlavor = 'org.webkit:android-jsc:+' 114 | 115 | /** 116 | * Whether to enable the Hermes VM. 117 | * 118 | * This should be set on project.ext.react and mirrored here. If it is not set 119 | * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode 120 | * and the benefits of using Hermes will therefore be sharply reduced. 121 | */ 122 | def enableHermes = project.ext.react.get("enableHermes", false); 123 | 124 | android { 125 | ndkVersion rootProject.ext.ndkVersion 126 | 127 | compileSdkVersion rootProject.ext.compileSdkVersion 128 | 129 | compileOptions { 130 | sourceCompatibility JavaVersion.VERSION_1_8 131 | targetCompatibility JavaVersion.VERSION_1_8 132 | } 133 | 134 | defaultConfig { 135 | applicationId "com.example" 136 | minSdkVersion rootProject.ext.minSdkVersion 137 | targetSdkVersion rootProject.ext.targetSdkVersion 138 | versionCode 1 139 | versionName "1.0" 140 | } 141 | splits { 142 | abi { 143 | reset() 144 | enable enableSeparateBuildPerCPUArchitecture 145 | universalApk false // If true, also generate a universal APK 146 | include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" 147 | } 148 | } 149 | signingConfigs { 150 | debug { 151 | storeFile file('debug.keystore') 152 | storePassword 'android' 153 | keyAlias 'androiddebugkey' 154 | keyPassword 'android' 155 | } 156 | } 157 | buildTypes { 158 | debug { 159 | signingConfig signingConfigs.debug 160 | } 161 | release { 162 | // Caution! In production, you need to generate your own keystore file. 163 | // see https://reactnative.dev/docs/signed-apk-android. 164 | signingConfig signingConfigs.debug 165 | minifyEnabled enableProguardInReleaseBuilds 166 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 167 | } 168 | } 169 | 170 | // applicationVariants are e.g. debug, release 171 | applicationVariants.all { variant -> 172 | variant.outputs.each { output -> 173 | // For each separate APK per architecture, set a unique version code as described here: 174 | // https://developer.android.com/studio/build/configure-apk-splits.html 175 | // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc. 176 | def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] 177 | def abi = output.getFilter(OutputFile.ABI) 178 | if (abi != null) { // null for the universal-debug, universal-release variants 179 | output.versionCodeOverride = 180 | defaultConfig.versionCode * 1000 + versionCodes.get(abi) 181 | } 182 | 183 | } 184 | } 185 | } 186 | 187 | dependencies { 188 | implementation fileTree(dir: "libs", include: ["*.jar"]) 189 | //noinspection GradleDynamicVersion 190 | implementation "com.facebook.react:react-native:+" // From node_modules 191 | 192 | implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" 193 | 194 | debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { 195 | exclude group:'com.facebook.fbjni' 196 | } 197 | 198 | debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { 199 | exclude group:'com.facebook.flipper' 200 | exclude group:'com.squareup.okhttp3', module:'okhttp' 201 | } 202 | 203 | debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") { 204 | exclude group:'com.facebook.flipper' 205 | } 206 | 207 | if (enableHermes) { 208 | def hermesPath = "../../node_modules/hermes-engine/android/"; 209 | debugImplementation files(hermesPath + "hermes-debug.aar") 210 | releaseImplementation files(hermesPath + "hermes-release.aar") 211 | } else { 212 | implementation jscFlavor 213 | } 214 | } 215 | 216 | // Run this once to be able to run the application with BUCK 217 | // puts all compile dependencies into folder libs for BUCK to use 218 | task copyDownloadableDepsToLibs(type: Copy) { 219 | from configurations.compile 220 | into 'libs' 221 | } 222 | 223 | apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) 224 | -------------------------------------------------------------------------------- /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/android/app/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prscX/react-native-toasty/ca3b1c8ece81682480a9cb6310a4fabb7b18126c/Example/android/app/debug.keystore -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Example/android/app/src/main/java/com/example/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import com.facebook.react.ReactActivity; 4 | 5 | public class MainActivity extends ReactActivity { 6 | 7 | /** 8 | * Returns the name of the main component registered from JavaScript. This is used to schedule 9 | * rendering of the component. 10 | */ 11 | @Override 12 | protected String getMainComponentName() { 13 | return "Example"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Example/android/app/src/main/java/com/example/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | import com.facebook.react.PackageList; 6 | import com.facebook.react.ReactApplication; 7 | import com.facebook.react.ReactInstanceManager; 8 | import com.facebook.react.ReactNativeHost; 9 | import com.facebook.react.ReactPackage; 10 | import com.facebook.soloader.SoLoader; 11 | import java.lang.reflect.InvocationTargetException; 12 | import java.util.List; 13 | 14 | public class MainApplication extends Application implements ReactApplication { 15 | 16 | private final ReactNativeHost mReactNativeHost = 17 | new ReactNativeHost(this) { 18 | @Override 19 | public boolean getUseDeveloperSupport() { 20 | return BuildConfig.DEBUG; 21 | } 22 | 23 | @Override 24 | protected List getPackages() { 25 | @SuppressWarnings("UnnecessaryLocalVariable") 26 | List packages = new PackageList(this).getPackages(); 27 | // Packages that cannot be autolinked yet can be added manually here, for example: 28 | // packages.add(new MyReactNativePackage()); 29 | return packages; 30 | } 31 | 32 | @Override 33 | protected String getJSMainModuleName() { 34 | return "index"; 35 | } 36 | }; 37 | 38 | @Override 39 | public ReactNativeHost getReactNativeHost() { 40 | return mReactNativeHost; 41 | } 42 | 43 | @Override 44 | public void onCreate() { 45 | super.onCreate(); 46 | SoLoader.init(this, /* native exopackage */ false); 47 | initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); 48 | } 49 | 50 | /** 51 | * Loads Flipper in React Native templates. Call this in the onCreate method with something like 52 | * initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); 53 | * 54 | * @param context 55 | * @param reactInstanceManager 56 | */ 57 | private static void initializeFlipper( 58 | Context context, ReactInstanceManager reactInstanceManager) { 59 | if (BuildConfig.DEBUG) { 60 | try { 61 | /* 62 | We use reflection here to pick up the class that initializes Flipper, 63 | since Flipper library is not available in release mode 64 | */ 65 | Class aClass = Class.forName("com.example.ReactNativeFlipper"); 66 | aClass 67 | .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class) 68 | .invoke(null, context, reactInstanceManager); 69 | } catch (ClassNotFoundException e) { 70 | e.printStackTrace(); 71 | } catch (NoSuchMethodException e) { 72 | e.printStackTrace(); 73 | } catch (IllegalAccessException e) { 74 | e.printStackTrace(); 75 | } catch (InvocationTargetException e) { 76 | e.printStackTrace(); 77 | } 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prscX/react-native-toasty/ca3b1c8ece81682480a9cb6310a4fabb7b18126c/Example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prscX/react-native-toasty/ca3b1c8ece81682480a9cb6310a4fabb7b18126c/Example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prscX/react-native-toasty/ca3b1c8ece81682480a9cb6310a4fabb7b18126c/Example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prscX/react-native-toasty/ca3b1c8ece81682480a9cb6310a4fabb7b18126c/Example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prscX/react-native-toasty/ca3b1c8ece81682480a9cb6310a4fabb7b18126c/Example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prscX/react-native-toasty/ca3b1c8ece81682480a9cb6310a4fabb7b18126c/Example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prscX/react-native-toasty/ca3b1c8ece81682480a9cb6310a4fabb7b18126c/Example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prscX/react-native-toasty/ca3b1c8ece81682480a9cb6310a4fabb7b18126c/Example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prscX/react-native-toasty/ca3b1c8ece81682480a9cb6310a4fabb7b18126c/Example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prscX/react-native-toasty/ca3b1c8ece81682480a9cb6310a4fabb7b18126c/Example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Example 3 | 4 | -------------------------------------------------------------------------------- /Example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /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.3" 6 | minSdkVersion = 21 7 | compileSdkVersion = 29 8 | targetSdkVersion = 29 9 | ndkVersion = "20.1.5948944" 10 | } 11 | repositories { 12 | google() 13 | jcenter() 14 | } 15 | dependencies { 16 | classpath("com.android.tools.build:gradle:4.1.0") 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 | -------------------------------------------------------------------------------- /Example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | # AndroidX package structure to make it clearer which packages are bundled with the 21 | # Android operating system, and which are packaged with your app's APK 22 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 23 | android.useAndroidX=true 24 | # Automatically convert third-party libraries to use AndroidX 25 | android.enableJetifier=true 26 | 27 | # Version of flipper SDK to use with React Native 28 | FLIPPER_VERSION=0.75.1 29 | -------------------------------------------------------------------------------- /Example/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prscX/react-native-toasty/ca3b1c8ece81682480a9cb6310a4fabb7b18126c/Example/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /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.7-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /Example/android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | 86 | # Determine the Java command to use to start the JVM. 87 | if [ -n "$JAVA_HOME" ] ; then 88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 89 | # IBM's JDK on AIX uses strange locations for the executables 90 | JAVACMD="$JAVA_HOME/jre/sh/java" 91 | else 92 | JAVACMD="$JAVA_HOME/bin/java" 93 | fi 94 | if [ ! -x "$JAVACMD" ] ; then 95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 96 | 97 | Please set the JAVA_HOME variable in your environment to match the 98 | location of your Java installation." 99 | fi 100 | else 101 | JAVACMD="java" 102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 103 | 104 | Please set the JAVA_HOME variable in your environment to match the 105 | location of your Java installation." 106 | fi 107 | 108 | # Increase the maximum file descriptors if we can. 109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 110 | MAX_FD_LIMIT=`ulimit -H -n` 111 | if [ $? -eq 0 ] ; then 112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 113 | MAX_FD="$MAX_FD_LIMIT" 114 | fi 115 | ulimit -n $MAX_FD 116 | if [ $? -ne 0 ] ; then 117 | warn "Could not set maximum file descriptor limit: $MAX_FD" 118 | fi 119 | else 120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 121 | fi 122 | fi 123 | 124 | # For Darwin, add options to specify how the application appears in the dock 125 | if $darwin; then 126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 127 | fi 128 | 129 | # For Cygwin or MSYS, switch paths to Windows format before running java 130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 133 | 134 | JAVACMD=`cygpath --unix "$JAVACMD"` 135 | 136 | # We build the pattern for arguments to be converted via cygpath 137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 138 | SEP="" 139 | for dir in $ROOTDIRSRAW ; do 140 | ROOTDIRS="$ROOTDIRS$SEP$dir" 141 | SEP="|" 142 | done 143 | OURCYGPATTERN="(^($ROOTDIRS))" 144 | # Add a user-defined pattern to the cygpath arguments 145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 147 | fi 148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 149 | i=0 150 | for arg in "$@" ; do 151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 153 | 154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 156 | else 157 | eval `echo args$i`="\"$arg\"" 158 | fi 159 | i=`expr $i + 1` 160 | done 161 | case $i in 162 | 0) set -- ;; 163 | 1) set -- "$args0" ;; 164 | 2) set -- "$args0" "$args1" ;; 165 | 3) set -- "$args0" "$args1" "$args2" ;; 166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 172 | esac 173 | fi 174 | 175 | # Escape application args 176 | save () { 177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 178 | echo " " 179 | } 180 | APP_ARGS=`save "$@"` 181 | 182 | # Collect all arguments for the java command, following the shell quoting and substitution rules 183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 184 | 185 | exec "$JAVACMD" "$@" 186 | -------------------------------------------------------------------------------- /Example/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /Example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'Example' 2 | apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) 3 | include ':app' 4 | -------------------------------------------------------------------------------- /Example/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Example", 3 | "displayName": "Example" 4 | } -------------------------------------------------------------------------------- /Example/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['module:metro-react-native-babel-preset'], 3 | }; 4 | -------------------------------------------------------------------------------- /Example/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | 5 | import {AppRegistry} from 'react-native'; 6 | import App from './App'; 7 | import {name as appName} from './app.json'; 8 | 9 | AppRegistry.registerComponent(appName, () => App); 10 | -------------------------------------------------------------------------------- /Example/ios/Example.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 54; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; 11 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 12 | 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 13 | 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; }; 14 | FEB787DAC4E85C16B0D3BE2A /* libPods-Example.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6CEED2E39A69254034E5ADDA /* libPods-Example.a */; }; 15 | /* End PBXBuildFile section */ 16 | 17 | /* Begin PBXFileReference section */ 18 | 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 19 | 00E356F21AD99517003FC87E /* ExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ExampleTests.m; sourceTree = ""; }; 20 | 13B07F961A680F5B00A75B9A /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = Example/AppDelegate.h; sourceTree = ""; }; 22 | 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = Example/AppDelegate.m; sourceTree = ""; }; 23 | 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = Example/Images.xcassets; sourceTree = ""; }; 24 | 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Example/Info.plist; sourceTree = ""; }; 25 | 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Example/main.m; sourceTree = ""; }; 26 | 1B8AEF66E05AF9159E456608 /* Pods-Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.release.xcconfig"; path = "Target Support Files/Pods-Example/Pods-Example.release.xcconfig"; sourceTree = ""; }; 27 | 4616790662A840242AAD3F81 /* Pods-Example-ExampleTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example-ExampleTests.debug.xcconfig"; path = "Target Support Files/Pods-Example-ExampleTests/Pods-Example-ExampleTests.debug.xcconfig"; sourceTree = ""; }; 28 | 6CEED2E39A69254034E5ADDA /* libPods-Example.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Example.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 29 | 701A372B1D15D31B5F8C230B /* libPods-Example-ExampleTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Example-ExampleTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 30 | 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = Example/LaunchScreen.storyboard; sourceTree = ""; }; 31 | B9CA5BDA7C2DA31B59AB893C /* Pods-Example-ExampleTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example-ExampleTests.release.xcconfig"; path = "Target Support Files/Pods-Example-ExampleTests/Pods-Example-ExampleTests.release.xcconfig"; sourceTree = ""; }; 32 | CE30C682787E2F5994B64483 /* Pods-Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.debug.xcconfig"; path = "Target Support Files/Pods-Example/Pods-Example.debug.xcconfig"; sourceTree = ""; }; 33 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; 34 | /* End PBXFileReference section */ 35 | 36 | /* Begin PBXFrameworksBuildPhase section */ 37 | 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { 38 | isa = PBXFrameworksBuildPhase; 39 | buildActionMask = 2147483647; 40 | files = ( 41 | FEB787DAC4E85C16B0D3BE2A /* libPods-Example.a in Frameworks */, 42 | ); 43 | runOnlyForDeploymentPostprocessing = 0; 44 | }; 45 | /* End PBXFrameworksBuildPhase section */ 46 | 47 | /* Begin PBXGroup section */ 48 | 00E356EF1AD99517003FC87E /* ExampleTests */ = { 49 | isa = PBXGroup; 50 | children = ( 51 | 00E356F21AD99517003FC87E /* ExampleTests.m */, 52 | 00E356F01AD99517003FC87E /* Supporting Files */, 53 | ); 54 | path = ExampleTests; 55 | sourceTree = ""; 56 | }; 57 | 00E356F01AD99517003FC87E /* Supporting Files */ = { 58 | isa = PBXGroup; 59 | children = ( 60 | 00E356F11AD99517003FC87E /* Info.plist */, 61 | ); 62 | name = "Supporting Files"; 63 | sourceTree = ""; 64 | }; 65 | 13B07FAE1A68108700A75B9A /* Example */ = { 66 | isa = PBXGroup; 67 | children = ( 68 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */, 69 | 13B07FB01A68108700A75B9A /* AppDelegate.m */, 70 | 13B07FB51A68108700A75B9A /* Images.xcassets */, 71 | 13B07FB61A68108700A75B9A /* Info.plist */, 72 | 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */, 73 | 13B07FB71A68108700A75B9A /* main.m */, 74 | ); 75 | name = Example; 76 | sourceTree = ""; 77 | }; 78 | 2D16E6871FA4F8E400B85C8A /* Frameworks */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */, 82 | 6CEED2E39A69254034E5ADDA /* libPods-Example.a */, 83 | 701A372B1D15D31B5F8C230B /* libPods-Example-ExampleTests.a */, 84 | ); 85 | name = Frameworks; 86 | sourceTree = ""; 87 | }; 88 | 34BB6BA89BD241DACC08C74C /* Pods */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | CE30C682787E2F5994B64483 /* Pods-Example.debug.xcconfig */, 92 | 1B8AEF66E05AF9159E456608 /* Pods-Example.release.xcconfig */, 93 | 4616790662A840242AAD3F81 /* Pods-Example-ExampleTests.debug.xcconfig */, 94 | B9CA5BDA7C2DA31B59AB893C /* Pods-Example-ExampleTests.release.xcconfig */, 95 | ); 96 | path = Pods; 97 | sourceTree = ""; 98 | }; 99 | 832341AE1AAA6A7D00B99B32 /* Libraries */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | ); 103 | name = Libraries; 104 | sourceTree = ""; 105 | }; 106 | 83CBB9F61A601CBA00E9B192 = { 107 | isa = PBXGroup; 108 | children = ( 109 | 13B07FAE1A68108700A75B9A /* Example */, 110 | 832341AE1AAA6A7D00B99B32 /* Libraries */, 111 | 00E356EF1AD99517003FC87E /* ExampleTests */, 112 | 83CBBA001A601CBA00E9B192 /* Products */, 113 | 2D16E6871FA4F8E400B85C8A /* Frameworks */, 114 | 34BB6BA89BD241DACC08C74C /* Pods */, 115 | ); 116 | indentWidth = 2; 117 | sourceTree = ""; 118 | tabWidth = 2; 119 | usesTabs = 0; 120 | }; 121 | 83CBBA001A601CBA00E9B192 /* Products */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | 13B07F961A680F5B00A75B9A /* Example.app */, 125 | ); 126 | name = Products; 127 | sourceTree = ""; 128 | }; 129 | /* End PBXGroup section */ 130 | 131 | /* Begin PBXNativeTarget section */ 132 | 13B07F861A680F5B00A75B9A /* Example */ = { 133 | isa = PBXNativeTarget; 134 | buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "Example" */; 135 | buildPhases = ( 136 | 4C1214E546B4DD465E392335 /* [CP] Check Pods Manifest.lock */, 137 | FD10A7F022414F080027D42C /* Start Packager */, 138 | 13B07F871A680F5B00A75B9A /* Sources */, 139 | 13B07F8C1A680F5B00A75B9A /* Frameworks */, 140 | 13B07F8E1A680F5B00A75B9A /* Resources */, 141 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, 142 | FF27FFB414B4C359DB7B3201 /* [CP] Embed Pods Frameworks */, 143 | 7B9CA313AE09E03512E3A860 /* [CP] Copy Pods Resources */, 144 | ); 145 | buildRules = ( 146 | ); 147 | dependencies = ( 148 | ); 149 | name = Example; 150 | productName = Example; 151 | productReference = 13B07F961A680F5B00A75B9A /* Example.app */; 152 | productType = "com.apple.product-type.application"; 153 | }; 154 | /* End PBXNativeTarget section */ 155 | 156 | /* Begin PBXProject section */ 157 | 83CBB9F71A601CBA00E9B192 /* Project object */ = { 158 | isa = PBXProject; 159 | attributes = { 160 | LastUpgradeCheck = 1210; 161 | TargetAttributes = { 162 | 13B07F861A680F5B00A75B9A = { 163 | LastSwiftMigration = 1120; 164 | }; 165 | }; 166 | }; 167 | buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "Example" */; 168 | compatibilityVersion = "Xcode 12.0"; 169 | developmentRegion = en; 170 | hasScannedForEncodings = 0; 171 | knownRegions = ( 172 | en, 173 | Base, 174 | ); 175 | mainGroup = 83CBB9F61A601CBA00E9B192; 176 | productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; 177 | projectDirPath = ""; 178 | projectRoot = ""; 179 | targets = ( 180 | 13B07F861A680F5B00A75B9A /* Example */, 181 | ); 182 | }; 183 | /* End PBXProject section */ 184 | 185 | /* Begin PBXResourcesBuildPhase section */ 186 | 13B07F8E1A680F5B00A75B9A /* Resources */ = { 187 | isa = PBXResourcesBuildPhase; 188 | buildActionMask = 2147483647; 189 | files = ( 190 | 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */, 191 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, 192 | ); 193 | runOnlyForDeploymentPostprocessing = 0; 194 | }; 195 | /* End PBXResourcesBuildPhase section */ 196 | 197 | /* Begin PBXShellScriptBuildPhase section */ 198 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = { 199 | isa = PBXShellScriptBuildPhase; 200 | buildActionMask = 2147483647; 201 | files = ( 202 | ); 203 | inputPaths = ( 204 | ); 205 | name = "Bundle React Native code and images"; 206 | outputPaths = ( 207 | ); 208 | runOnlyForDeploymentPostprocessing = 0; 209 | shellPath = /bin/sh; 210 | shellScript = "set -e\n\nexport NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh\n"; 211 | }; 212 | 4C1214E546B4DD465E392335 /* [CP] Check Pods Manifest.lock */ = { 213 | isa = PBXShellScriptBuildPhase; 214 | buildActionMask = 2147483647; 215 | files = ( 216 | ); 217 | inputFileListPaths = ( 218 | ); 219 | inputPaths = ( 220 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 221 | "${PODS_ROOT}/Manifest.lock", 222 | ); 223 | name = "[CP] Check Pods Manifest.lock"; 224 | outputFileListPaths = ( 225 | ); 226 | outputPaths = ( 227 | "$(DERIVED_FILE_DIR)/Pods-Example-checkManifestLockResult.txt", 228 | ); 229 | runOnlyForDeploymentPostprocessing = 0; 230 | shellPath = /bin/sh; 231 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 232 | showEnvVarsInLog = 0; 233 | }; 234 | 7B9CA313AE09E03512E3A860 /* [CP] Copy Pods Resources */ = { 235 | isa = PBXShellScriptBuildPhase; 236 | buildActionMask = 2147483647; 237 | files = ( 238 | ); 239 | inputFileListPaths = ( 240 | "${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-resources-${CONFIGURATION}-input-files.xcfilelist", 241 | ); 242 | name = "[CP] Copy Pods Resources"; 243 | outputFileListPaths = ( 244 | "${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-resources-${CONFIGURATION}-output-files.xcfilelist", 245 | ); 246 | runOnlyForDeploymentPostprocessing = 0; 247 | shellPath = /bin/sh; 248 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-resources.sh\"\n"; 249 | showEnvVarsInLog = 0; 250 | }; 251 | FD10A7F022414F080027D42C /* Start Packager */ = { 252 | isa = PBXShellScriptBuildPhase; 253 | buildActionMask = 2147483647; 254 | files = ( 255 | ); 256 | inputFileListPaths = ( 257 | ); 258 | inputPaths = ( 259 | ); 260 | name = "Start Packager"; 261 | outputFileListPaths = ( 262 | ); 263 | outputPaths = ( 264 | ); 265 | runOnlyForDeploymentPostprocessing = 0; 266 | shellPath = /bin/sh; 267 | shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../node_modules/react-native/scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../node_modules/react-native/scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi\n"; 268 | showEnvVarsInLog = 0; 269 | }; 270 | FF27FFB414B4C359DB7B3201 /* [CP] Embed Pods Frameworks */ = { 271 | isa = PBXShellScriptBuildPhase; 272 | buildActionMask = 2147483647; 273 | files = ( 274 | ); 275 | inputFileListPaths = ( 276 | "${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-frameworks-${CONFIGURATION}-input-files.xcfilelist", 277 | ); 278 | name = "[CP] Embed Pods Frameworks"; 279 | outputFileListPaths = ( 280 | "${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-frameworks-${CONFIGURATION}-output-files.xcfilelist", 281 | ); 282 | runOnlyForDeploymentPostprocessing = 0; 283 | shellPath = /bin/sh; 284 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-frameworks.sh\"\n"; 285 | showEnvVarsInLog = 0; 286 | }; 287 | /* End PBXShellScriptBuildPhase section */ 288 | 289 | /* Begin PBXSourcesBuildPhase section */ 290 | 13B07F871A680F5B00A75B9A /* Sources */ = { 291 | isa = PBXSourcesBuildPhase; 292 | buildActionMask = 2147483647; 293 | files = ( 294 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */, 295 | 13B07FC11A68108700A75B9A /* main.m in Sources */, 296 | ); 297 | runOnlyForDeploymentPostprocessing = 0; 298 | }; 299 | /* End PBXSourcesBuildPhase section */ 300 | 301 | /* Begin XCBuildConfiguration section */ 302 | 13B07F941A680F5B00A75B9A /* Debug */ = { 303 | isa = XCBuildConfiguration; 304 | baseConfigurationReference = CE30C682787E2F5994B64483 /* Pods-Example.debug.xcconfig */; 305 | buildSettings = { 306 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 307 | CLANG_ENABLE_MODULES = YES; 308 | CURRENT_PROJECT_VERSION = 1; 309 | ENABLE_BITCODE = NO; 310 | INFOPLIST_FILE = Example/Info.plist; 311 | LD_RUNPATH_SEARCH_PATHS = ( 312 | "$(inherited)", 313 | "@executable_path/Frameworks", 314 | ); 315 | OTHER_LDFLAGS = ( 316 | "$(inherited)", 317 | "-ObjC", 318 | "-lc++", 319 | ); 320 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; 321 | PRODUCT_NAME = Example; 322 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 323 | SWIFT_VERSION = 5.0; 324 | VERSIONING_SYSTEM = "apple-generic"; 325 | }; 326 | name = Debug; 327 | }; 328 | 13B07F951A680F5B00A75B9A /* Release */ = { 329 | isa = XCBuildConfiguration; 330 | baseConfigurationReference = 1B8AEF66E05AF9159E456608 /* Pods-Example.release.xcconfig */; 331 | buildSettings = { 332 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 333 | CLANG_ENABLE_MODULES = YES; 334 | CURRENT_PROJECT_VERSION = 1; 335 | INFOPLIST_FILE = Example/Info.plist; 336 | LD_RUNPATH_SEARCH_PATHS = ( 337 | "$(inherited)", 338 | "@executable_path/Frameworks", 339 | ); 340 | OTHER_LDFLAGS = ( 341 | "$(inherited)", 342 | "-ObjC", 343 | "-lc++", 344 | ); 345 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; 346 | PRODUCT_NAME = Example; 347 | SWIFT_VERSION = 5.0; 348 | VERSIONING_SYSTEM = "apple-generic"; 349 | }; 350 | name = Release; 351 | }; 352 | 83CBBA201A601CBA00E9B192 /* Debug */ = { 353 | isa = XCBuildConfiguration; 354 | buildSettings = { 355 | ALWAYS_SEARCH_USER_PATHS = NO; 356 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 357 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 358 | CLANG_CXX_LIBRARY = "libc++"; 359 | CLANG_ENABLE_MODULES = YES; 360 | CLANG_ENABLE_OBJC_ARC = YES; 361 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 362 | CLANG_WARN_BOOL_CONVERSION = YES; 363 | CLANG_WARN_COMMA = YES; 364 | CLANG_WARN_CONSTANT_CONVERSION = YES; 365 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 366 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 367 | CLANG_WARN_EMPTY_BODY = YES; 368 | CLANG_WARN_ENUM_CONVERSION = YES; 369 | CLANG_WARN_INFINITE_RECURSION = YES; 370 | CLANG_WARN_INT_CONVERSION = YES; 371 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 372 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 373 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 374 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 375 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 376 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 377 | CLANG_WARN_STRICT_PROTOTYPES = YES; 378 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 379 | CLANG_WARN_UNREACHABLE_CODE = YES; 380 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 381 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 382 | COPY_PHASE_STRIP = NO; 383 | ENABLE_STRICT_OBJC_MSGSEND = YES; 384 | ENABLE_TESTABILITY = YES; 385 | "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "arm64 "; 386 | GCC_C_LANGUAGE_STANDARD = gnu99; 387 | GCC_DYNAMIC_NO_PIC = NO; 388 | GCC_NO_COMMON_BLOCKS = YES; 389 | GCC_OPTIMIZATION_LEVEL = 0; 390 | GCC_PREPROCESSOR_DEFINITIONS = ( 391 | "DEBUG=1", 392 | "$(inherited)", 393 | ); 394 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 395 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 396 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 397 | GCC_WARN_UNDECLARED_SELECTOR = YES; 398 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 399 | GCC_WARN_UNUSED_FUNCTION = YES; 400 | GCC_WARN_UNUSED_VARIABLE = YES; 401 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 402 | LD_RUNPATH_SEARCH_PATHS = ( 403 | /usr/lib/swift, 404 | "$(inherited)", 405 | ); 406 | LIBRARY_SEARCH_PATHS = ( 407 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", 408 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"", 409 | "\"$(inherited)\"", 410 | ); 411 | MTL_ENABLE_DEBUG_INFO = YES; 412 | ONLY_ACTIVE_ARCH = YES; 413 | SDKROOT = iphoneos; 414 | }; 415 | name = Debug; 416 | }; 417 | 83CBBA211A601CBA00E9B192 /* Release */ = { 418 | isa = XCBuildConfiguration; 419 | buildSettings = { 420 | ALWAYS_SEARCH_USER_PATHS = NO; 421 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 422 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 423 | CLANG_CXX_LIBRARY = "libc++"; 424 | CLANG_ENABLE_MODULES = YES; 425 | CLANG_ENABLE_OBJC_ARC = YES; 426 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 427 | CLANG_WARN_BOOL_CONVERSION = YES; 428 | CLANG_WARN_COMMA = YES; 429 | CLANG_WARN_CONSTANT_CONVERSION = YES; 430 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 431 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 432 | CLANG_WARN_EMPTY_BODY = YES; 433 | CLANG_WARN_ENUM_CONVERSION = YES; 434 | CLANG_WARN_INFINITE_RECURSION = YES; 435 | CLANG_WARN_INT_CONVERSION = YES; 436 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 437 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 438 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 439 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 440 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 441 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 442 | CLANG_WARN_STRICT_PROTOTYPES = YES; 443 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 444 | CLANG_WARN_UNREACHABLE_CODE = YES; 445 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 446 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 447 | COPY_PHASE_STRIP = YES; 448 | ENABLE_NS_ASSERTIONS = NO; 449 | ENABLE_STRICT_OBJC_MSGSEND = YES; 450 | "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "arm64 "; 451 | GCC_C_LANGUAGE_STANDARD = gnu99; 452 | GCC_NO_COMMON_BLOCKS = YES; 453 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 454 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 455 | GCC_WARN_UNDECLARED_SELECTOR = YES; 456 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 457 | GCC_WARN_UNUSED_FUNCTION = YES; 458 | GCC_WARN_UNUSED_VARIABLE = YES; 459 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 460 | LD_RUNPATH_SEARCH_PATHS = ( 461 | /usr/lib/swift, 462 | "$(inherited)", 463 | ); 464 | LIBRARY_SEARCH_PATHS = ( 465 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", 466 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"", 467 | "\"$(inherited)\"", 468 | ); 469 | MTL_ENABLE_DEBUG_INFO = NO; 470 | SDKROOT = iphoneos; 471 | VALIDATE_PRODUCT = YES; 472 | }; 473 | name = Release; 474 | }; 475 | /* End XCBuildConfiguration section */ 476 | 477 | /* Begin XCConfigurationList section */ 478 | 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "Example" */ = { 479 | isa = XCConfigurationList; 480 | buildConfigurations = ( 481 | 13B07F941A680F5B00A75B9A /* Debug */, 482 | 13B07F951A680F5B00A75B9A /* Release */, 483 | ); 484 | defaultConfigurationIsVisible = 0; 485 | defaultConfigurationName = Release; 486 | }; 487 | 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "Example" */ = { 488 | isa = XCConfigurationList; 489 | buildConfigurations = ( 490 | 83CBBA201A601CBA00E9B192 /* Debug */, 491 | 83CBBA211A601CBA00E9B192 /* Release */, 492 | ); 493 | defaultConfigurationIsVisible = 0; 494 | defaultConfigurationName = Release; 495 | }; 496 | /* End XCConfigurationList section */ 497 | }; 498 | rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; 499 | } 500 | -------------------------------------------------------------------------------- /Example/ios/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 53 | 55 | 61 | 62 | 63 | 64 | 70 | 72 | 78 | 79 | 80 | 81 | 83 | 84 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /Example/ios/Example.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/ios/Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/ios/Example/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : UIResponder 5 | 6 | @property (nonatomic, strong) UIWindow *window; 7 | 8 | @end 9 | -------------------------------------------------------------------------------- /Example/ios/Example/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #import "AppDelegate.h" 2 | 3 | #import 4 | #import 5 | #import 6 | 7 | #ifdef FB_SONARKIT_ENABLED 8 | #import 9 | #import 10 | #import 11 | #import 12 | #import 13 | #import 14 | 15 | static void InitializeFlipper(UIApplication *application) { 16 | FlipperClient *client = [FlipperClient sharedClient]; 17 | SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults]; 18 | [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]]; 19 | [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]]; 20 | [client addPlugin:[FlipperKitReactPlugin new]]; 21 | [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]]; 22 | [client start]; 23 | } 24 | #endif 25 | 26 | @implementation AppDelegate 27 | 28 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 29 | { 30 | #ifdef FB_SONARKIT_ENABLED 31 | InitializeFlipper(application); 32 | #endif 33 | 34 | RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; 35 | RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge 36 | moduleName:@"Example" 37 | initialProperties:nil]; 38 | 39 | if (@available(iOS 13.0, *)) { 40 | rootView.backgroundColor = [UIColor systemBackgroundColor]; 41 | } else { 42 | rootView.backgroundColor = [UIColor whiteColor]; 43 | } 44 | 45 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 46 | UIViewController *rootViewController = [UIViewController new]; 47 | rootViewController.view = rootView; 48 | self.window.rootViewController = rootViewController; 49 | [self.window makeKeyAndVisible]; 50 | return YES; 51 | } 52 | 53 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge 54 | { 55 | #if DEBUG 56 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; 57 | #else 58 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 59 | #endif 60 | } 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /Example/ios/Example/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Example/ios/Example/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | UIAppFonts 6 | 7 | AntDesign.ttf 8 | Entypo.ttf 9 | EvilIcons.ttf 10 | Feather.ttf 11 | FontAwesome.ttf 12 | FontAwesome5_Brands.ttf 13 | FontAwesome5_Regular.ttf 14 | FontAwesome5_Solid.ttf 15 | Foundation.ttf 16 | Ionicons.ttf 17 | MaterialIcons.ttf 18 | MaterialCommunityIcons.ttf 19 | SimpleLineIcons.ttf 20 | Octicons.ttf 21 | Zocial.ttf 22 | 23 | CFBundleDevelopmentRegion 24 | en 25 | CFBundleDisplayName 26 | Example 27 | CFBundleExecutable 28 | $(EXECUTABLE_NAME) 29 | CFBundleIdentifier 30 | $(PRODUCT_BUNDLE_IDENTIFIER) 31 | CFBundleInfoDictionaryVersion 32 | 6.0 33 | CFBundleName 34 | $(PRODUCT_NAME) 35 | CFBundlePackageType 36 | APPL 37 | CFBundleShortVersionString 38 | 1.0 39 | CFBundleSignature 40 | ???? 41 | CFBundleVersion 42 | 1 43 | LSRequiresIPhoneOS 44 | 45 | NSAppTransportSecurity 46 | 47 | NSExceptionDomains 48 | 49 | localhost 50 | 51 | NSExceptionAllowsInsecureHTTPLoads 52 | 53 | 54 | 55 | 56 | NSLocationWhenInUseUsageDescription 57 | 58 | UILaunchStoryboardName 59 | LaunchScreen 60 | UIRequiredDeviceCapabilities 61 | 62 | armv7 63 | 64 | UISupportedInterfaceOrientations 65 | 66 | UIInterfaceOrientationPortrait 67 | UIInterfaceOrientationLandscapeLeft 68 | UIInterfaceOrientationLandscapeRight 69 | 70 | UIViewControllerBasedStatusBarAppearance 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /Example/ios/Example/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 24 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Example/ios/Podfile: -------------------------------------------------------------------------------- 1 | require_relative '../node_modules/react-native/scripts/react_native_pods' 2 | require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' 3 | 4 | platform :ios, '10.0' 5 | 6 | target 'Example' do 7 | config = use_native_modules! 8 | 9 | use_react_native!( 10 | :path => config[:reactNativePath], 11 | # to enable hermes on iOS, change `false` to `true` and then install pods 12 | :hermes_enabled => false 13 | ) 14 | 15 | # Enables Flipper. 16 | # 17 | # Note that if you have use_frameworks! enabled, Flipper will not work and 18 | # you should disable the next line. 19 | use_flipper!() 20 | 21 | post_install do |installer| 22 | react_native_post_install(installer) 23 | end 24 | end -------------------------------------------------------------------------------- /Example/metro.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Metro configuration for React Native 3 | * https://github.com/facebook/react-native 4 | * 5 | * @format 6 | */ 7 | 8 | module.exports = { 9 | transformer: { 10 | getTransformOptions: async () => ({ 11 | transform: { 12 | experimentalImportSupport: false, 13 | inlineRequires: true, 14 | }, 15 | }), 16 | }, 17 | }; 18 | -------------------------------------------------------------------------------- /Example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Example", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "android": "react-native run-android", 7 | "ios": "react-native run-ios", 8 | "start": "react-native start", 9 | "test": "jest", 10 | "lint": "eslint ." 11 | }, 12 | "dependencies": { 13 | "react": "17.0.1", 14 | "react-native": "0.64.2", 15 | "react-native-toasty": "../", 16 | "react-native-image-helper": "0.0.3", 17 | "react-native-vector-icons": "8.1.0" 18 | }, 19 | "devDependencies": { 20 | "@babel/core": "^7.14.6", 21 | "@babel/runtime": "^7.14.6", 22 | "@react-native-community/eslint-config": "^3.0.0", 23 | "babel-jest": "^27.0.6", 24 | "eslint": "^7.29.0", 25 | "jest": "^27.0.6", 26 | "metro-react-native-babel-preset": "^0.66.0", 27 | "react-test-renderer": "17.0.1" 28 | }, 29 | "jest": { 30 | "preset": "react-native" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 | 5 |

6 | 7 |

8 | 9 | PRs Welcome 10 | 11 |

12 | 13 | ReactNative: Native Toast 14 | 15 | If this project has helped you out, please support us with a star 🌟 16 | 17 |

18 | 19 | This library is a wrapper around native Toast library which 5 different states of beautiful toasts: 20 | 21 | - **Normal**, **Info**, **Success**, **Warning**, **Error** 22 | 23 | | **Android: [GrenderG/Toasty](https://github.com/GrenderG/Toasty)** | 24 | | -------------------------------------------------------------------------------------- | 25 | | | 26 | 27 | | **iOS: [scalessec/Toast](https://github.com/scalessec/Toast)** | 28 | | -------------------------------------------------------------- | 29 | | | 30 | 31 | ## 📖 Getting Started 32 | 33 | `$yarn install react-native-toasty` 34 | 35 | > This library is supports React Native 60 and above 36 | 37 | - Add `react-native-image-helper` your app package.json 38 | 39 | `$ npm install react-native-image-helper --save` 40 | 41 | - Add `react-native-vector-icons` to your app package.json and configure it as per their installation steps 42 | 43 | `$ npm install react-native-vector-icons --save` 44 | 45 | - **Android** 46 | 47 | Please add below snippet into your app `build.gradle` 48 | 49 | ``` 50 | allprojects { 51 | repositories { 52 | maven { url 'https://www.jitpack.io' } 53 | } 54 | } 55 | ``` 56 | 57 | ## 💻 Usage 58 | 59 | ```javascript 60 | import { RNToasty } from 'react-native-toasty' 61 | ``` 62 | 63 | ```javascript 64 | RNToasty.Show({ 65 | title: 'This is a toast', 66 | fontFamily: 'Arial', 67 | position: 'center', 68 | }) 69 | ``` 70 | 71 | ## 🎨 API's 72 | 73 | **Normal**, **Info**, **Success**, **Warning**, **Error**, **Custom** 74 | 75 | ```javascript 76 | RNToasty.Normal({}), 77 | RNToasty.Info({}), 78 | RNToasty.Success({}), 79 | RNToasty.Warn({}), 80 | RNToasty.Error({}), 81 | RNToasty.Show({}) 82 | ``` 83 | 84 | ## 💡 Props 85 | 86 | - **Props: Generic** 87 | 88 | | Prop | Type | Default | Note | 89 | | ------------ | --------------------- | --------- | --------------------------------------------------------------------- | --- | 90 | | `title` | `string` | | Specify the title of toast | 91 | | `titleSize` | `number` | 16 | Specify the title size | | 92 | | `titleColor` | `string: HEX-COLOR` | `#FFFFFF` | Specify the title color | | 93 | | `duration` | `number` | | Specify the duration of toast: `0: SHORT; 1: LONG` | 94 | | `tintColor` | `string: HEX-NUMBER` | `#000000` | Specify the tint color of toast | 95 | | `withIcon` | `bool` | `true` | Specify whether you need icon | 96 | | `icon` | `vector-icon` | | Specify icon of toast | 97 | | `fontFamily` | `string` | | Name of font in assets/fonts folder => like 'Arial' [Only on Android] | 98 | | `position` | `top\|center\|bottom` | `bottom` | Specify position of toast | 99 | | `offsetX` | `number` | `0` | Specify X offset of toast [Only on Android] | 100 | | `offsetY` | `number` | `0` | Specify Y offset of toast [Only on Android] | 101 | 102 | ## Icons 103 | 104 | - **RN Vector Icons:** It supports [react-native-vector-icons](https://github.com/oblador/react-native-vector-icons) library. Please find below snippet for the usage: 105 | 106 | ```javascript 107 | let facebook = 108 | 109 | 110 | ``` 111 | 112 | > **Note:** 113 | > 114 | > - We have added `family` prop for `Icon` class, please make sure that you pass the props 115 | 116 | ## ✨ Credits 117 | 118 | - Android: [GrenderG/Toasty](https://github.com/GrenderG/Toasty) 119 | - iOS: [scalessec/Toast](https://github.com/scalessec/Toast) 120 | 121 | ## 🤔 How to contribute 122 | 123 | Have an idea? Found a bug? Please raise to [ISSUES](https://github.com/prscX/react-native-toasty/issues). 124 | Contributions are welcome and are greatly appreciated! Every little bit helps, and credit will always be given. 125 | 126 | ## 💫 Where is this library used? 127 | 128 | If you are using this library in one of your projects, add it in this list below. ✨ 129 | 130 | ## 📜 License 131 | 132 | This library is provided under the Apache 2 License. 133 | 134 | RNToasty @ [prscX](https://github.com/prscX) 135 | 136 | ## 💖 Support my projects 137 | 138 | I open-source almost everything I can, and I try to reply everyone needing help using these projects. Obviously, this takes time. You can integrate and use these projects in your applications for free! You can even change the source code and redistribute (even resell it). 139 | 140 | However, if you get some profit from this or just want to encourage me to continue creating stuff, there are few ways you can do it: 141 | 142 | - Starring and sharing the projects you like 🚀 143 | - If you're feeling especially charitable, please follow [prscX](https://github.com/prscX) on GitHub. 144 | 145 | Buy Me A Coffee 146 | 147 | Thanks! ❤️ 148 |
149 | [prscX.github.io](https://prscx.github.io) 150 |
151 | 152 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | 2 | buildscript { 3 | repositories { 4 | google() 5 | jcenter() 6 | maven { url "https://maven.google.com" } 7 | maven { url "https://jitpack.io" } 8 | } 9 | 10 | dependencies { 11 | classpath('com.android.tools.build:gradle:4.2.1') 12 | } 13 | } 14 | 15 | apply plugin: 'com.android.library' 16 | 17 | def safeExtGet(prop, fallback) { 18 | rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback 19 | } 20 | 21 | android { 22 | compileSdkVersion safeExtGet('compileSdkVersion', 28) 23 | 24 | defaultConfig { 25 | minSdkVersion 16 26 | targetSdkVersion safeExtGet('compileSdkVersion', 28) 27 | versionCode 1 28 | versionName "1.0" 29 | } 30 | lintOptions { 31 | abortOnError false 32 | } 33 | } 34 | 35 | repositories { 36 | google() 37 | mavenCentral() 38 | maven { url "https://maven.google.com" } 39 | maven { url "https://jitpack.io" } 40 | } 41 | 42 | dependencies { 43 | implementation 'com.facebook.react:react-native:+' 44 | implementation 'com.github.GrenderG:Toasty:1.5.0' 45 | } 46 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /android/src/main/java/ui/toasty/RNToastyModule.java: -------------------------------------------------------------------------------- 1 | 2 | package ui.toasty; 3 | 4 | import com.facebook.react.bridge.ReactApplicationContext; 5 | import com.facebook.react.bridge.ReactContextBaseJavaModule; 6 | import com.facebook.react.bridge.ReactMethod; 7 | import com.facebook.react.bridge.ReadableMap; 8 | 9 | import java.lang.reflect.Method; 10 | import java.util.Map; 11 | 12 | import android.util.Log; 13 | import android.annotation.TargetApi; 14 | import android.graphics.Canvas; 15 | import android.graphics.Bitmap; 16 | import android.graphics.BitmapFactory; 17 | import android.graphics.Rect; 18 | import android.graphics.Paint; 19 | import android.graphics.Typeface; 20 | import android.content.res.Resources; 21 | import android.graphics.drawable.BitmapDrawable; 22 | import android.graphics.drawable.Drawable; 23 | import android.graphics.drawable.DrawableContainer; 24 | import com.facebook.react.views.text.ReactFontManager; 25 | 26 | import android.os.StrictMode; 27 | 28 | import android.graphics.Color; 29 | import android.view.Gravity; 30 | import android.widget.Toast; 31 | 32 | import es.dmoral.toasty.Toasty; 33 | 34 | public class RNToastyModule extends ReactContextBaseJavaModule { 35 | 36 | public RNToastyModule(ReactApplicationContext reactContext) { 37 | super(reactContext); 38 | } 39 | 40 | @Override 41 | public String getName() { 42 | return "RNToasty"; 43 | } 44 | 45 | @ReactMethod 46 | public void Show(final ReadableMap props) { 47 | 48 | Toasty.Config config = Toasty.Config.getInstance(); 49 | 50 | int type = props.getInt("type"); 51 | 52 | String title = props.getString("title"); 53 | int titleSize = props.getInt("titleSize"); 54 | String titleColor = props.getString("titleColor"); 55 | 56 | int duration = props.getInt("duration"); 57 | String tintColor = props.getString("tintColor"); 58 | 59 | boolean withIcon = props.getBoolean("withIcon"); 60 | ReadableMap icon = props.hasKey("icon") ? props.getMap("icon") : null; 61 | 62 | String fontFamily = props.getString("fontFamily"); 63 | 64 | String position = props.getString("position"); 65 | int offsetX = props.getInt("offsetX"); 66 | int offsetY = props.getInt("offsetY"); 67 | 68 | Drawable iconDrawable = null; 69 | 70 | if (withIcon) { 71 | if (icon != null && icon.toHashMap().size() > 0) { 72 | try { 73 | Class clazz = Class.forName("prscx.imagehelper.RNImageHelperModule"); //Controller A or B 74 | Class params[] = {ReadableMap.class}; 75 | Method method = clazz.getDeclaredMethod("GenerateImage", params); 76 | 77 | iconDrawable = (Drawable) method.invoke(null, icon); 78 | } catch (Exception e) { 79 | Log.d("", ""); 80 | } 81 | } 82 | } 83 | 84 | if (titleSize != 0) { 85 | config.setTextSize(titleSize); 86 | } 87 | 88 | if(fontFamily.length() > 0) { 89 | Typeface typeface = Typeface.createFromAsset(getCurrentActivity().getAssets(),"fonts/" + fontFamily + ".ttf"); 90 | config.setToastTypeface(typeface); 91 | } 92 | 93 | config.apply(); // required 94 | 95 | Toast toast = null; 96 | 97 | if (tintColor.length() <= 0 && icon == null ) { 98 | switch (type) { 99 | case 0: 100 | toast = Toasty.normal(getCurrentActivity(), title, duration); 101 | break; 102 | case 1: 103 | toast = Toasty.info(getCurrentActivity(), title, duration, withIcon); 104 | break; 105 | case 2: 106 | toast = Toasty.success(getCurrentActivity(), title, duration, withIcon); 107 | break; 108 | case 3: 109 | toast = Toasty.warning(getCurrentActivity(), title, duration, withIcon); 110 | break; 111 | case 4: 112 | toast = Toasty.error(getCurrentActivity(), title, duration, withIcon); 113 | break; 114 | } 115 | } else { 116 | toast = Toasty.custom(getCurrentActivity(), title, iconDrawable, Color.parseColor(tintColor), Color.parseColor(titleColor), duration, withIcon, true); 117 | } 118 | 119 | if(toast != null) { 120 | toast.setGravity(getGravity((position)), offsetX, offsetY); 121 | toast.show(); 122 | } 123 | } 124 | 125 | private int getGravity(String gravity) { 126 | switch(gravity) { 127 | case "top": 128 | return Gravity.TOP; 129 | case "center": 130 | return Gravity.CENTER; 131 | case "bottom": 132 | default: 133 | return Gravity.BOTTOM; 134 | } 135 | }; 136 | } 137 | -------------------------------------------------------------------------------- /android/src/main/java/ui/toasty/RNToastyPackage.java: -------------------------------------------------------------------------------- 1 | 2 | package ui.toasty; 3 | 4 | import com.facebook.react.ReactPackage; 5 | import com.facebook.react.bridge.JavaScriptModule; 6 | import com.facebook.react.bridge.NativeModule; 7 | import com.facebook.react.bridge.ReactApplicationContext; 8 | import com.facebook.react.uimanager.ViewManager; 9 | 10 | import java.util.Arrays; 11 | import java.util.Collections; 12 | import java.util.List; 13 | 14 | public class RNToastyPackage implements ReactPackage { 15 | @Override 16 | public List createNativeModules(ReactApplicationContext reactContext) { 17 | return Arrays.asList(new RNToastyModule(reactContext)); 18 | } 19 | 20 | // Deprecated from RN 0.47 21 | public List> createJSModules() { 22 | return Collections.emptyList(); 23 | } 24 | 25 | @Override 26 | public List createViewManagers(ReactApplicationContext reactContext) { 27 | return Collections.emptyList(); 28 | } 29 | } -------------------------------------------------------------------------------- /index.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'react-native-toasty' { 2 | export interface Options { 3 | title: string; 4 | titleSize?: number; 5 | titleColor?: string; 6 | duration?: 0 | 1; 7 | tintColor?: string; 8 | withIcon?: boolean; 9 | icon?: Element; 10 | fontFamily?: string; 11 | position?: 'top' | 'center' | 'bottom'; 12 | /** 13 | * Android only 14 | */ 15 | offsetX?: number; 16 | /** 17 | * Android only 18 | */ 19 | offsetY?: number; 20 | } 21 | 22 | export var RNToasty: { 23 | Show: (options: Options) => void; 24 | Normal: (options: Options) => void; 25 | Info: (options: Options) => void; 26 | Success: (options: Options) => void; 27 | Warn: (options: Options) => void; 28 | Error: (options: Options) => void; 29 | }; 30 | } 31 | -------------------------------------------------------------------------------- /ios/RNToasty.h: -------------------------------------------------------------------------------- 1 | 2 | #if __has_include("RCTBridgeModule.h") 3 | #import "RCTBridgeModule.h" 4 | #else 5 | #import 6 | #endif 7 | 8 | #import "UIView+Toast.h" 9 | #import "RNImageHelper.h" 10 | 11 | @interface RNToasty : NSObject 12 | 13 | @end 14 | 15 | -------------------------------------------------------------------------------- /ios/RNToasty.m: -------------------------------------------------------------------------------- 1 | 2 | #import "RNToasty.h" 3 | #import "RCTUtils.h" 4 | 5 | @implementation RNToasty 6 | 7 | - (dispatch_queue_t)methodQueue 8 | { 9 | return dispatch_get_main_queue(); 10 | } 11 | RCT_EXPORT_MODULE() 12 | 13 | 14 | RCT_EXPORT_METHOD(Show:(NSDictionary *)props) { 15 | NSNumber *type = [props objectForKey: @"type"]; 16 | 17 | NSString *title = [props objectForKey: @"title"]; 18 | NSNumber *titleSize = [props objectForKey: @"titleSize"]; 19 | NSString *titleColor = [props objectForKey: @"titleColor"]; 20 | 21 | NSNumber *duration = [props objectForKey: @"duration"]; 22 | NSString *tintColor = [props objectForKey: @"tintColor"]; 23 | 24 | NSNumber *withIcon = [props objectForKey: @"withIcon"]; 25 | NSDictionary *icon = [props objectForKey: @"icon"]; 26 | UIImage *drawable = nil; 27 | 28 | NSString *position = [props objectForKey: @"position"]; 29 | 30 | CSToastStyle *style = [[CSToastStyle alloc] initWithDefaultStyle]; 31 | 32 | if (icon != nil && [icon count] > 0 && [withIcon intValue] == 1) { 33 | drawable = [RNImageHelper GenerateImage: icon]; 34 | } 35 | if (tintColor != nil && [tintColor length] > 0) { 36 | style.backgroundColor = [RNImageHelper ColorFromHexCode: tintColor]; 37 | } 38 | if (drawable != nil) { 39 | style.imageSize = drawable.size; 40 | } 41 | if (titleColor != nil && [titleColor length] > 0) { 42 | style.titleColor = [RNImageHelper ColorFromHexCode: titleColor]; 43 | } 44 | if (titleSize != nil && ![titleSize isEqual:@0]) { 45 | style.messageFont = [UIFont systemFontOfSize: [titleSize intValue]]; 46 | } 47 | 48 | if(duration != nil) { 49 | duration = duration.intValue == 0 ? [NSNumber numberWithFloat:1.0] : [NSNumber numberWithFloat:3.0]; 50 | } 51 | 52 | const NSString *toastPosition = [self getPosition: position]; 53 | 54 | UIWindow *window = [[UIApplication sharedApplication] keyWindow]; 55 | 56 | // toast with all possible options 57 | [window 58 | makeToast: title 59 | duration: duration.floatValue 60 | position: toastPosition 61 | title: nil 62 | image: drawable 63 | style: style 64 | completion:^(BOOL didTap) { 65 | if (didTap) { 66 | NSLog(@"completion from tap"); 67 | } else { 68 | NSLog(@"completion without tap"); 69 | } 70 | }]; 71 | } 72 | 73 | - (const NSString *__strong) getPosition: (NSString *)position { 74 | if([position isEqualToString:@"top"]) { 75 | return CSToastPositionTop; 76 | } else if([position isEqualToString:@"center"]) { 77 | return CSToastPositionCenter; 78 | } else { 79 | return CSToastPositionBottom; 80 | } 81 | } 82 | 83 | @end 84 | 85 | -------------------------------------------------------------------------------- /ios/RNToasty.podspec: -------------------------------------------------------------------------------- 1 | require 'json' 2 | 3 | package = JSON.parse(File.read(File.join(__dir__, '../package.json'))) 4 | 5 | Pod::Spec.new do |s| 6 | s.name = 'RNToasty' 7 | s.version = package['version'] 8 | s.summary = package['description'] 9 | s.description = package['description'] 10 | s.homepage = package['homepage'] 11 | s.license = package['license'] 12 | s.author = package['author'] 13 | s.source = { :git => 'https://github.com/prscX/react-native-toasty.git', :tag => s.version } 14 | 15 | s.platform = :ios, '9.0' 16 | s.ios.deployment_target = '8.0' 17 | 18 | s.preserve_paths = 'LICENSE', 'package.json' 19 | s.source_files = '**/*.{h,m}' 20 | s.dependency 'React-Core' 21 | s.dependency 'RNImageHelper' 22 | s.dependency 'Toast', '~> 4.0.0' 23 | 24 | end -------------------------------------------------------------------------------- /ios/RNToasty.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | B3E7B58A1CC2AC0600A0062D /* RNToasty.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RNToasty.m */; }; 11 | CE0DFE3720DAA92300EF6AAE /* libToast.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CE0DFE3620DAA91700EF6AAE /* libToast.a */; }; 12 | /* End PBXBuildFile section */ 13 | 14 | /* Begin PBXContainerItemProxy section */ 15 | CE0DFE3320DAA91700EF6AAE /* PBXContainerItemProxy */ = { 16 | isa = PBXContainerItemProxy; 17 | containerPortal = CE0DFE2E20DAA91700EF6AAE /* Pods.xcodeproj */; 18 | proxyType = 2; 19 | remoteGlobalIDString = 91223D1B2D1DF18D3983FC33AFD0C8AA; 20 | remoteInfo = "Pods-RNToasty"; 21 | }; 22 | CE0DFE3520DAA91700EF6AAE /* PBXContainerItemProxy */ = { 23 | isa = PBXContainerItemProxy; 24 | containerPortal = CE0DFE2E20DAA91700EF6AAE /* Pods.xcodeproj */; 25 | proxyType = 2; 26 | remoteGlobalIDString = 0AD8007B17BE61443AF72E075452B834; 27 | remoteInfo = Toast; 28 | }; 29 | /* End PBXContainerItemProxy section */ 30 | 31 | /* Begin PBXCopyFilesBuildPhase section */ 32 | 58B511D91A9E6C8500147676 /* CopyFiles */ = { 33 | isa = PBXCopyFilesBuildPhase; 34 | buildActionMask = 2147483647; 35 | dstPath = "include/$(PRODUCT_NAME)"; 36 | dstSubfolderSpec = 16; 37 | files = ( 38 | ); 39 | runOnlyForDeploymentPostprocessing = 0; 40 | }; 41 | /* End PBXCopyFilesBuildPhase section */ 42 | 43 | /* Begin PBXFileReference section */ 44 | 134814201AA4EA6300B7C361 /* libRNToasty.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNToasty.a; sourceTree = BUILT_PRODUCTS_DIR; }; 45 | 27193CFD3B5B7A709D45F626 /* Pods-RNToasty.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNToasty.release.xcconfig"; path = "Pods/Target Support Files/Pods-RNToasty/Pods-RNToasty.release.xcconfig"; sourceTree = ""; }; 46 | B3E7B5881CC2AC0600A0062D /* RNToasty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNToasty.h; sourceTree = ""; }; 47 | B3E7B5891CC2AC0600A0062D /* RNToasty.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNToasty.m; sourceTree = ""; }; 48 | BB81F0E820F6DC85231BBAFE /* libPods-RNToasty.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RNToasty.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 49 | CE0DFE2E20DAA91700EF6AAE /* Pods.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Pods.xcodeproj; path = Pods/Pods.xcodeproj; sourceTree = ""; }; 50 | EAA3A646FD62FC4B71C158BE /* Pods-RNToasty.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNToasty.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RNToasty/Pods-RNToasty.debug.xcconfig"; sourceTree = ""; }; 51 | /* End PBXFileReference section */ 52 | 53 | /* Begin PBXFrameworksBuildPhase section */ 54 | 58B511D81A9E6C8500147676 /* Frameworks */ = { 55 | isa = PBXFrameworksBuildPhase; 56 | buildActionMask = 2147483647; 57 | files = ( 58 | CE0DFE3720DAA92300EF6AAE /* libToast.a in Frameworks */, 59 | ); 60 | runOnlyForDeploymentPostprocessing = 0; 61 | }; 62 | /* End PBXFrameworksBuildPhase section */ 63 | 64 | /* Begin PBXGroup section */ 65 | 134814211AA4EA7D00B7C361 /* Products */ = { 66 | isa = PBXGroup; 67 | children = ( 68 | 134814201AA4EA6300B7C361 /* libRNToasty.a */, 69 | ); 70 | name = Products; 71 | sourceTree = ""; 72 | }; 73 | 3268B46873044FE3F3C4AD86 /* Pods */ = { 74 | isa = PBXGroup; 75 | children = ( 76 | EAA3A646FD62FC4B71C158BE /* Pods-RNToasty.debug.xcconfig */, 77 | 27193CFD3B5B7A709D45F626 /* Pods-RNToasty.release.xcconfig */, 78 | ); 79 | name = Pods; 80 | sourceTree = ""; 81 | }; 82 | 58B511D21A9E6C8500147676 = { 83 | isa = PBXGroup; 84 | children = ( 85 | B3E7B5881CC2AC0600A0062D /* RNToasty.h */, 86 | B3E7B5891CC2AC0600A0062D /* RNToasty.m */, 87 | 134814211AA4EA7D00B7C361 /* Products */, 88 | 3268B46873044FE3F3C4AD86 /* Pods */, 89 | E494376732E8E96B642C1702 /* Frameworks */, 90 | ); 91 | sourceTree = ""; 92 | }; 93 | CE0DFE2F20DAA91700EF6AAE /* Products */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | CE0DFE3420DAA91700EF6AAE /* libPods-RNToasty.a */, 97 | CE0DFE3620DAA91700EF6AAE /* libToast.a */, 98 | ); 99 | name = Products; 100 | sourceTree = ""; 101 | }; 102 | E494376732E8E96B642C1702 /* Frameworks */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | CE0DFE2E20DAA91700EF6AAE /* Pods.xcodeproj */, 106 | BB81F0E820F6DC85231BBAFE /* libPods-RNToasty.a */, 107 | ); 108 | name = Frameworks; 109 | sourceTree = ""; 110 | }; 111 | /* End PBXGroup section */ 112 | 113 | /* Begin PBXNativeTarget section */ 114 | 58B511DA1A9E6C8500147676 /* RNToasty */ = { 115 | isa = PBXNativeTarget; 116 | buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNToasty" */; 117 | buildPhases = ( 118 | 57A10DDCE20C967721D36A78 /* [CP] Check Pods Manifest.lock */, 119 | 58B511D71A9E6C8500147676 /* Sources */, 120 | 58B511D81A9E6C8500147676 /* Frameworks */, 121 | 58B511D91A9E6C8500147676 /* CopyFiles */, 122 | ); 123 | buildRules = ( 124 | ); 125 | dependencies = ( 126 | ); 127 | name = RNToasty; 128 | productName = RCTDataManager; 129 | productReference = 134814201AA4EA6300B7C361 /* libRNToasty.a */; 130 | productType = "com.apple.product-type.library.static"; 131 | }; 132 | /* End PBXNativeTarget section */ 133 | 134 | /* Begin PBXProject section */ 135 | 58B511D31A9E6C8500147676 /* Project object */ = { 136 | isa = PBXProject; 137 | attributes = { 138 | LastUpgradeCheck = 0830; 139 | ORGANIZATIONNAME = Facebook; 140 | TargetAttributes = { 141 | 58B511DA1A9E6C8500147676 = { 142 | CreatedOnToolsVersion = 6.1.1; 143 | }; 144 | }; 145 | }; 146 | buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNToasty" */; 147 | compatibilityVersion = "Xcode 3.2"; 148 | developmentRegion = English; 149 | hasScannedForEncodings = 0; 150 | knownRegions = ( 151 | en, 152 | ); 153 | mainGroup = 58B511D21A9E6C8500147676; 154 | productRefGroup = 58B511D21A9E6C8500147676; 155 | projectDirPath = ""; 156 | projectReferences = ( 157 | { 158 | ProductGroup = CE0DFE2F20DAA91700EF6AAE /* Products */; 159 | ProjectRef = CE0DFE2E20DAA91700EF6AAE /* Pods.xcodeproj */; 160 | }, 161 | ); 162 | projectRoot = ""; 163 | targets = ( 164 | 58B511DA1A9E6C8500147676 /* RNToasty */, 165 | ); 166 | }; 167 | /* End PBXProject section */ 168 | 169 | /* Begin PBXReferenceProxy section */ 170 | CE0DFE3420DAA91700EF6AAE /* libPods-RNToasty.a */ = { 171 | isa = PBXReferenceProxy; 172 | fileType = archive.ar; 173 | path = "libPods-RNToasty.a"; 174 | remoteRef = CE0DFE3320DAA91700EF6AAE /* PBXContainerItemProxy */; 175 | sourceTree = BUILT_PRODUCTS_DIR; 176 | }; 177 | CE0DFE3620DAA91700EF6AAE /* libToast.a */ = { 178 | isa = PBXReferenceProxy; 179 | fileType = archive.ar; 180 | path = libToast.a; 181 | remoteRef = CE0DFE3520DAA91700EF6AAE /* PBXContainerItemProxy */; 182 | sourceTree = BUILT_PRODUCTS_DIR; 183 | }; 184 | /* End PBXReferenceProxy section */ 185 | 186 | /* Begin PBXShellScriptBuildPhase section */ 187 | 57A10DDCE20C967721D36A78 /* [CP] Check Pods Manifest.lock */ = { 188 | isa = PBXShellScriptBuildPhase; 189 | buildActionMask = 2147483647; 190 | files = ( 191 | ); 192 | inputPaths = ( 193 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 194 | "${PODS_ROOT}/Manifest.lock", 195 | ); 196 | name = "[CP] Check Pods Manifest.lock"; 197 | outputPaths = ( 198 | "$(DERIVED_FILE_DIR)/Pods-RNToasty-checkManifestLockResult.txt", 199 | ); 200 | runOnlyForDeploymentPostprocessing = 0; 201 | shellPath = /bin/sh; 202 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 203 | showEnvVarsInLog = 0; 204 | }; 205 | /* End PBXShellScriptBuildPhase section */ 206 | 207 | /* Begin PBXSourcesBuildPhase section */ 208 | 58B511D71A9E6C8500147676 /* Sources */ = { 209 | isa = PBXSourcesBuildPhase; 210 | buildActionMask = 2147483647; 211 | files = ( 212 | B3E7B58A1CC2AC0600A0062D /* RNToasty.m in Sources */, 213 | ); 214 | runOnlyForDeploymentPostprocessing = 0; 215 | }; 216 | /* End PBXSourcesBuildPhase section */ 217 | 218 | /* Begin XCBuildConfiguration section */ 219 | 58B511ED1A9E6C8500147676 /* Debug */ = { 220 | isa = XCBuildConfiguration; 221 | buildSettings = { 222 | ALWAYS_SEARCH_USER_PATHS = NO; 223 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 224 | CLANG_CXX_LIBRARY = "libc++"; 225 | CLANG_ENABLE_MODULES = YES; 226 | CLANG_ENABLE_OBJC_ARC = YES; 227 | CLANG_WARN_BOOL_CONVERSION = YES; 228 | CLANG_WARN_CONSTANT_CONVERSION = YES; 229 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 230 | CLANG_WARN_EMPTY_BODY = YES; 231 | CLANG_WARN_ENUM_CONVERSION = YES; 232 | CLANG_WARN_INFINITE_RECURSION = YES; 233 | CLANG_WARN_INT_CONVERSION = YES; 234 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 235 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 236 | CLANG_WARN_UNREACHABLE_CODE = YES; 237 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 238 | COPY_PHASE_STRIP = NO; 239 | ENABLE_STRICT_OBJC_MSGSEND = YES; 240 | ENABLE_TESTABILITY = YES; 241 | GCC_C_LANGUAGE_STANDARD = gnu99; 242 | GCC_DYNAMIC_NO_PIC = NO; 243 | GCC_NO_COMMON_BLOCKS = YES; 244 | GCC_OPTIMIZATION_LEVEL = 0; 245 | GCC_PREPROCESSOR_DEFINITIONS = ( 246 | "DEBUG=1", 247 | "$(inherited)", 248 | ); 249 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 250 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 251 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 252 | GCC_WARN_UNDECLARED_SELECTOR = YES; 253 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 254 | GCC_WARN_UNUSED_FUNCTION = YES; 255 | GCC_WARN_UNUSED_VARIABLE = YES; 256 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 257 | MTL_ENABLE_DEBUG_INFO = YES; 258 | ONLY_ACTIVE_ARCH = YES; 259 | SDKROOT = iphoneos; 260 | }; 261 | name = Debug; 262 | }; 263 | 58B511EE1A9E6C8500147676 /* Release */ = { 264 | isa = XCBuildConfiguration; 265 | buildSettings = { 266 | ALWAYS_SEARCH_USER_PATHS = NO; 267 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 268 | CLANG_CXX_LIBRARY = "libc++"; 269 | CLANG_ENABLE_MODULES = YES; 270 | CLANG_ENABLE_OBJC_ARC = YES; 271 | CLANG_WARN_BOOL_CONVERSION = YES; 272 | CLANG_WARN_CONSTANT_CONVERSION = YES; 273 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 274 | CLANG_WARN_EMPTY_BODY = YES; 275 | CLANG_WARN_ENUM_CONVERSION = YES; 276 | CLANG_WARN_INFINITE_RECURSION = YES; 277 | CLANG_WARN_INT_CONVERSION = YES; 278 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 279 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 280 | CLANG_WARN_UNREACHABLE_CODE = YES; 281 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 282 | COPY_PHASE_STRIP = YES; 283 | ENABLE_NS_ASSERTIONS = NO; 284 | ENABLE_STRICT_OBJC_MSGSEND = YES; 285 | GCC_C_LANGUAGE_STANDARD = gnu99; 286 | GCC_NO_COMMON_BLOCKS = YES; 287 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 288 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 289 | GCC_WARN_UNDECLARED_SELECTOR = YES; 290 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 291 | GCC_WARN_UNUSED_FUNCTION = YES; 292 | GCC_WARN_UNUSED_VARIABLE = YES; 293 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 294 | MTL_ENABLE_DEBUG_INFO = NO; 295 | SDKROOT = iphoneos; 296 | VALIDATE_PRODUCT = YES; 297 | }; 298 | name = Release; 299 | }; 300 | 58B511F01A9E6C8500147676 /* Debug */ = { 301 | isa = XCBuildConfiguration; 302 | baseConfigurationReference = EAA3A646FD62FC4B71C158BE /* Pods-RNToasty.debug.xcconfig */; 303 | buildSettings = { 304 | HEADER_SEARCH_PATHS = ( 305 | "$(inherited)", 306 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 307 | "$(SRCROOT)/../../../React/**", 308 | "$(SRCROOT)/../../react-native/React/**", 309 | ); 310 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 311 | OTHER_LDFLAGS = "-ObjC"; 312 | PRODUCT_NAME = RNToasty; 313 | SKIP_INSTALL = YES; 314 | }; 315 | name = Debug; 316 | }; 317 | 58B511F11A9E6C8500147676 /* Release */ = { 318 | isa = XCBuildConfiguration; 319 | baseConfigurationReference = 27193CFD3B5B7A709D45F626 /* Pods-RNToasty.release.xcconfig */; 320 | buildSettings = { 321 | HEADER_SEARCH_PATHS = ( 322 | "$(inherited)", 323 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 324 | "$(SRCROOT)/../../../React/**", 325 | "$(SRCROOT)/../../react-native/React/**", 326 | ); 327 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 328 | OTHER_LDFLAGS = "-ObjC"; 329 | PRODUCT_NAME = RNToasty; 330 | SKIP_INSTALL = YES; 331 | }; 332 | name = Release; 333 | }; 334 | /* End XCBuildConfiguration section */ 335 | 336 | /* Begin XCConfigurationList section */ 337 | 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNToasty" */ = { 338 | isa = XCConfigurationList; 339 | buildConfigurations = ( 340 | 58B511ED1A9E6C8500147676 /* Debug */, 341 | 58B511EE1A9E6C8500147676 /* Release */, 342 | ); 343 | defaultConfigurationIsVisible = 0; 344 | defaultConfigurationName = Release; 345 | }; 346 | 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNToasty" */ = { 347 | isa = XCConfigurationList; 348 | buildConfigurations = ( 349 | 58B511F01A9E6C8500147676 /* Debug */, 350 | 58B511F11A9E6C8500147676 /* Release */, 351 | ); 352 | defaultConfigurationIsVisible = 0; 353 | defaultConfigurationName = Release; 354 | }; 355 | /* End XCConfigurationList section */ 356 | }; 357 | rootObject = 58B511D31A9E6C8500147676 /* Project object */; 358 | } 359 | -------------------------------------------------------------------------------- /ios/RNToasty.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /js/RNToasty.js: -------------------------------------------------------------------------------- 1 | import PropTypes from 'prop-types' 2 | import React, { PureComponent } from 'react' 3 | import { NativeModules, Platform, ViewPropTypes } from 'react-native' 4 | import Feather from 'react-native-vector-icons/Feather' 5 | import RNVectorHelper from './RNVectorHelper' 6 | 7 | const { RNToasty } = NativeModules 8 | 9 | class Toasty extends PureComponent { 10 | static propTypes = { 11 | ...ViewPropTypes, 12 | 13 | type: PropTypes.number, 14 | 15 | title: PropTypes.string, 16 | titleSize: PropTypes.number, 17 | titleColor: PropTypes.string, 18 | 19 | duration: PropTypes.number, 20 | tintColor: PropTypes.string, 21 | 22 | withIcon: PropTypes.bool, 23 | icon: PropTypes.object, 24 | fontFamily: PropTypes.string, 25 | 26 | position: PropTypes.string, 27 | offsetX: PropTypes.number, 28 | offsetY: PropTypes.number, 29 | } 30 | 31 | static defaultProps = { 32 | type: 0, 33 | 34 | title: '', 35 | titleSize: 0, 36 | titleColor: '#ffffff', 37 | 38 | duration: 0, 39 | 40 | tintColor: '', 41 | withIcon: true, 42 | 43 | position: 'bottom', 44 | offsetX: 0, 45 | offsetY: 50, 46 | } 47 | 48 | static Duration = { 49 | Short: 0, 50 | Long: 1, 51 | } 52 | 53 | static Types = { 54 | Normal: 0, 55 | Info: 1, 56 | Success: 2, 57 | Warn: 3, 58 | Error: 4, 59 | } 60 | 61 | static Show(props) { 62 | if (!props) props = {} 63 | if (props.type === undefined) props.type = Toasty.defaultProps.type 64 | // name of font 65 | if (props.fontFamily === undefined) props.fontFamily = '' 66 | if (props.title === undefined) props.title = Toasty.defaultProps.title 67 | if (props.titleSize === undefined) 68 | props.titleSize = Toasty.defaultProps.titleSize 69 | if (props.titleColor === undefined) 70 | props.titleColor = Toasty.defaultProps.titleColor 71 | 72 | if (props.duration === undefined) 73 | props.duration = Toasty.defaultProps.duration 74 | 75 | if (props.tintColor === undefined) 76 | props.tintColor = Toasty.defaultProps.tintColor 77 | if (props.withIcon === undefined) 78 | props.withIcon = Toasty.defaultProps.withIcon 79 | 80 | if (props.withIcon) { 81 | if (props.icon && props.icon.props) { 82 | let icon = props.icon.props 83 | 84 | let vectorIcon = RNVectorHelper.Resolve(icon.family, icon.name) 85 | props.icon = Object.assign({}, icon, vectorIcon) 86 | } 87 | } else { 88 | props.icon = undefined 89 | } 90 | 91 | if (props.position === undefined) 92 | props.position = Toasty.defaultProps.position 93 | 94 | if (props.offsetX === undefined) props.offsetX = Toasty.defaultProps.offsetX 95 | 96 | if (props.offsetY === undefined) props.offsetY = Toasty.defaultProps.offsetY 97 | 98 | RNToasty.Show(props) 99 | } 100 | 101 | static successStyle = { 102 | tintColor: '#4b994f', 103 | icon: ( 104 | 110 | ), 111 | } 112 | static Success(props) { 113 | if (!props) props = {} 114 | if (props.tintColor === undefined && Platform.OS === 'ios') 115 | props.tintColor = Toasty.successStyle.tintColor 116 | if (props.icon === undefined && Platform.OS === 'ios') 117 | props.icon = Toasty.successStyle.icon 118 | 119 | props.type = Toasty.Types.Success 120 | 121 | Toasty.Show(props) 122 | } 123 | 124 | static errorStyle = { 125 | tintColor: '#d81919', 126 | icon: ( 127 | 133 | ), 134 | } 135 | static Error(props) { 136 | if (!props) props = {} 137 | if (props.tintColor === undefined && Platform.OS === 'ios') 138 | props.tintColor = Toasty.errorStyle.tintColor 139 | if (props.icon === undefined && Platform.OS === 'ios') 140 | props.icon = Toasty.errorStyle.icon 141 | 142 | props.type = Toasty.Types.Error 143 | 144 | Toasty.Show(props) 145 | } 146 | 147 | static infoStyle = { 148 | tintColor: '#5162bc', 149 | icon: ( 150 | 151 | ), 152 | } 153 | static Info(props) { 154 | if (!props) props = {} 155 | if (props.tintColor === undefined && Platform.OS === 'ios') 156 | props.tintColor = Toasty.infoStyle.tintColor 157 | if (props.icon === undefined && Platform.OS === 'ios') 158 | props.icon = Toasty.infoStyle.icon 159 | 160 | props.type = Toasty.Types.Info 161 | 162 | Toasty.Show(props) 163 | } 164 | 165 | static warnStyle = { 166 | tintColor: '#feb119', 167 | icon: ( 168 | 174 | ), 175 | } 176 | static Warn(props) { 177 | if (!props) props = {} 178 | if (props.tintColor === undefined && Platform.OS === 'ios') 179 | props.tintColor = Toasty.warnStyle.tintColor 180 | if (props.icon === undefined && Platform.OS === 'ios') 181 | props.icon = Toasty.warnStyle.icon 182 | 183 | props.type = Toasty.Types.Warn 184 | 185 | Toasty.Show(props) 186 | } 187 | 188 | static normalStyle = { 189 | tintColor: '#484d51', 190 | } 191 | static Normal(props) { 192 | if (!props) props = {} 193 | if (props.tintColor === undefined && Platform.OS === 'ios') 194 | props.tintColor = Toasty.normalStyle.tintColor 195 | 196 | props.type = Toasty.Types.Normal 197 | 198 | Toasty.Show(props) 199 | } 200 | 201 | componentDidMount() {} 202 | 203 | componentDidUpdate() {} 204 | 205 | show() {} 206 | 207 | render() { 208 | return null 209 | } 210 | } 211 | 212 | export { Toasty as RNToasty } 213 | -------------------------------------------------------------------------------- /js/RNVectorHelper.js: -------------------------------------------------------------------------------- 1 | import EntypoGlyphMap from "react-native-vector-icons/glyphmaps/Entypo.json"; 2 | import EvilIconsGlyphMap from "react-native-vector-icons/glyphmaps/EvilIcons.json"; 3 | import FeatherGlyphMap from "react-native-vector-icons/glyphmaps/Feather.json"; 4 | import FontAwesomeGlyphMap from "react-native-vector-icons/glyphmaps/FontAwesome.json"; 5 | import FoundationGlyphMap from "react-native-vector-icons/glyphmaps/Foundation.json"; 6 | import IoniconsGlyphMap from "react-native-vector-icons/glyphmaps/Ionicons.json"; 7 | import MaterialCommunityIconsGlyphMap from "react-native-vector-icons/glyphmaps/MaterialCommunityIcons.json"; 8 | import MaterialIconsGlyphMap from "react-native-vector-icons/glyphmaps/MaterialIcons.json"; 9 | import OcticonsGlyphMap from "react-native-vector-icons/glyphmaps/Octicons.json"; 10 | import SimpleLineIconsGlyphMap from "react-native-vector-icons/glyphmaps/SimpleLineIcons.json"; 11 | import ZocialGlyphMap from "react-native-vector-icons/glyphmaps/Zocial.json"; 12 | 13 | import { Platform } from "react-native"; 14 | 15 | class RNVectorHelper { 16 | static Resolve(family, name) { 17 | let glyph, fontFamily; 18 | 19 | switch (family) { 20 | case "Entypo": 21 | glyph = EntypoGlyphMap[name]; 22 | if (typeof glyph === "number") { 23 | glyph = String.fromCharCode(glyph); 24 | } 25 | fontFamily = "Entypo"; 26 | 27 | return { glyph: glyph, family: fontFamily }; 28 | case "EvilIcons": 29 | glyph = EvilIconsGlyphMap[name]; 30 | if (typeof glyph === "number") { 31 | glyph = String.fromCharCode(glyph); 32 | } 33 | fontFamily = "EvilIcons"; 34 | 35 | return { glyph: glyph, family: fontFamily }; 36 | case "Feather": 37 | glyph = FeatherGlyphMap[name]; 38 | if (typeof glyph === "number") { 39 | glyph = String.fromCharCode(glyph); 40 | } 41 | fontFamily = "Feather"; 42 | 43 | return { glyph: glyph, family: fontFamily }; 44 | case "FontAwesome": 45 | glyph = FontAwesomeGlyphMap[name]; 46 | if (typeof glyph === "number") { 47 | glyph = String.fromCharCode(glyph); 48 | } 49 | fontFamily = "FontAwesome"; 50 | 51 | return { glyph: glyph, family: fontFamily }; 52 | case "Foundation": 53 | glyph = FoundationGlyphMap[name]; 54 | if (typeof glyph === "number") { 55 | glyph = String.fromCharCode(glyph); 56 | } 57 | 58 | if (Platform.OS === "ios") { 59 | fontFamily = "fontcustom"; 60 | } else { 61 | fontFamily = "Foundation"; 62 | } 63 | 64 | return { glyph: glyph, family: fontFamily }; 65 | case "Ionicons": 66 | glyph = IoniconsGlyphMap[name]; 67 | if (typeof glyph === "number") { 68 | glyph = String.fromCharCode(glyph); 69 | } 70 | fontFamily = "Ionicons"; 71 | 72 | return { glyph: glyph, family: fontFamily }; 73 | case "MaterialCommunityIcons": 74 | glyph = MaterialCommunityIconsGlyphMap[name]; 75 | if (typeof glyph === "number") { 76 | glyph = String.fromCharCode(glyph); 77 | } 78 | 79 | if (Platform.OS === "ios") { 80 | fontFamily = "Material Design Icons"; 81 | } else { 82 | fontFamily = "MaterialCommunityIcons"; 83 | } 84 | 85 | return { glyph: glyph, family: fontFamily }; 86 | case "MaterialIcons": 87 | glyph = MaterialIconsGlyphMap[name]; 88 | if (typeof glyph === "number") { 89 | glyph = String.fromCharCode(glyph); 90 | } 91 | 92 | if (Platform.OS === "ios") { 93 | fontFamily = "Material Icons"; 94 | } else { 95 | fontFamily = "MaterialIcons"; 96 | } 97 | 98 | return { glyph: glyph, family: fontFamily }; 99 | case "Octicons": 100 | glyph = OcticonsGlyphMap[name]; 101 | if (typeof glyph === "number") { 102 | glyph = String.fromCharCode(glyph); 103 | } 104 | fontFamily = "Octicons"; 105 | 106 | return { glyph: glyph, family: fontFamily }; 107 | case "SimpleLineIcons": 108 | glyph = SimpleLineIconsGlyphMap[name]; 109 | if (typeof glyph === "number") { 110 | glyph = String.fromCharCode(glyph); 111 | } 112 | 113 | if (Platform.OS === "ios") { 114 | fontFamily = "simple-line-icons"; 115 | } else { 116 | fontFamily = "SimpleLineIcons"; 117 | } 118 | 119 | return { glyph: glyph, family: fontFamily }; 120 | case "Zocial": 121 | glyph = ZocialGlyphMap[name]; 122 | if (typeof glyph === "number") { 123 | glyph = String.fromCharCode(glyph); 124 | } 125 | 126 | if (Platform.OS === "ios") { 127 | fontFamily = "zocial"; 128 | } else { 129 | fontFamily = "Zocial"; 130 | } 131 | 132 | return { glyph: glyph, family: fontFamily }; 133 | } 134 | } 135 | } 136 | 137 | export default RNVectorHelper; 138 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-toasty", 3 | "version": "2.0.0", 4 | "description": "React Native: Native Toast", 5 | "main": "js/RNToasty.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [ 10 | "react-native" 11 | ], 12 | "homepage": "https://github.com/prscX/react-native-toasty.git", 13 | "author": "Pranav Raj Singh Chauhan", 14 | "license": "Apache License 2.0", 15 | "repository": { 16 | "type": "git", 17 | "url": "https://github.com/prscX/react-native-toasty.git" 18 | }, 19 | "dependencies": {}, 20 | "devDependencies": { 21 | "prettier-pack": "0.0.11" 22 | }, 23 | "peerDependencies": {} 24 | } 25 | --------------------------------------------------------------------------------