├── .gitignore ├── README.md ├── android ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── yaaliuzhipeng │ └── mlkit │ └── translatetext │ ├── MlkitTranslateTextModule.java │ └── MlkitTranslateTextPackage.java ├── example ├── .buckconfig ├── .eslintrc.js ├── .flowconfig ├── .gitignore ├── .prettierrc.js ├── .watchmanconfig ├── App.tsx ├── Gemfile ├── Gemfile.lock ├── MLKitTranslator.ts ├── __tests__ │ └── App-test.js ├── _bundle │ └── config ├── _ruby-version ├── android │ ├── app │ │ ├── _BUCK │ │ ├── build.gradle │ │ ├── build_defs.bzl │ │ ├── debug.keystore │ │ ├── proguard-rules.pro │ │ └── src │ │ │ ├── debug │ │ │ ├── AndroidManifest.xml │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── ReactNativeFlipper.java │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── example │ │ │ │ ├── MainActivity.java │ │ │ │ └── MainApplication.java │ │ │ └── res │ │ │ ├── drawable │ │ │ └── rn_edit_text_material.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── 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 │ ├── Podfile │ ├── Podfile.lock │ ├── 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 │ └── exampleTests │ │ ├── Info.plist │ │ └── exampleTests.m ├── metro.config.js ├── package.json ├── rn-cli.config.js ├── tsconfig.json └── yarn.lock ├── index.ts ├── ios ├── MlkitTranslateText.h ├── MlkitTranslateText.m ├── MlkitTranslateText.xcodeproj │ └── project.pbxproj └── MlkitTranslateText.xcworkspace │ └── contents.xcworkspacedata ├── package.json ├── raw └── logo.png ├── react-native-mlkit-translate-text.podspec ├── src └── MLKitTranslator.ts └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # node.js 6 | # 7 | node_modules/ 8 | npm-debug.log 9 | yarn-error.log 10 | 11 | # Xcode 12 | # 13 | build/ 14 | *.pbxuser 15 | !default.pbxuser 16 | *.mode1v3 17 | !default.mode1v3 18 | *.mode2v3 19 | !default.mode2v3 20 | *.perspectivev3 21 | !default.perspectivev3 22 | xcuserdata 23 | *.xccheckout 24 | *.moved-aside 25 | DerivedData 26 | *.hmap 27 | *.ipa 28 | *.xcuserstate 29 | project.xcworkspace 30 | 31 | # Android/IntelliJ 32 | # 33 | build/ 34 | .idea 35 | .gradle 36 | local.properties 37 | *.iml 38 | 39 | # BUCK 40 | buck-out/ 41 | \.buckd/ 42 | *.keystore 43 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ** 📢 ** 2 | ** Arhived ! Use New Library (support new arch) instead ** 3 | ([fast-mlkit-translate-text](https://github.com/yaaliuzhipeng/fast-mlkit-translate-text)) 4 | 5 | 6 |

7 | MLKitTranslator 8 |

9 | 10 |

11 | A MachineLearning Language Translator 12 |

13 | 14 |

15 | Build Powerful React Native With Greate Language Identifier And Translator Amazing ⚡️ 16 |

17 | 18 |

19 | 20 | MIT License 21 | 22 |

23 | 24 | | | MLKitTranslator | 25 | | --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 26 | | ⚡️ | **Identify Language Immediately** over 50 languages supported ([full list](https://developers.google.com/ml-kit/language/translation/translation-language-support)) | 27 | | 😎 | **Lazy loaded**. download models when needed | 28 | | 🔄 | **Offline-first.** no network required for using | 29 | | 📱 | **Multiplatform**. iOS, Android | 30 | | ⏱ | **Fast.** About TO Migrating to RN New Arch(JSI) | 31 | | 🔗 | **Relational.** Built on MLKit [Translation](https://developers.google.com/ml-kit/language/translation) foundation | 32 | | ⚠️ | **Static typing** Full-Support [TypeScript](https://typescriptlang.org) | 33 | 34 | ## Why MLKitTranslator? 35 | 36 | Key capabilities 37 | 38 | - Broad language support Translate between more than 50 different languages. See the complete list. 39 | - Proven translation models Powered by the same models used by the Google Translate app's offline mode. 40 | - Dynamic model management Keep on-device storage requirements low by dynamically downloading and managing language packs. 41 | - Runs on the device Translations are performed quickly, and don't require you to send users' text to a remote server. 42 | 43 | ## Installation 44 | 45 | > yarn add react-native-mlkit-entity-extraction 46 | 47 | or 48 | 49 | > npm i --save react-native-mlkit-entity-extraction 50 | 51 | ## Usage 52 | 53 | **Quick example:** identify language type 54 | 55 | ```typescript 56 | import MLKitTranslator, { LANG_TAGS } from './MLKitTranslator'; 57 | 58 | const Lang = 'Bonjour, c’est en français'; 59 | 60 | MLKitTranslator.identifyLanguage(text).then((result: string) => { 61 | setLanguageType(getHumanLang(result)); 62 | }); 63 | ``` 64 | 65 | **Translate text example:** identify 、download model and translate 66 | 67 | etc: you'd like to translate french to english 68 | 69 | 1️⃣ download model firstly 70 | 71 | ```js 72 | import MLKitTranslator, { LANG_TAGS } from './MLKitTranslator'; 73 | //better do this in async function 74 | await MLKitTranslator.downloadModel(LANG_TAGS.FRENCH); 75 | await MLKitTranslator.downloadModel(LANG_TAGS.ENGLISH); 76 | ``` 77 | 78 | Remember !✨ Always check model firstly ; 79 | **Do not translate text if the model is not downloaded** 80 | 81 | > use NativeMLKitTranslateText.isModelDownloaded to check 82 | 83 | 2️⃣ translate text 84 | 85 | ```js 86 | await MLKitTranslator.translateText(text, LANG_TAGS.FRENCH, LANG_TAGS.ENGLISH); 87 | 88 | // 🎉 got it, dude 89 | ``` 90 | 91 | ## Author and license 92 | 93 | **ReactNativeMLKitTranslateText** was created by [@yaaliuzhipeng](https://github.com/yaaliuzhipeng) 94 | 95 | react-native-mlkit-translate-text is available under the MIT license. See the [LICENSE file](./LICENSE) for more info. 96 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | // android/build.gradle 2 | 3 | // based on: 4 | // 5 | // * https://github.com/facebook/react-native/blob/0.60-stable/template/android/build.gradle 6 | // previous location: 7 | // - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/build.gradle 8 | // 9 | // * https://github.com/facebook/react-native/blob/0.60-stable/template/android/app/build.gradle 10 | // previous location: 11 | // - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/app/build.gradle 12 | 13 | // These defaults should reflect the SDK versions used by 14 | // the minimum React Native version supported. 15 | def DEFAULT_COMPILE_SDK_VERSION = 28 16 | def DEFAULT_BUILD_TOOLS_VERSION = '28.0.3' 17 | def DEFAULT_MIN_SDK_VERSION = 16 18 | def DEFAULT_TARGET_SDK_VERSION = 28 19 | 20 | def safeExtGet(prop, fallback) { 21 | rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback 22 | } 23 | 24 | apply plugin: 'com.android.library' 25 | 26 | buildscript { 27 | // The Android Gradle plugin is only required when opening the android folder stand-alone. 28 | // This avoids unnecessary downloads and potential conflicts when the library is included as a 29 | // module dependency in an application project. 30 | // ref: https://docs.gradle.org/current/userguide/tutorial_using_tasks.html#sec:build_script_external_dependencies 31 | if (project == rootProject) { 32 | repositories { 33 | google() 34 | } 35 | dependencies { 36 | // This should reflect the Gradle plugin version used by 37 | // the minimum React Native version supported. 38 | classpath 'com.android.tools.build:gradle:3.4.1' 39 | } 40 | } 41 | } 42 | 43 | android { 44 | compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION) 45 | buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION) 46 | defaultConfig { 47 | minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION) 48 | targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION) 49 | versionCode 1 50 | versionName "1.0" 51 | } 52 | lintOptions { 53 | abortOnError false 54 | } 55 | } 56 | 57 | repositories { 58 | // ref: https://www.baeldung.com/maven-local-repository 59 | mavenLocal() 60 | maven { 61 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 62 | url "$rootDir/../node_modules/react-native/android" 63 | } 64 | maven { 65 | // Android JSC is installed from npm 66 | url "$rootDir/../node_modules/jsc-android/dist" 67 | } 68 | google() 69 | } 70 | 71 | dependencies { 72 | //noinspection GradleDynamicVersion 73 | implementation 'com.facebook.react:react-native:+' // From node_modules 74 | implementation 'com.google.mlkit:language-id:17.0.3' 75 | implementation 'com.google.mlkit:translate:17.0.0' 76 | } 77 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /android/src/main/java/com/yaaliuzhipeng/mlkit/translatetext/MlkitTranslateTextModule.java: -------------------------------------------------------------------------------- 1 | package com.yaaliuzhipeng.mlkit.translatetext; 2 | 3 | import android.util.Log; 4 | 5 | import com.facebook.react.bridge.Arguments; 6 | import com.facebook.react.bridge.ReactApplicationContext; 7 | import com.facebook.react.bridge.ReactContextBaseJavaModule; 8 | import com.facebook.react.bridge.ReactMethod; 9 | import com.facebook.react.bridge.Callback; 10 | import com.facebook.react.bridge.WritableArray; 11 | import com.facebook.react.bridge.WritableMap; 12 | import com.google.mlkit.common.model.DownloadConditions; 13 | import com.google.mlkit.common.model.RemoteModelManager; 14 | import com.google.mlkit.nl.languageid.IdentifiedLanguage; 15 | import com.google.mlkit.nl.languageid.LanguageIdentification; 16 | import com.google.mlkit.nl.languageid.LanguageIdentifier; 17 | import com.google.mlkit.nl.translate.TranslateLanguage; 18 | import com.google.mlkit.nl.translate.TranslateRemoteModel; 19 | import com.google.mlkit.nl.translate.Translation; 20 | import com.google.mlkit.nl.translate.Translator; 21 | import com.google.mlkit.nl.translate.TranslatorOptions; 22 | 23 | public class MlkitTranslateTextModule extends ReactContextBaseJavaModule { 24 | 25 | private final String TAG = this.getName(); 26 | private final ReactApplicationContext reactContext; 27 | 28 | public MlkitTranslateTextModule(ReactApplicationContext reactContext) { 29 | super(reactContext); 30 | this.reactContext = reactContext; 31 | } 32 | 33 | @Override 34 | public String getName() { 35 | return "MLKitTranslateText"; 36 | } 37 | 38 | 39 | @ReactMethod 40 | void identifyLanguage(String text, Callback successCallback, Callback failCallback) { 41 | LanguageIdentifier languageIdentifier = LanguageIdentification.getClient(); 42 | languageIdentifier.identifyLanguage(text) 43 | .addOnSuccessListener(v -> { 44 | successCallback.invoke(v); 45 | languageIdentifier.close(); 46 | }) 47 | .addOnFailureListener(e -> { 48 | failCallback.invoke(e.getLocalizedMessage()); 49 | languageIdentifier.close(); 50 | }); 51 | } 52 | 53 | @ReactMethod 54 | void identifyPossibleLanguages(String text, Callback successCallback, Callback failCallback) { 55 | LanguageIdentifier languageIdentifier = LanguageIdentification.getClient(); 56 | languageIdentifier.identifyPossibleLanguages(text) 57 | .addOnSuccessListener(identifiedLanguages -> { 58 | WritableArray array = Arguments.createArray(); 59 | for (IdentifiedLanguage lang : identifiedLanguages) { 60 | String code = lang.getLanguageTag(); 61 | float confidence = lang.getConfidence(); 62 | WritableMap map = Arguments.createMap(); 63 | map.putString("code", code); 64 | map.putDouble("confidence", confidence); 65 | array.pushMap(map); 66 | } 67 | successCallback.invoke(array); 68 | }) 69 | .addOnFailureListener(e -> { 70 | failCallback.invoke(e.getLocalizedMessage()); 71 | }); 72 | } 73 | 74 | @ReactMethod 75 | void translateText(String text, String sourceLanguageTag, String targetLanguageTag, Callback successCallback, Callback failCallback) { 76 | String sourceL = TranslateLanguage.fromLanguageTag(sourceLanguageTag); 77 | String targetL = TranslateLanguage.fromLanguageTag(targetLanguageTag); 78 | if (sourceL == null) { 79 | failCallback.invoke("unsupport source language"); 80 | return; 81 | } 82 | if (targetL == null) { 83 | failCallback.invoke("unsupport target language"); 84 | return; 85 | } 86 | TranslatorOptions options = new TranslatorOptions.Builder() 87 | .setSourceLanguage(sourceL) 88 | .setTargetLanguage(targetL) 89 | .build(); 90 | final Translator translator = Translation.getClient(options); 91 | translator.translate(text) 92 | .addOnSuccessListener(v -> { 93 | successCallback.invoke(v); 94 | translator.close(); 95 | }) 96 | .addOnFailureListener(e -> { 97 | failCallback.invoke(e.getLocalizedMessage()); 98 | translator.close(); 99 | }); 100 | } 101 | 102 | @ReactMethod 103 | void isModelDownloaded(String lang, Callback callback) { 104 | RemoteModelManager modelManager = RemoteModelManager.getInstance(); 105 | TranslateRemoteModel lm = new TranslateRemoteModel 106 | .Builder(lang) 107 | .build(); 108 | modelManager.isModelDownloaded(lm) 109 | .addOnSuccessListener(callback::invoke); 110 | } 111 | 112 | @ReactMethod 113 | void deleteDownloadedModel(String lang, Callback successCallback, Callback failCallback) { 114 | RemoteModelManager modelManager = RemoteModelManager.getInstance(); 115 | TranslateRemoteModel lm = new TranslateRemoteModel 116 | .Builder(lang) 117 | .build(); 118 | modelManager.isModelDownloaded(lm) 119 | .addOnSuccessListener(v -> { 120 | if (v) { 121 | modelManager.deleteDownloadedModel(lm) 122 | .addOnSuccessListener(output -> { 123 | successCallback.invoke("success"); 124 | }) 125 | .addOnFailureListener(e -> { 126 | failCallback.invoke(e.getLocalizedMessage()); 127 | }); 128 | } 129 | }) 130 | .addOnFailureListener(e -> { 131 | failCallback.invoke(e.getLocalizedMessage()); 132 | }); 133 | } 134 | 135 | @ReactMethod 136 | void downloadModel(String lang, Callback successCallback, Callback failCallback) { 137 | RemoteModelManager modelManager = RemoteModelManager.getInstance(); 138 | TranslateRemoteModel lm = new TranslateRemoteModel 139 | .Builder(lang) 140 | .build(); 141 | modelManager.download(lm, new DownloadConditions.Builder().requireWifi().build()) 142 | .addOnSuccessListener(v -> { 143 | successCallback.invoke("success"); 144 | }) 145 | .addOnFailureListener(e -> { 146 | failCallback.invoke(e.getLocalizedMessage()); 147 | }); 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /android/src/main/java/com/yaaliuzhipeng/mlkit/translatetext/MlkitTranslateTextPackage.java: -------------------------------------------------------------------------------- 1 | // MlkitTranslateTextPackage.java 2 | 3 | package com.yaaliuzhipeng.mlkit.translatetext; 4 | 5 | import java.util.Arrays; 6 | import java.util.Collections; 7 | import java.util.List; 8 | 9 | import com.facebook.react.ReactPackage; 10 | import com.facebook.react.bridge.NativeModule; 11 | import com.facebook.react.bridge.ReactApplicationContext; 12 | import com.facebook.react.uimanager.ViewManager; 13 | 14 | public class MlkitTranslateTextPackage implements ReactPackage { 15 | @Override 16 | public List createNativeModules(ReactApplicationContext reactContext) { 17 | return Arrays.asList(new MlkitTranslateTextModule(reactContext)); 18 | } 19 | 20 | @Override 21 | public List createViewManagers(ReactApplicationContext reactContext) { 22 | return Collections.emptyList(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /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/.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 | exact_by_default=true 27 | 28 | format.bracket_spacing=false 29 | 30 | module.file_ext=.js 31 | module.file_ext=.json 32 | module.file_ext=.ios.js 33 | 34 | munge_underscores=true 35 | 36 | module.name_mapper='^react-native/\(.*\)$' -> '/node_modules/react-native/\1' 37 | 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' 38 | 39 | suppress_type=$FlowIssue 40 | suppress_type=$FlowFixMe 41 | suppress_type=$FlowFixMeProps 42 | suppress_type=$FlowFixMeState 43 | 44 | [lints] 45 | sketchy-null-number=warn 46 | sketchy-null-mixed=warn 47 | sketchy-number=warn 48 | untyped-type-import=warn 49 | nonstrict-import=warn 50 | deprecated-type=warn 51 | unsafe-getters-setters=warn 52 | unnecessary-invariant=warn 53 | signature-verification-failure=warn 54 | 55 | [strict] 56 | deprecated-type 57 | nonstrict-import 58 | sketchy-null 59 | unclear-type 60 | unsafe-getters-setters 61 | untyped-import 62 | untyped-type-import 63 | 64 | [version] 65 | ^0.162.0 66 | -------------------------------------------------------------------------------- /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 | *.hprof 32 | 33 | # node.js 34 | # 35 | node_modules/ 36 | npm-debug.log 37 | yarn-error.log 38 | 39 | # BUCK 40 | buck-out/ 41 | \.buckd/ 42 | *.keystore 43 | !debug.keystore 44 | 45 | # fastlane 46 | # 47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 48 | # screenshots whenever they are needed. 49 | # For more information about the recommended setup visit: 50 | # https://docs.fastlane.tools/best-practices/source-control/ 51 | 52 | */fastlane/report.xml 53 | */fastlane/Preview.html 54 | */fastlane/screenshots 55 | 56 | # Bundle artifact 57 | *.jsbundle 58 | 59 | # CocoaPods 60 | /ios/Pods/ 61 | -------------------------------------------------------------------------------- /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.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | import { View, Text, Pressable, Modal, SafeAreaView, FlatList, Alert } from 'react-native'; 3 | import MLKitTranslator, { LANG_TAGS } from './MLKitTranslator'; 4 | 5 | function rand255() { 6 | return Math.round(Math.random() * 255); 7 | } 8 | function getHumanLang(l: string) { 9 | for (let key of Object.keys(LANG_TAGS)) { 10 | if (LANG_TAGS[key] == l) return key; 11 | } 12 | return 'unknown language tag' 13 | } 14 | const App = (props) => { 15 | 16 | const langs = [ 17 | "Hello, this is English", 18 | "Bonjour, c’est en français", 19 | "はい、こちらはフランス語です", 20 | "안녕하세요, 여기는 프랑스어입니다", 21 | "Здравствуйте, это французский", 22 | ]; 23 | 24 | const [targetLanguage, setTargetLanguage] = useState(getHumanLang(LANG_TAGS.CHINESE)); 25 | const [languageType, setLanguageType] = useState(''); 26 | const [translatedText, setTranslatedText] = useState(''); 27 | const [visible, setVisible] = useState(false); 28 | const identify = (text: string) => { 29 | MLKitTranslator.identifyLanguage(text).then((v: any) => { 30 | setLanguageType(getHumanLang(v)); 31 | }) 32 | } 33 | const identifyAndTranslateTo = async (text: string) => { 34 | identify(text); 35 | try { 36 | 37 | let sourcelang: any = await MLKitTranslator.identifyLanguage(text); 38 | let isSourceLangDownloaded = await MLKitTranslator.isModelDownloaded(sourcelang); 39 | let isTargetLangDownloaded = await MLKitTranslator.isModelDownloaded(LANG_TAGS[targetLanguage]); 40 | if (!isSourceLangDownloaded || !isTargetLangDownloaded) { 41 | Alert.alert('identifyAndTranslateTo', 'model not available,downloading ... you will be notified again once downloaded'); 42 | await MLKitTranslator.downloadModel(sourcelang) 43 | await MLKitTranslator.downloadModel(LANG_TAGS[targetLanguage]) 44 | Alert.alert('identifyAndTranslateTo', 'downloaded success'); 45 | } else { 46 | //downloaded both of s & t 47 | let result: any = await MLKitTranslator.translateText(text, sourcelang, LANG_TAGS[targetLanguage]); 48 | setTranslatedText(result); 49 | } 50 | } catch (error: any) { 51 | Alert.alert('identifyAndTranslateTo', error); 52 | } 53 | } 54 | const changeTargetLanguage = () => { 55 | setVisible(true); 56 | } 57 | 58 | return ( 59 | 60 | 61 | 62 | item} 65 | renderItem={({ item, index }) => { 66 | return ( 67 | { 68 | setTargetLanguage(item); 69 | setVisible(false); 70 | }} style={{ paddingStart: 30, paddingVertical: 15, color: '#000', fontSize: 18 }}>{item} 71 | ) 72 | }} 73 | /> 74 | 75 | 76 | 🍻 MLKit 🍻 77 | ☆☆☆Press Item To Identify Text ☆☆☆ 78 | While Long Press Item To Translate Text 79 | 80 | Press 'CHINESE' To Change Target 81 | 82 | 83 | Target Translate Language: {targetLanguage} 84 | 85 | 86 | {langs.map((lang, index) => { 87 | return ( 88 | { 91 | identify(lang); 92 | }} 93 | onLongPress={() => { 94 | identifyAndTranslateTo(lang); 95 | }} 96 | style={{ marginHorizontal: 15, paddingVertical: 10, paddingHorizontal: 20 }}> 97 | {lang} 98 | 99 | ) 100 | })} 101 | 102 | 103 | Current Text is Of Language: {languageType} 104 | 105 | 106 | Translated Text 107 | {translatedText} 108 | 109 | 110 | ) 111 | } 112 | export default App; -------------------------------------------------------------------------------- /example/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version 4 | ruby '2.7.4' 5 | 6 | gem 'cocoapods', '~> 1.11', '>= 1.11.2' 7 | -------------------------------------------------------------------------------- /example/Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | CFPropertyList (3.0.5) 5 | rexml 6 | activesupport (6.1.4.4) 7 | concurrent-ruby (~> 1.0, >= 1.0.2) 8 | i18n (>= 1.6, < 2) 9 | minitest (>= 5.1) 10 | tzinfo (~> 2.0) 11 | zeitwerk (~> 2.3) 12 | addressable (2.8.0) 13 | public_suffix (>= 2.0.2, < 5.0) 14 | algoliasearch (1.27.5) 15 | httpclient (~> 2.8, >= 2.8.3) 16 | json (>= 1.5.1) 17 | atomos (0.1.3) 18 | claide (1.1.0) 19 | cocoapods (1.11.2) 20 | addressable (~> 2.8) 21 | claide (>= 1.0.2, < 2.0) 22 | cocoapods-core (= 1.11.2) 23 | cocoapods-deintegrate (>= 1.0.3, < 2.0) 24 | cocoapods-downloader (>= 1.4.0, < 2.0) 25 | cocoapods-plugins (>= 1.0.0, < 2.0) 26 | cocoapods-search (>= 1.0.0, < 2.0) 27 | cocoapods-trunk (>= 1.4.0, < 2.0) 28 | cocoapods-try (>= 1.1.0, < 2.0) 29 | colored2 (~> 3.1) 30 | escape (~> 0.0.4) 31 | fourflusher (>= 2.3.0, < 3.0) 32 | gh_inspector (~> 1.0) 33 | molinillo (~> 0.8.0) 34 | nap (~> 1.0) 35 | ruby-macho (>= 1.0, < 3.0) 36 | xcodeproj (>= 1.21.0, < 2.0) 37 | cocoapods-core (1.11.2) 38 | activesupport (>= 5.0, < 7) 39 | addressable (~> 2.8) 40 | algoliasearch (~> 1.0) 41 | concurrent-ruby (~> 1.1) 42 | fuzzy_match (~> 2.0.4) 43 | nap (~> 1.0) 44 | netrc (~> 0.11) 45 | public_suffix (~> 4.0) 46 | typhoeus (~> 1.0) 47 | cocoapods-deintegrate (1.0.5) 48 | cocoapods-downloader (1.5.1) 49 | cocoapods-plugins (1.0.0) 50 | nap 51 | cocoapods-search (1.0.1) 52 | cocoapods-trunk (1.6.0) 53 | nap (>= 0.8, < 2.0) 54 | netrc (~> 0.11) 55 | cocoapods-try (1.2.0) 56 | colored2 (3.1.2) 57 | concurrent-ruby (1.1.9) 58 | escape (0.0.4) 59 | ethon (0.15.0) 60 | ffi (>= 1.15.0) 61 | ffi (1.15.5) 62 | fourflusher (2.3.1) 63 | fuzzy_match (2.0.4) 64 | gh_inspector (1.1.3) 65 | httpclient (2.8.3) 66 | i18n (1.9.1) 67 | concurrent-ruby (~> 1.0) 68 | json (2.6.1) 69 | minitest (5.15.0) 70 | molinillo (0.8.0) 71 | nanaimo (0.3.0) 72 | nap (1.1.0) 73 | netrc (0.11.0) 74 | public_suffix (4.0.6) 75 | rexml (3.2.5) 76 | ruby-macho (2.5.1) 77 | typhoeus (1.4.0) 78 | ethon (>= 0.9.0) 79 | tzinfo (2.0.4) 80 | concurrent-ruby (~> 1.0) 81 | xcodeproj (1.21.0) 82 | CFPropertyList (>= 2.3.3, < 4.0) 83 | atomos (~> 0.1.3) 84 | claide (>= 1.0.2, < 2.0) 85 | colored2 (~> 3.1) 86 | nanaimo (~> 0.3.0) 87 | rexml (~> 3.2.4) 88 | zeitwerk (2.5.4) 89 | 90 | PLATFORMS 91 | ruby 92 | 93 | DEPENDENCIES 94 | cocoapods (~> 1.11, >= 1.11.2) 95 | 96 | RUBY VERSION 97 | ruby 2.7.4p191 98 | 99 | BUNDLED WITH 100 | 2.2.27 101 | -------------------------------------------------------------------------------- /example/MLKitTranslator.ts: -------------------------------------------------------------------------------- 1 | import { NativeModules, Platform } from 'react-native'; 2 | 3 | const { MLKitTranslateText: NativeMLKitTranslateText } = NativeModules; 4 | 5 | export const LANG_TAGS = { 6 | AFRIKAANS: "af", 7 | ALBANIAN: "sq", 8 | ARABIC: "ar", 9 | BELARUSIAN: "be", 10 | BULGARIAN: "bg", 11 | BENGALI: "bn", 12 | CATALAN: "ca", 13 | CHINESE: "zh", 14 | CROATIAN: "hr", 15 | CZECH: "cs", 16 | DANISH: "da", 17 | DUTCH: "nl", 18 | ENGLISH: "en", 19 | ESPERANTO: "eo", 20 | ESTONIAN: "et", 21 | FINNISH: "fi", 22 | FRENCH: "fr", 23 | GALICIAN: "gl", 24 | GEORGIAN: "ka", 25 | GERMAN: "de", 26 | GREEK: "el", 27 | GUJARATI: "gu", 28 | HAITIAN_CREOLE: "ht", 29 | HEBREW: "he", 30 | HINDI: "hi", 31 | HUNGARIAN: "hu", 32 | ICELANDIC: "is", 33 | INDONESIAN: "id", 34 | IRISH: "ga", 35 | ITALIAN: "it", 36 | JAPANESE: "ja", 37 | KANNADA: "kn", 38 | KOREAN: "ko", 39 | LITHUANIAN: "lt", 40 | LATVIAN: "lv", 41 | MACEDONIAN: "mk", 42 | MARATHI: "mr", 43 | MALAY: "ms", 44 | MALTESE: "mt", 45 | NORWEGIAN: "no", 46 | PERSIAN: "fa", 47 | POLISH: "pl", 48 | PORTUGUESE: "pt", 49 | ROMANIAN: "ro", 50 | RUSSIAN: "ru", 51 | SLOVAK: "sk", 52 | SLOVENIAN: "sl", 53 | SPANISH: "es", 54 | SWEDISH: "sv", 55 | SWAHILI: "sw", 56 | TAGALOG: "tl", 57 | TAMIL: "ta", 58 | TELUGU: "te", 59 | THAI: "th", 60 | TURKISH: "tr", 61 | UKRAINIAN: "uk", 62 | URDU: "ur", 63 | VIETNAMESE: "vi", 64 | WELSH: "cy", 65 | } 66 | export type LANG_TAGS_TYPE = 'AFRIKAANS'| 67 | 'ALBANIAN'| 68 | 'ARABIC'| 69 | 'BELARUSIAN'| 70 | 'BULGARIAN'| 71 | 'BENGALI'| 72 | 'CATALAN'| 73 | 'CHINESE'| 74 | 'CROATIAN'| 75 | 'CZECH'| 76 | 'DANISH'| 77 | 'DUTCH'| 78 | 'ENGLISH'| 79 | 'ESPERANTO'| 80 | 'ESTONIAN'| 81 | 'FINNISH'| 82 | 'FRENCH'| 83 | 'GALICIAN'| 84 | 'GEORGIAN'| 85 | 'GERMAN'| 86 | 'GREEK'| 87 | 'GUJARATI'| 88 | 'HAITIAN_CREOLE'| 89 | 'HEBREW'| 90 | 'HINDI'| 91 | 'HUNGARIAN'| 92 | 'ICELANDIC'| 93 | 'INDONESIAN'| 94 | 'IRISH'| 95 | 'ITALIAN'| 96 | 'JAPANESE'| 97 | 'KANNADA'| 98 | 'KOREAN'| 99 | 'LITHUANIAN'| 100 | 'LATVIAN'| 101 | 'MACEDONIAN'| 102 | 'MARATHI'| 103 | 'MALAY'| 104 | 'MALTESE'| 105 | 'NORWEGIAN'| 106 | 'PERSIAN'| 107 | 'POLISH'| 108 | 'PORTUGUESE'| 109 | 'ROMANIAN'| 110 | 'RUSSIAN'| 111 | 'SLOVAK'| 112 | 'SLOVENIAN'| 113 | 'SPANISH'| 114 | 'SWEDISH'| 115 | 'SWAHILI'| 116 | 'TAGALOG'| 117 | 'TAMIL'| 118 | 'TELUGU'| 119 | 'THAI'| 120 | 'TURKISH'| 121 | 'UKRAINIAN'| 122 | 'URDU'| 123 | 'VIETNAMESE'| 124 | 'WELSH'; 125 | 126 | const identifyLanguage = (text: string) => { 127 | return new Promise((resolver, rejecter) => { 128 | NativeMLKitTranslateText.identifyLanguage( 129 | text, 130 | (v) => { resolver(v); }, 131 | (e) => { rejecter(e); }); 132 | }); 133 | } 134 | const identifyPossibleLanguages = (text: string) => { 135 | return new Promise((resolver, rejecter) => { 136 | NativeMLKitTranslateText.identifyLanguage( 137 | text, 138 | (v) => { resolver(v); }, 139 | (e) => { rejecter(e); }); 140 | }); 141 | } 142 | const translateText = (text: string, sourceLanguageTag:LANG_TAGS_TYPE,targetLanguageTag: LANG_TAGS_TYPE) => { 143 | return new Promise((resolver, rejecter) => { 144 | NativeMLKitTranslateText.translateText( 145 | text, 146 | sourceLanguageTag, 147 | targetLanguageTag, 148 | (v) => { resolver(v); }, 149 | (e) => { rejecter(e); }); 150 | }); 151 | } 152 | const isModelDownloaded = (language:LANG_TAGS_TYPE) => { 153 | 154 | return new Promise((resolver, rejecter) => { 155 | NativeMLKitTranslateText.isModelDownloaded( 156 | language, 157 | (v) => { 158 | if(Platform.OS === 'ios') { 159 | resolver(v === 1 ? true : false); 160 | }else{ 161 | resolver(v); 162 | } 163 | }, 164 | // (e) => { rejecter(e); } // no need for now 165 | ); 166 | }); 167 | } 168 | const deleteDownloadedModel = (language: LANG_TAGS_TYPE) => { 169 | return new Promise((resolver, rejecter) => { 170 | NativeMLKitTranslateText.deleteDownloadedModel( 171 | LANG_TAGS[language], 172 | (v) => { resolver(v); }, 173 | (e) => { rejecter(e); } 174 | ); 175 | }); 176 | } 177 | const downloadModel = (language: LANG_TAGS_TYPE) => { 178 | return new Promise((resolver, rejecter) => { 179 | NativeMLKitTranslateText.downloadModel( 180 | language, 181 | (v) => { resolver(v); }, 182 | (e) => { rejecter(e); } 183 | ); 184 | }); 185 | } 186 | 187 | const MLKitTranslator = { 188 | identifyLanguage, 189 | identifyPossibleLanguages, 190 | translateText, 191 | isModelDownloaded, 192 | deleteDownloadedModel, 193 | downloadModel 194 | } 195 | export default MLKitTranslator; 196 | export { 197 | identifyLanguage, 198 | identifyPossibleLanguages, 199 | translateText, 200 | isModelDownloaded, 201 | deleteDownloadedModel, 202 | downloadModel 203 | } -------------------------------------------------------------------------------- /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/_bundle/config: -------------------------------------------------------------------------------- 1 | BUNDLE_PATH: "vendor/bundle" 2 | BUNDLE_FORCE_RUBY_PLATFORM: 1 3 | -------------------------------------------------------------------------------- /example/_ruby-version: -------------------------------------------------------------------------------- 1 | 2.7.4 2 | -------------------------------------------------------------------------------- /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 | 86 | /** 87 | * Set this to true to create two separate APKs instead of one: 88 | * - An APK that only works on ARM devices 89 | * - An APK that only works on x86 devices 90 | * The advantage is the size of the APK is reduced by about 4MB. 91 | * Upload all the APKs to the Play Store and people will download 92 | * the correct one based on the CPU architecture of their device. 93 | */ 94 | def enableSeparateBuildPerCPUArchitecture = false 95 | 96 | /** 97 | * Run Proguard to shrink the Java bytecode in release builds. 98 | */ 99 | def enableProguardInReleaseBuilds = false 100 | 101 | /** 102 | * The preferred build flavor of JavaScriptCore. 103 | * 104 | * For example, to use the international variant, you can use: 105 | * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` 106 | * 107 | * The international variant includes ICU i18n library and necessary data 108 | * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that 109 | * give correct results when using with locales other than en-US. Note that 110 | * this variant is about 6MiB larger per architecture than default. 111 | */ 112 | def jscFlavor = 'org.webkit:android-jsc:+' 113 | 114 | /** 115 | * Whether to enable the Hermes VM. 116 | * 117 | * This should be set on project.ext.react and that value will be read here. If it is not set 118 | * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode 119 | * and the benefits of using Hermes will therefore be sharply reduced. 120 | */ 121 | def enableHermes = project.ext.react.get("enableHermes", false); 122 | 123 | /** 124 | * Architectures to build native code for in debug. 125 | */ 126 | def nativeArchitectures = project.getProperties().get("reactNativeDebugArchitectures") 127 | 128 | android { 129 | ndkVersion rootProject.ext.ndkVersion 130 | 131 | compileSdkVersion rootProject.ext.compileSdkVersion 132 | 133 | defaultConfig { 134 | applicationId "com.example" 135 | minSdkVersion rootProject.ext.minSdkVersion 136 | targetSdkVersion rootProject.ext.targetSdkVersion 137 | versionCode 1 138 | versionName "1.0" 139 | } 140 | splits { 141 | abi { 142 | reset() 143 | enable enableSeparateBuildPerCPUArchitecture 144 | universalApk false // If true, also generate a universal APK 145 | include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" 146 | } 147 | } 148 | signingConfigs { 149 | debug { 150 | storeFile file('debug.keystore') 151 | storePassword 'android' 152 | keyAlias 'androiddebugkey' 153 | keyPassword 'android' 154 | } 155 | } 156 | buildTypes { 157 | debug { 158 | signingConfig signingConfigs.debug 159 | if (nativeArchitectures) { 160 | ndk { 161 | abiFilters nativeArchitectures.split(',') 162 | } 163 | } 164 | } 165 | release { 166 | // Caution! In production, you need to generate your own keystore file. 167 | // see https://reactnative.dev/docs/signed-apk-android. 168 | signingConfig signingConfigs.debug 169 | minifyEnabled enableProguardInReleaseBuilds 170 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 171 | } 172 | } 173 | 174 | // applicationVariants are e.g. debug, release 175 | applicationVariants.all { variant -> 176 | variant.outputs.each { output -> 177 | // For each separate APK per architecture, set a unique version code as described here: 178 | // https://developer.android.com/studio/build/configure-apk-splits.html 179 | // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc. 180 | def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] 181 | def abi = output.getFilter(OutputFile.ABI) 182 | if (abi != null) { // null for the universal-debug, universal-release variants 183 | output.versionCodeOverride = 184 | defaultConfig.versionCode * 1000 + versionCodes.get(abi) 185 | } 186 | 187 | } 188 | } 189 | } 190 | 191 | dependencies { 192 | implementation fileTree(dir: "libs", include: ["*.jar"]) 193 | //noinspection GradleDynamicVersion 194 | implementation "com.facebook.react:react-native:+" // From node_modules 195 | 196 | implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" 197 | 198 | debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { 199 | exclude group:'com.facebook.fbjni' 200 | } 201 | 202 | debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { 203 | exclude group:'com.facebook.flipper' 204 | exclude group:'com.squareup.okhttp3', module:'okhttp' 205 | } 206 | 207 | debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") { 208 | exclude group:'com.facebook.flipper' 209 | } 210 | 211 | if (enableHermes) { 212 | def hermesPath = "../../node_modules/hermes-engine/android/"; 213 | debugImplementation files(hermesPath + "hermes-debug.aar") 214 | releaseImplementation files(hermesPath + "hermes-release.aar") 215 | } else { 216 | implementation jscFlavor 217 | } 218 | } 219 | 220 | // Run this once to be able to run the application with BUCK 221 | // puts all compile dependencies into folder libs for BUCK to use 222 | task copyDownloadableDepsToLibs(type: Copy) { 223 | from configurations.implementation 224 | into 'libs' 225 | } 226 | 227 | apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) 228 | -------------------------------------------------------------------------------- /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/JasonCareter/react-native-mlkit-translate-text/c0a38d74331b0d65ed0e895b75a1158218f65910/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/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /example/android/app/src/debug/java/com/example/ReactNativeFlipper.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | *

This source code is licensed under the MIT license found in the LICENSE file in the root 5 | * directory of this source tree. 6 | */ 7 | package com.example; 8 | 9 | import android.content.Context; 10 | import com.facebook.flipper.android.AndroidFlipperClient; 11 | import com.facebook.flipper.android.utils.FlipperUtils; 12 | import com.facebook.flipper.core.FlipperClient; 13 | import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin; 14 | import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin; 15 | import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin; 16 | import com.facebook.flipper.plugins.inspector.DescriptorMapping; 17 | import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin; 18 | import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor; 19 | import com.facebook.flipper.plugins.network.NetworkFlipperPlugin; 20 | import com.facebook.flipper.plugins.react.ReactFlipperPlugin; 21 | import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin; 22 | import com.facebook.react.ReactInstanceManager; 23 | import com.facebook.react.bridge.ReactContext; 24 | import com.facebook.react.modules.network.NetworkingModule; 25 | import okhttp3.OkHttpClient; 26 | 27 | public class ReactNativeFlipper { 28 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) { 29 | if (FlipperUtils.shouldEnableFlipper(context)) { 30 | final FlipperClient client = AndroidFlipperClient.getInstance(context); 31 | 32 | client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults())); 33 | client.addPlugin(new ReactFlipperPlugin()); 34 | client.addPlugin(new DatabasesFlipperPlugin(context)); 35 | client.addPlugin(new SharedPreferencesFlipperPlugin(context)); 36 | client.addPlugin(CrashReporterPlugin.getInstance()); 37 | 38 | NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin(); 39 | NetworkingModule.setCustomClientBuilder( 40 | new NetworkingModule.CustomClientBuilder() { 41 | @Override 42 | public void apply(OkHttpClient.Builder builder) { 43 | builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin)); 44 | } 45 | }); 46 | client.addPlugin(networkFlipperPlugin); 47 | client.start(); 48 | 49 | // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized 50 | // Hence we run if after all native modules have been initialized 51 | ReactContext reactContext = reactInstanceManager.getCurrentReactContext(); 52 | if (reactContext == null) { 53 | reactInstanceManager.addReactInstanceEventListener( 54 | new ReactInstanceManager.ReactInstanceEventListener() { 55 | @Override 56 | public void onReactContextInitialized(ReactContext reactContext) { 57 | reactInstanceManager.removeReactInstanceEventListener(this); 58 | reactContext.runOnNativeModulesQueueThread( 59 | new Runnable() { 60 | @Override 61 | public void run() { 62 | client.addPlugin(new FrescoFlipperPlugin()); 63 | } 64 | }); 65 | } 66 | }); 67 | } else { 68 | client.addPlugin(new FrescoFlipperPlugin()); 69 | } 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 14 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /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/drawable/rn_edit_text_material.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 21 | 22 | 23 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasonCareter/react-native-mlkit-translate-text/c0a38d74331b0d65ed0e895b75a1158218f65910/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/JasonCareter/react-native-mlkit-translate-text/c0a38d74331b0d65ed0e895b75a1158218f65910/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/JasonCareter/react-native-mlkit-translate-text/c0a38d74331b0d65ed0e895b75a1158218f65910/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/JasonCareter/react-native-mlkit-translate-text/c0a38d74331b0d65ed0e895b75a1158218f65910/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/JasonCareter/react-native-mlkit-translate-text/c0a38d74331b0d65ed0e895b75a1158218f65910/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/JasonCareter/react-native-mlkit-translate-text/c0a38d74331b0d65ed0e895b75a1158218f65910/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/JasonCareter/react-native-mlkit-translate-text/c0a38d74331b0d65ed0e895b75a1158218f65910/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/JasonCareter/react-native-mlkit-translate-text/c0a38d74331b0d65ed0e895b75a1158218f65910/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/JasonCareter/react-native-mlkit-translate-text/c0a38d74331b0d65ed0e895b75a1158218f65910/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/JasonCareter/react-native-mlkit-translate-text/c0a38d74331b0d65ed0e895b75a1158218f65910/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 = "30.0.2" 6 | minSdkVersion = 21 7 | compileSdkVersion = 30 8 | targetSdkVersion = 30 9 | ndkVersion = "21.4.7075529" 10 | } 11 | repositories { 12 | google() 13 | mavenCentral() 14 | } 15 | dependencies { 16 | classpath("com.android.tools.build:gradle:4.2.2") 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 | maven { 25 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 26 | url("$rootDir/../node_modules/react-native/android") 27 | } 28 | maven { 29 | // Android JSC is installed from npm 30 | url("$rootDir/../node_modules/jsc-android/dist") 31 | } 32 | mavenCentral { 33 | // We don't want to fetch react-native from Maven Central as there are 34 | // older versions over there. 35 | content { 36 | excludeGroup "com.facebook.react" 37 | } 38 | } 39 | google() 40 | maven { url 'https://www.jitpack.io' } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /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: -Xmx1024m -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.99.0 29 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasonCareter/react-native-mlkit-translate-text/c0a38d74331b0d65ed0e895b75a1158218f65910/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-7.2-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/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, '11.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 | target 'exampleTests' do 16 | inherit! :complete 17 | # Pods for testing 18 | end 19 | 20 | # Enables Flipper. 21 | # 22 | # Note that if you have use_frameworks! enabled, Flipper will not work and 23 | # you should disable the next line. 24 | use_flipper!() 25 | 26 | post_install do |installer| 27 | react_native_post_install(installer) 28 | __apply_Xcode_12_5_M1_post_install_workaround(installer) 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /example/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - boost (1.76.0) 3 | - CocoaAsyncSocket (7.6.5) 4 | - DoubleConversion (1.1.6) 5 | - FBLazyVector (0.67.2) 6 | - FBReactNativeSpec (0.67.2): 7 | - RCT-Folly (= 2021.06.28.00-v2) 8 | - RCTRequired (= 0.67.2) 9 | - RCTTypeSafety (= 0.67.2) 10 | - React-Core (= 0.67.2) 11 | - React-jsi (= 0.67.2) 12 | - ReactCommon/turbomodule/core (= 0.67.2) 13 | - Flipper (0.99.0): 14 | - Flipper-Folly (~> 2.6) 15 | - Flipper-RSocket (~> 1.4) 16 | - Flipper-Boost-iOSX (1.76.0.1.11) 17 | - Flipper-DoubleConversion (3.1.7) 18 | - Flipper-Fmt (7.1.7) 19 | - Flipper-Folly (2.6.7): 20 | - Flipper-Boost-iOSX 21 | - Flipper-DoubleConversion 22 | - Flipper-Fmt (= 7.1.7) 23 | - Flipper-Glog 24 | - libevent (~> 2.1.12) 25 | - OpenSSL-Universal (= 1.1.180) 26 | - Flipper-Glog (0.3.6) 27 | - Flipper-PeerTalk (0.0.4) 28 | - Flipper-RSocket (1.4.3): 29 | - Flipper-Folly (~> 2.6) 30 | - FlipperKit (0.99.0): 31 | - FlipperKit/Core (= 0.99.0) 32 | - FlipperKit/Core (0.99.0): 33 | - Flipper (~> 0.99.0) 34 | - FlipperKit/CppBridge 35 | - FlipperKit/FBCxxFollyDynamicConvert 36 | - FlipperKit/FBDefines 37 | - FlipperKit/FKPortForwarding 38 | - FlipperKit/CppBridge (0.99.0): 39 | - Flipper (~> 0.99.0) 40 | - FlipperKit/FBCxxFollyDynamicConvert (0.99.0): 41 | - Flipper-Folly (~> 2.6) 42 | - FlipperKit/FBDefines (0.99.0) 43 | - FlipperKit/FKPortForwarding (0.99.0): 44 | - CocoaAsyncSocket (~> 7.6) 45 | - Flipper-PeerTalk (~> 0.0.4) 46 | - FlipperKit/FlipperKitHighlightOverlay (0.99.0) 47 | - FlipperKit/FlipperKitLayoutHelpers (0.99.0): 48 | - FlipperKit/Core 49 | - FlipperKit/FlipperKitHighlightOverlay 50 | - FlipperKit/FlipperKitLayoutTextSearchable 51 | - FlipperKit/FlipperKitLayoutIOSDescriptors (0.99.0): 52 | - FlipperKit/Core 53 | - FlipperKit/FlipperKitHighlightOverlay 54 | - FlipperKit/FlipperKitLayoutHelpers 55 | - YogaKit (~> 1.18) 56 | - FlipperKit/FlipperKitLayoutPlugin (0.99.0): 57 | - FlipperKit/Core 58 | - FlipperKit/FlipperKitHighlightOverlay 59 | - FlipperKit/FlipperKitLayoutHelpers 60 | - FlipperKit/FlipperKitLayoutIOSDescriptors 61 | - FlipperKit/FlipperKitLayoutTextSearchable 62 | - YogaKit (~> 1.18) 63 | - FlipperKit/FlipperKitLayoutTextSearchable (0.99.0) 64 | - FlipperKit/FlipperKitNetworkPlugin (0.99.0): 65 | - FlipperKit/Core 66 | - FlipperKit/FlipperKitReactPlugin (0.99.0): 67 | - FlipperKit/Core 68 | - FlipperKit/FlipperKitUserDefaultsPlugin (0.99.0): 69 | - FlipperKit/Core 70 | - FlipperKit/SKIOSNetworkPlugin (0.99.0): 71 | - FlipperKit/Core 72 | - FlipperKit/FlipperKitNetworkPlugin 73 | - fmt (6.2.1) 74 | - glog (0.3.5) 75 | - GoogleDataTransport (9.1.2): 76 | - GoogleUtilities/Environment (~> 7.2) 77 | - nanopb (~> 2.30908.0) 78 | - PromisesObjC (< 3.0, >= 1.2) 79 | - GoogleMLKit/LanguageID (2.5.0): 80 | - GoogleMLKit/MLKitCore 81 | - MLKitLanguageID (~> 2.0.0) 82 | - GoogleMLKit/MLKitCore (2.5.0): 83 | - MLKitCommon (~> 5.0.0) 84 | - GoogleMLKit/Translate (2.5.0): 85 | - GoogleMLKit/MLKitCore 86 | - MLKitTranslate (~> 1.5.0) 87 | - GoogleToolboxForMac/DebugUtils (2.3.2): 88 | - GoogleToolboxForMac/Defines (= 2.3.2) 89 | - GoogleToolboxForMac/Defines (2.3.2) 90 | - GoogleToolboxForMac/Logger (2.3.2): 91 | - GoogleToolboxForMac/Defines (= 2.3.2) 92 | - "GoogleToolboxForMac/NSData+zlib (2.3.2)": 93 | - GoogleToolboxForMac/Defines (= 2.3.2) 94 | - "GoogleToolboxForMac/NSDictionary+URLArguments (2.3.2)": 95 | - GoogleToolboxForMac/DebugUtils (= 2.3.2) 96 | - GoogleToolboxForMac/Defines (= 2.3.2) 97 | - "GoogleToolboxForMac/NSString+URLArguments (= 2.3.2)" 98 | - "GoogleToolboxForMac/NSString+URLArguments (2.3.2)" 99 | - GoogleToolboxForMac/StringEncoding (2.3.2): 100 | - GoogleToolboxForMac/Defines (= 2.3.2) 101 | - GoogleUtilities/Environment (7.7.0): 102 | - PromisesObjC (< 3.0, >= 1.2) 103 | - GoogleUtilities/Logger (7.7.0): 104 | - GoogleUtilities/Environment 105 | - GoogleUtilities/UserDefaults (7.7.0): 106 | - GoogleUtilities/Logger 107 | - GoogleUtilitiesComponents (1.1.0): 108 | - GoogleUtilities/Logger 109 | - GTMSessionFetcher/Core (1.7.0) 110 | - libevent (2.1.12) 111 | - MLKitCommon (5.0.0): 112 | - GoogleDataTransport (~> 9.0) 113 | - GoogleToolboxForMac/Logger (~> 2.1) 114 | - "GoogleToolboxForMac/NSData+zlib (~> 2.1)" 115 | - "GoogleToolboxForMac/NSDictionary+URLArguments (~> 2.1)" 116 | - GoogleUtilities/UserDefaults (~> 7.0) 117 | - GoogleUtilitiesComponents (~> 1.0) 118 | - GTMSessionFetcher/Core (~> 1.1) 119 | - Protobuf (~> 3.12) 120 | - MLKitLanguageID (2.0.0): 121 | - MLKitNaturalLanguage (~> 3.0) 122 | - MLKitNaturalLanguage (3.0.0): 123 | - GoogleToolboxForMac/Logger (~> 2.1) 124 | - "GoogleToolboxForMac/NSData+zlib (~> 2.1)" 125 | - "GoogleToolboxForMac/NSDictionary+URLArguments (~> 2.1)" 126 | - GoogleToolboxForMac/StringEncoding (~> 2.1) 127 | - GTMSessionFetcher/Core (~> 1.1) 128 | - MLKitCommon (~> 5.0) 129 | - Protobuf (~> 3.12) 130 | - MLKitTranslate (1.5.0): 131 | - MLKitNaturalLanguage (~> 3.0) 132 | - SSZipArchive (~> 2.1) 133 | - nanopb (2.30908.0): 134 | - nanopb/decode (= 2.30908.0) 135 | - nanopb/encode (= 2.30908.0) 136 | - nanopb/decode (2.30908.0) 137 | - nanopb/encode (2.30908.0) 138 | - OpenSSL-Universal (1.1.180) 139 | - PromisesObjC (2.0.0) 140 | - Protobuf (3.19.4) 141 | - RCT-Folly (2021.06.28.00-v2): 142 | - boost 143 | - DoubleConversion 144 | - fmt (~> 6.2.1) 145 | - glog 146 | - RCT-Folly/Default (= 2021.06.28.00-v2) 147 | - RCT-Folly/Default (2021.06.28.00-v2): 148 | - boost 149 | - DoubleConversion 150 | - fmt (~> 6.2.1) 151 | - glog 152 | - RCTRequired (0.67.2) 153 | - RCTTypeSafety (0.67.2): 154 | - FBLazyVector (= 0.67.2) 155 | - RCT-Folly (= 2021.06.28.00-v2) 156 | - RCTRequired (= 0.67.2) 157 | - React-Core (= 0.67.2) 158 | - React (0.67.2): 159 | - React-Core (= 0.67.2) 160 | - React-Core/DevSupport (= 0.67.2) 161 | - React-Core/RCTWebSocket (= 0.67.2) 162 | - React-RCTActionSheet (= 0.67.2) 163 | - React-RCTAnimation (= 0.67.2) 164 | - React-RCTBlob (= 0.67.2) 165 | - React-RCTImage (= 0.67.2) 166 | - React-RCTLinking (= 0.67.2) 167 | - React-RCTNetwork (= 0.67.2) 168 | - React-RCTSettings (= 0.67.2) 169 | - React-RCTText (= 0.67.2) 170 | - React-RCTVibration (= 0.67.2) 171 | - React-callinvoker (0.67.2) 172 | - React-Core (0.67.2): 173 | - glog 174 | - RCT-Folly (= 2021.06.28.00-v2) 175 | - React-Core/Default (= 0.67.2) 176 | - React-cxxreact (= 0.67.2) 177 | - React-jsi (= 0.67.2) 178 | - React-jsiexecutor (= 0.67.2) 179 | - React-perflogger (= 0.67.2) 180 | - Yoga 181 | - React-Core/CoreModulesHeaders (0.67.2): 182 | - glog 183 | - RCT-Folly (= 2021.06.28.00-v2) 184 | - React-Core/Default 185 | - React-cxxreact (= 0.67.2) 186 | - React-jsi (= 0.67.2) 187 | - React-jsiexecutor (= 0.67.2) 188 | - React-perflogger (= 0.67.2) 189 | - Yoga 190 | - React-Core/Default (0.67.2): 191 | - glog 192 | - RCT-Folly (= 2021.06.28.00-v2) 193 | - React-cxxreact (= 0.67.2) 194 | - React-jsi (= 0.67.2) 195 | - React-jsiexecutor (= 0.67.2) 196 | - React-perflogger (= 0.67.2) 197 | - Yoga 198 | - React-Core/DevSupport (0.67.2): 199 | - glog 200 | - RCT-Folly (= 2021.06.28.00-v2) 201 | - React-Core/Default (= 0.67.2) 202 | - React-Core/RCTWebSocket (= 0.67.2) 203 | - React-cxxreact (= 0.67.2) 204 | - React-jsi (= 0.67.2) 205 | - React-jsiexecutor (= 0.67.2) 206 | - React-jsinspector (= 0.67.2) 207 | - React-perflogger (= 0.67.2) 208 | - Yoga 209 | - React-Core/RCTActionSheetHeaders (0.67.2): 210 | - glog 211 | - RCT-Folly (= 2021.06.28.00-v2) 212 | - React-Core/Default 213 | - React-cxxreact (= 0.67.2) 214 | - React-jsi (= 0.67.2) 215 | - React-jsiexecutor (= 0.67.2) 216 | - React-perflogger (= 0.67.2) 217 | - Yoga 218 | - React-Core/RCTAnimationHeaders (0.67.2): 219 | - glog 220 | - RCT-Folly (= 2021.06.28.00-v2) 221 | - React-Core/Default 222 | - React-cxxreact (= 0.67.2) 223 | - React-jsi (= 0.67.2) 224 | - React-jsiexecutor (= 0.67.2) 225 | - React-perflogger (= 0.67.2) 226 | - Yoga 227 | - React-Core/RCTBlobHeaders (0.67.2): 228 | - glog 229 | - RCT-Folly (= 2021.06.28.00-v2) 230 | - React-Core/Default 231 | - React-cxxreact (= 0.67.2) 232 | - React-jsi (= 0.67.2) 233 | - React-jsiexecutor (= 0.67.2) 234 | - React-perflogger (= 0.67.2) 235 | - Yoga 236 | - React-Core/RCTImageHeaders (0.67.2): 237 | - glog 238 | - RCT-Folly (= 2021.06.28.00-v2) 239 | - React-Core/Default 240 | - React-cxxreact (= 0.67.2) 241 | - React-jsi (= 0.67.2) 242 | - React-jsiexecutor (= 0.67.2) 243 | - React-perflogger (= 0.67.2) 244 | - Yoga 245 | - React-Core/RCTLinkingHeaders (0.67.2): 246 | - glog 247 | - RCT-Folly (= 2021.06.28.00-v2) 248 | - React-Core/Default 249 | - React-cxxreact (= 0.67.2) 250 | - React-jsi (= 0.67.2) 251 | - React-jsiexecutor (= 0.67.2) 252 | - React-perflogger (= 0.67.2) 253 | - Yoga 254 | - React-Core/RCTNetworkHeaders (0.67.2): 255 | - glog 256 | - RCT-Folly (= 2021.06.28.00-v2) 257 | - React-Core/Default 258 | - React-cxxreact (= 0.67.2) 259 | - React-jsi (= 0.67.2) 260 | - React-jsiexecutor (= 0.67.2) 261 | - React-perflogger (= 0.67.2) 262 | - Yoga 263 | - React-Core/RCTSettingsHeaders (0.67.2): 264 | - glog 265 | - RCT-Folly (= 2021.06.28.00-v2) 266 | - React-Core/Default 267 | - React-cxxreact (= 0.67.2) 268 | - React-jsi (= 0.67.2) 269 | - React-jsiexecutor (= 0.67.2) 270 | - React-perflogger (= 0.67.2) 271 | - Yoga 272 | - React-Core/RCTTextHeaders (0.67.2): 273 | - glog 274 | - RCT-Folly (= 2021.06.28.00-v2) 275 | - React-Core/Default 276 | - React-cxxreact (= 0.67.2) 277 | - React-jsi (= 0.67.2) 278 | - React-jsiexecutor (= 0.67.2) 279 | - React-perflogger (= 0.67.2) 280 | - Yoga 281 | - React-Core/RCTVibrationHeaders (0.67.2): 282 | - glog 283 | - RCT-Folly (= 2021.06.28.00-v2) 284 | - React-Core/Default 285 | - React-cxxreact (= 0.67.2) 286 | - React-jsi (= 0.67.2) 287 | - React-jsiexecutor (= 0.67.2) 288 | - React-perflogger (= 0.67.2) 289 | - Yoga 290 | - React-Core/RCTWebSocket (0.67.2): 291 | - glog 292 | - RCT-Folly (= 2021.06.28.00-v2) 293 | - React-Core/Default (= 0.67.2) 294 | - React-cxxreact (= 0.67.2) 295 | - React-jsi (= 0.67.2) 296 | - React-jsiexecutor (= 0.67.2) 297 | - React-perflogger (= 0.67.2) 298 | - Yoga 299 | - React-CoreModules (0.67.2): 300 | - FBReactNativeSpec (= 0.67.2) 301 | - RCT-Folly (= 2021.06.28.00-v2) 302 | - RCTTypeSafety (= 0.67.2) 303 | - React-Core/CoreModulesHeaders (= 0.67.2) 304 | - React-jsi (= 0.67.2) 305 | - React-RCTImage (= 0.67.2) 306 | - ReactCommon/turbomodule/core (= 0.67.2) 307 | - React-cxxreact (0.67.2): 308 | - boost (= 1.76.0) 309 | - DoubleConversion 310 | - glog 311 | - RCT-Folly (= 2021.06.28.00-v2) 312 | - React-callinvoker (= 0.67.2) 313 | - React-jsi (= 0.67.2) 314 | - React-jsinspector (= 0.67.2) 315 | - React-logger (= 0.67.2) 316 | - React-perflogger (= 0.67.2) 317 | - React-runtimeexecutor (= 0.67.2) 318 | - React-jsi (0.67.2): 319 | - boost (= 1.76.0) 320 | - DoubleConversion 321 | - glog 322 | - RCT-Folly (= 2021.06.28.00-v2) 323 | - React-jsi/Default (= 0.67.2) 324 | - React-jsi/Default (0.67.2): 325 | - boost (= 1.76.0) 326 | - DoubleConversion 327 | - glog 328 | - RCT-Folly (= 2021.06.28.00-v2) 329 | - React-jsiexecutor (0.67.2): 330 | - DoubleConversion 331 | - glog 332 | - RCT-Folly (= 2021.06.28.00-v2) 333 | - React-cxxreact (= 0.67.2) 334 | - React-jsi (= 0.67.2) 335 | - React-perflogger (= 0.67.2) 336 | - React-jsinspector (0.67.2) 337 | - React-logger (0.67.2): 338 | - glog 339 | - react-native-mlkit-translate-text (1.0.0): 340 | - GoogleMLKit/LanguageID (= 2.5.0) 341 | - GoogleMLKit/Translate (= 2.5.0) 342 | - React 343 | - React-perflogger (0.67.2) 344 | - React-RCTActionSheet (0.67.2): 345 | - React-Core/RCTActionSheetHeaders (= 0.67.2) 346 | - React-RCTAnimation (0.67.2): 347 | - FBReactNativeSpec (= 0.67.2) 348 | - RCT-Folly (= 2021.06.28.00-v2) 349 | - RCTTypeSafety (= 0.67.2) 350 | - React-Core/RCTAnimationHeaders (= 0.67.2) 351 | - React-jsi (= 0.67.2) 352 | - ReactCommon/turbomodule/core (= 0.67.2) 353 | - React-RCTBlob (0.67.2): 354 | - FBReactNativeSpec (= 0.67.2) 355 | - RCT-Folly (= 2021.06.28.00-v2) 356 | - React-Core/RCTBlobHeaders (= 0.67.2) 357 | - React-Core/RCTWebSocket (= 0.67.2) 358 | - React-jsi (= 0.67.2) 359 | - React-RCTNetwork (= 0.67.2) 360 | - ReactCommon/turbomodule/core (= 0.67.2) 361 | - React-RCTImage (0.67.2): 362 | - FBReactNativeSpec (= 0.67.2) 363 | - RCT-Folly (= 2021.06.28.00-v2) 364 | - RCTTypeSafety (= 0.67.2) 365 | - React-Core/RCTImageHeaders (= 0.67.2) 366 | - React-jsi (= 0.67.2) 367 | - React-RCTNetwork (= 0.67.2) 368 | - ReactCommon/turbomodule/core (= 0.67.2) 369 | - React-RCTLinking (0.67.2): 370 | - FBReactNativeSpec (= 0.67.2) 371 | - React-Core/RCTLinkingHeaders (= 0.67.2) 372 | - React-jsi (= 0.67.2) 373 | - ReactCommon/turbomodule/core (= 0.67.2) 374 | - React-RCTNetwork (0.67.2): 375 | - FBReactNativeSpec (= 0.67.2) 376 | - RCT-Folly (= 2021.06.28.00-v2) 377 | - RCTTypeSafety (= 0.67.2) 378 | - React-Core/RCTNetworkHeaders (= 0.67.2) 379 | - React-jsi (= 0.67.2) 380 | - ReactCommon/turbomodule/core (= 0.67.2) 381 | - React-RCTSettings (0.67.2): 382 | - FBReactNativeSpec (= 0.67.2) 383 | - RCT-Folly (= 2021.06.28.00-v2) 384 | - RCTTypeSafety (= 0.67.2) 385 | - React-Core/RCTSettingsHeaders (= 0.67.2) 386 | - React-jsi (= 0.67.2) 387 | - ReactCommon/turbomodule/core (= 0.67.2) 388 | - React-RCTText (0.67.2): 389 | - React-Core/RCTTextHeaders (= 0.67.2) 390 | - React-RCTVibration (0.67.2): 391 | - FBReactNativeSpec (= 0.67.2) 392 | - RCT-Folly (= 2021.06.28.00-v2) 393 | - React-Core/RCTVibrationHeaders (= 0.67.2) 394 | - React-jsi (= 0.67.2) 395 | - ReactCommon/turbomodule/core (= 0.67.2) 396 | - React-runtimeexecutor (0.67.2): 397 | - React-jsi (= 0.67.2) 398 | - ReactCommon/turbomodule/core (0.67.2): 399 | - DoubleConversion 400 | - glog 401 | - RCT-Folly (= 2021.06.28.00-v2) 402 | - React-callinvoker (= 0.67.2) 403 | - React-Core (= 0.67.2) 404 | - React-cxxreact (= 0.67.2) 405 | - React-jsi (= 0.67.2) 406 | - React-logger (= 0.67.2) 407 | - React-perflogger (= 0.67.2) 408 | - SSZipArchive (2.4.2) 409 | - Yoga (1.14.0) 410 | - YogaKit (1.18.1): 411 | - Yoga (~> 1.14) 412 | 413 | DEPENDENCIES: 414 | - boost (from `../node_modules/react-native/third-party-podspecs/boost.podspec`) 415 | - DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`) 416 | - FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`) 417 | - FBReactNativeSpec (from `../node_modules/react-native/React/FBReactNativeSpec`) 418 | - Flipper (= 0.99.0) 419 | - Flipper-Boost-iOSX (= 1.76.0.1.11) 420 | - Flipper-DoubleConversion (= 3.1.7) 421 | - Flipper-Fmt (= 7.1.7) 422 | - Flipper-Folly (= 2.6.7) 423 | - Flipper-Glog (= 0.3.6) 424 | - Flipper-PeerTalk (= 0.0.4) 425 | - Flipper-RSocket (= 1.4.3) 426 | - FlipperKit (= 0.99.0) 427 | - FlipperKit/Core (= 0.99.0) 428 | - FlipperKit/CppBridge (= 0.99.0) 429 | - FlipperKit/FBCxxFollyDynamicConvert (= 0.99.0) 430 | - FlipperKit/FBDefines (= 0.99.0) 431 | - FlipperKit/FKPortForwarding (= 0.99.0) 432 | - FlipperKit/FlipperKitHighlightOverlay (= 0.99.0) 433 | - FlipperKit/FlipperKitLayoutPlugin (= 0.99.0) 434 | - FlipperKit/FlipperKitLayoutTextSearchable (= 0.99.0) 435 | - FlipperKit/FlipperKitNetworkPlugin (= 0.99.0) 436 | - FlipperKit/FlipperKitReactPlugin (= 0.99.0) 437 | - FlipperKit/FlipperKitUserDefaultsPlugin (= 0.99.0) 438 | - FlipperKit/SKIOSNetworkPlugin (= 0.99.0) 439 | - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`) 440 | - OpenSSL-Universal (= 1.1.180) 441 | - RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`) 442 | - RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`) 443 | - RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`) 444 | - React (from `../node_modules/react-native/`) 445 | - React-callinvoker (from `../node_modules/react-native/ReactCommon/callinvoker`) 446 | - React-Core (from `../node_modules/react-native/`) 447 | - React-Core/DevSupport (from `../node_modules/react-native/`) 448 | - React-Core/RCTWebSocket (from `../node_modules/react-native/`) 449 | - React-CoreModules (from `../node_modules/react-native/React/CoreModules`) 450 | - React-cxxreact (from `../node_modules/react-native/ReactCommon/cxxreact`) 451 | - React-jsi (from `../node_modules/react-native/ReactCommon/jsi`) 452 | - React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`) 453 | - React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`) 454 | - React-logger (from `../node_modules/react-native/ReactCommon/logger`) 455 | - react-native-mlkit-translate-text (from `../..`) 456 | - React-perflogger (from `../node_modules/react-native/ReactCommon/reactperflogger`) 457 | - React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`) 458 | - React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`) 459 | - React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`) 460 | - React-RCTImage (from `../node_modules/react-native/Libraries/Image`) 461 | - React-RCTLinking (from `../node_modules/react-native/Libraries/LinkingIOS`) 462 | - React-RCTNetwork (from `../node_modules/react-native/Libraries/Network`) 463 | - React-RCTSettings (from `../node_modules/react-native/Libraries/Settings`) 464 | - React-RCTText (from `../node_modules/react-native/Libraries/Text`) 465 | - React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`) 466 | - React-runtimeexecutor (from `../node_modules/react-native/ReactCommon/runtimeexecutor`) 467 | - ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`) 468 | - Yoga (from `../node_modules/react-native/ReactCommon/yoga`) 469 | 470 | SPEC REPOS: 471 | trunk: 472 | - CocoaAsyncSocket 473 | - Flipper 474 | - Flipper-Boost-iOSX 475 | - Flipper-DoubleConversion 476 | - Flipper-Fmt 477 | - Flipper-Folly 478 | - Flipper-Glog 479 | - Flipper-PeerTalk 480 | - Flipper-RSocket 481 | - FlipperKit 482 | - fmt 483 | - GoogleDataTransport 484 | - GoogleMLKit 485 | - GoogleToolboxForMac 486 | - GoogleUtilities 487 | - GoogleUtilitiesComponents 488 | - GTMSessionFetcher 489 | - libevent 490 | - MLKitCommon 491 | - MLKitLanguageID 492 | - MLKitNaturalLanguage 493 | - MLKitTranslate 494 | - nanopb 495 | - OpenSSL-Universal 496 | - PromisesObjC 497 | - Protobuf 498 | - SSZipArchive 499 | - YogaKit 500 | 501 | EXTERNAL SOURCES: 502 | boost: 503 | :podspec: "../node_modules/react-native/third-party-podspecs/boost.podspec" 504 | DoubleConversion: 505 | :podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec" 506 | FBLazyVector: 507 | :path: "../node_modules/react-native/Libraries/FBLazyVector" 508 | FBReactNativeSpec: 509 | :path: "../node_modules/react-native/React/FBReactNativeSpec" 510 | glog: 511 | :podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec" 512 | RCT-Folly: 513 | :podspec: "../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec" 514 | RCTRequired: 515 | :path: "../node_modules/react-native/Libraries/RCTRequired" 516 | RCTTypeSafety: 517 | :path: "../node_modules/react-native/Libraries/TypeSafety" 518 | React: 519 | :path: "../node_modules/react-native/" 520 | React-callinvoker: 521 | :path: "../node_modules/react-native/ReactCommon/callinvoker" 522 | React-Core: 523 | :path: "../node_modules/react-native/" 524 | React-CoreModules: 525 | :path: "../node_modules/react-native/React/CoreModules" 526 | React-cxxreact: 527 | :path: "../node_modules/react-native/ReactCommon/cxxreact" 528 | React-jsi: 529 | :path: "../node_modules/react-native/ReactCommon/jsi" 530 | React-jsiexecutor: 531 | :path: "../node_modules/react-native/ReactCommon/jsiexecutor" 532 | React-jsinspector: 533 | :path: "../node_modules/react-native/ReactCommon/jsinspector" 534 | React-logger: 535 | :path: "../node_modules/react-native/ReactCommon/logger" 536 | react-native-mlkit-translate-text: 537 | :path: "../.." 538 | React-perflogger: 539 | :path: "../node_modules/react-native/ReactCommon/reactperflogger" 540 | React-RCTActionSheet: 541 | :path: "../node_modules/react-native/Libraries/ActionSheetIOS" 542 | React-RCTAnimation: 543 | :path: "../node_modules/react-native/Libraries/NativeAnimation" 544 | React-RCTBlob: 545 | :path: "../node_modules/react-native/Libraries/Blob" 546 | React-RCTImage: 547 | :path: "../node_modules/react-native/Libraries/Image" 548 | React-RCTLinking: 549 | :path: "../node_modules/react-native/Libraries/LinkingIOS" 550 | React-RCTNetwork: 551 | :path: "../node_modules/react-native/Libraries/Network" 552 | React-RCTSettings: 553 | :path: "../node_modules/react-native/Libraries/Settings" 554 | React-RCTText: 555 | :path: "../node_modules/react-native/Libraries/Text" 556 | React-RCTVibration: 557 | :path: "../node_modules/react-native/Libraries/Vibration" 558 | React-runtimeexecutor: 559 | :path: "../node_modules/react-native/ReactCommon/runtimeexecutor" 560 | ReactCommon: 561 | :path: "../node_modules/react-native/ReactCommon" 562 | Yoga: 563 | :path: "../node_modules/react-native/ReactCommon/yoga" 564 | 565 | SPEC CHECKSUMS: 566 | boost: a7c83b31436843459a1961bfd74b96033dc77234 567 | CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99 568 | DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662 569 | FBLazyVector: 244195e30d63d7f564c55da4410b9a24e8fbceaa 570 | FBReactNativeSpec: c94002c1d93da3658f4d5119c6994d19961e3d52 571 | Flipper: 30e8eeeed6abdc98edaf32af0cda2f198be4b733 572 | Flipper-Boost-iOSX: fd1e2b8cbef7e662a122412d7ac5f5bea715403c 573 | Flipper-DoubleConversion: 57ffbe81ef95306cc9e69c4aa3aeeeeb58a6a28c 574 | Flipper-Fmt: 60cbdd92fc254826e61d669a5d87ef7015396a9b 575 | Flipper-Folly: 83af37379faa69497529e414bd43fbfc7cae259a 576 | Flipper-Glog: 1dfd6abf1e922806c52ceb8701a3599a79a200a6 577 | Flipper-PeerTalk: 116d8f857dc6ef55c7a5a75ea3ceaafe878aadc9 578 | Flipper-RSocket: d9d9ade67cbecf6ac10730304bf5607266dd2541 579 | FlipperKit: d8d346844eca5d9120c17d441a2f38596e8ed2b9 580 | fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9 581 | glog: 85ecdd10ee8d8ec362ef519a6a45ff9aa27b2e85 582 | GoogleDataTransport: 629c20a4d363167143f30ea78320d5a7eb8bd940 583 | GoogleMLKit: 0d7f5aa2f8a2f2ea9d849a05abdbe80974b0ec83 584 | GoogleToolboxForMac: 8bef7c7c5cf7291c687cf5354f39f9db6399ad34 585 | GoogleUtilities: e0913149f6b0625b553d70dae12b49fc62914fd1 586 | GoogleUtilitiesComponents: 679b2c881db3b615a2777504623df6122dd20afe 587 | GTMSessionFetcher: 43748f93435c2aa068b1cbe39655aaf600652e91 588 | libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913 589 | MLKitCommon: 3bc17c6f7d25ce3660f030350b46ae7ec9ebca6e 590 | MLKitLanguageID: 0f6eb73b437c84aa32268c9916edbc34357c0dfa 591 | MLKitNaturalLanguage: effd1e1268a5e6c734f769dd988b5d293bdc564b 592 | MLKitTranslate: 6ea27ef248debd2b2021e582e3ed7befb4f254a9 593 | nanopb: a0ba3315591a9ae0a16a309ee504766e90db0c96 594 | OpenSSL-Universal: 1aa4f6a6ee7256b83db99ec1ccdaa80d10f9af9b 595 | PromisesObjC: 68159ce6952d93e17b2dfe273b8c40907db5ba58 596 | Protobuf: 235750e4696ff59fb07d949a9dbbc92b3c0700fe 597 | RCT-Folly: 803a9cfd78114b2ec0f140cfa6fa2a6bafb2d685 598 | RCTRequired: cd47794163052d2b8318c891a7a14fcfaccc75ab 599 | RCTTypeSafety: 393bb40b3e357b224cde53d3fec26813c52428b1 600 | React: dec6476bc27155b250eeadfc11ea779265f53ebf 601 | React-callinvoker: e5047929e80aea942e6fdd96482504ef0189ca63 602 | React-Core: e382655566b2b9a6e3b4f641d777b7bfdbe52358 603 | React-CoreModules: cf262e82fa101c0aee022b6f90d1a5b612038b64 604 | React-cxxreact: 69d53de3b30c7c161ba087ca1ecdffed9ccb1039 605 | React-jsi: ce9a2d804adf75809ce2fe2374ba3fbbf5d59b03 606 | React-jsiexecutor: 52beb652bbc61201bd70cbe4f0b8edb607e8da4f 607 | React-jsinspector: 595f76eba2176ebd8817a1fffd47b84fbdab9383 608 | React-logger: 23de8ea0f44fa00ee77e96060273225607fd4d78 609 | react-native-mlkit-translate-text: ec49ada083c3207b2cdbe869af3f4bd9b2870f1d 610 | React-perflogger: 3c9bb7372493e49036f07a82c44c8cf65cbe88db 611 | React-RCTActionSheet: 052606483045a408693aa7e864410b4a052f541a 612 | React-RCTAnimation: 08d4cac13222bb1348c687a0158dfd3b577cdb63 613 | React-RCTBlob: 928ad1df65219c3d9e2ac80983b943a75b5c3629 614 | React-RCTImage: 524d7313b142a39ee0e20fa312b67277917fe076 615 | React-RCTLinking: 44036ea6f13a2e46238be07a67566247fee35244 616 | React-RCTNetwork: 9b6faacf1e0789253e319ca53b1f8d92c2ac5455 617 | React-RCTSettings: ecd8094f831130a49581d5112a8607220e5d12a5 618 | React-RCTText: 14ba976fb48ed283cfdb1a754a5d4276471e0152 619 | React-RCTVibration: 99c7f67fba7a5ade46e98e870c6ff2444484f995 620 | React-runtimeexecutor: 2450b43df7ffe8e805a0b3dcb2abd4282f1f1836 621 | ReactCommon: d98c6c96b567f9b3a15f9fd4cc302c1eda8e3cf2 622 | SSZipArchive: e7b4f3d9e780c2acc1764cd88fbf2de28f26e5b2 623 | Yoga: 9b6696970c3289e8dea34b3eda93f23e61fb8121 624 | YogaKit: f782866e155069a2cca2517aafea43200b01fd5a 625 | 626 | PODFILE CHECKSUM: b238204fde808b9d15816fe170aa2c48b884b8b0 627 | 628 | COCOAPODS: 1.10.1 629 | -------------------------------------------------------------------------------- /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 | 00E356F31AD99517003FC87E /* exampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* exampleTests.m */; }; 11 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; 12 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 13 | 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 14 | 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; }; 15 | 897C3173E8676C72DC1C0609 /* libPods-example-exampleTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7E6244E8D3552069C98557F4 /* libPods-example-exampleTests.a */; }; 16 | A9EDFBBC80AA1B223F4E76F8 /* libPods-example.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 73F8FE4B899B821FF1C980DE /* libPods-example.a */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXContainerItemProxy section */ 20 | 00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = { 21 | isa = PBXContainerItemProxy; 22 | containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; 23 | proxyType = 1; 24 | remoteGlobalIDString = 13B07F861A680F5B00A75B9A; 25 | remoteInfo = example; 26 | }; 27 | /* End PBXContainerItemProxy section */ 28 | 29 | /* Begin PBXFileReference section */ 30 | 00E356EE1AD99517003FC87E /* exampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = exampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 32 | 00E356F21AD99517003FC87E /* exampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = exampleTests.m; sourceTree = ""; }; 33 | 13B07F961A680F5B00A75B9A /* example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 34 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = example/AppDelegate.h; sourceTree = ""; }; 35 | 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = example/AppDelegate.m; sourceTree = ""; }; 36 | 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = example/Images.xcassets; sourceTree = ""; }; 37 | 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = example/Info.plist; sourceTree = ""; }; 38 | 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = example/main.m; sourceTree = ""; }; 39 | 499F5AB0D51A6113A7BF6908 /* 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 = ""; }; 40 | 4E656D54DC83190FC1DA62C3 /* 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 = ""; }; 41 | 73F8FE4B899B821FF1C980DE /* libPods-example.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-example.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | 7D5A564D3AB90CC443B278B6 /* 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 = ""; }; 43 | 7E6244E8D3552069C98557F4 /* libPods-example-exampleTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-example-exampleTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 44 | 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = example/LaunchScreen.storyboard; sourceTree = ""; }; 45 | 9F6D60D62A07955B50BFAAB6 /* 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 = ""; }; 46 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; 47 | /* End PBXFileReference section */ 48 | 49 | /* Begin PBXFrameworksBuildPhase section */ 50 | 00E356EB1AD99517003FC87E /* Frameworks */ = { 51 | isa = PBXFrameworksBuildPhase; 52 | buildActionMask = 2147483647; 53 | files = ( 54 | 897C3173E8676C72DC1C0609 /* libPods-example-exampleTests.a in Frameworks */, 55 | ); 56 | runOnlyForDeploymentPostprocessing = 0; 57 | }; 58 | 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { 59 | isa = PBXFrameworksBuildPhase; 60 | buildActionMask = 2147483647; 61 | files = ( 62 | A9EDFBBC80AA1B223F4E76F8 /* libPods-example.a in Frameworks */, 63 | ); 64 | runOnlyForDeploymentPostprocessing = 0; 65 | }; 66 | /* End PBXFrameworksBuildPhase section */ 67 | 68 | /* Begin PBXGroup section */ 69 | 00E356EF1AD99517003FC87E /* exampleTests */ = { 70 | isa = PBXGroup; 71 | children = ( 72 | 00E356F21AD99517003FC87E /* exampleTests.m */, 73 | 00E356F01AD99517003FC87E /* Supporting Files */, 74 | ); 75 | path = exampleTests; 76 | sourceTree = ""; 77 | }; 78 | 00E356F01AD99517003FC87E /* Supporting Files */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 00E356F11AD99517003FC87E /* Info.plist */, 82 | ); 83 | name = "Supporting Files"; 84 | sourceTree = ""; 85 | }; 86 | 02B16F772928A41C796EDF3E /* Pods */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 4E656D54DC83190FC1DA62C3 /* Pods-example.debug.xcconfig */, 90 | 9F6D60D62A07955B50BFAAB6 /* Pods-example.release.xcconfig */, 91 | 7D5A564D3AB90CC443B278B6 /* Pods-example-exampleTests.debug.xcconfig */, 92 | 499F5AB0D51A6113A7BF6908 /* Pods-example-exampleTests.release.xcconfig */, 93 | ); 94 | name = Pods; 95 | path = Pods; 96 | sourceTree = ""; 97 | }; 98 | 13B07FAE1A68108700A75B9A /* example */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */, 102 | 13B07FB01A68108700A75B9A /* AppDelegate.m */, 103 | 13B07FB51A68108700A75B9A /* Images.xcassets */, 104 | 13B07FB61A68108700A75B9A /* Info.plist */, 105 | 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */, 106 | 13B07FB71A68108700A75B9A /* main.m */, 107 | ); 108 | name = example; 109 | sourceTree = ""; 110 | }; 111 | 2D16E6871FA4F8E400B85C8A /* Frameworks */ = { 112 | isa = PBXGroup; 113 | children = ( 114 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */, 115 | 73F8FE4B899B821FF1C980DE /* libPods-example.a */, 116 | 7E6244E8D3552069C98557F4 /* libPods-example-exampleTests.a */, 117 | ); 118 | name = Frameworks; 119 | sourceTree = ""; 120 | }; 121 | 832341AE1AAA6A7D00B99B32 /* Libraries */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | ); 125 | name = Libraries; 126 | sourceTree = ""; 127 | }; 128 | 83CBB9F61A601CBA00E9B192 = { 129 | isa = PBXGroup; 130 | children = ( 131 | 13B07FAE1A68108700A75B9A /* example */, 132 | 832341AE1AAA6A7D00B99B32 /* Libraries */, 133 | 00E356EF1AD99517003FC87E /* exampleTests */, 134 | 83CBBA001A601CBA00E9B192 /* Products */, 135 | 2D16E6871FA4F8E400B85C8A /* Frameworks */, 136 | 02B16F772928A41C796EDF3E /* Pods */, 137 | ); 138 | indentWidth = 2; 139 | sourceTree = ""; 140 | tabWidth = 2; 141 | usesTabs = 0; 142 | }; 143 | 83CBBA001A601CBA00E9B192 /* Products */ = { 144 | isa = PBXGroup; 145 | children = ( 146 | 13B07F961A680F5B00A75B9A /* example.app */, 147 | 00E356EE1AD99517003FC87E /* exampleTests.xctest */, 148 | ); 149 | name = Products; 150 | sourceTree = ""; 151 | }; 152 | /* End PBXGroup section */ 153 | 154 | /* Begin PBXNativeTarget section */ 155 | 00E356ED1AD99517003FC87E /* exampleTests */ = { 156 | isa = PBXNativeTarget; 157 | buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "exampleTests" */; 158 | buildPhases = ( 159 | B0A1F9FE9692FD59F385016A /* [CP] Check Pods Manifest.lock */, 160 | 00E356EA1AD99517003FC87E /* Sources */, 161 | 00E356EB1AD99517003FC87E /* Frameworks */, 162 | 00E356EC1AD99517003FC87E /* Resources */, 163 | 44EAD0FCE146D390EEADB0E5 /* [CP] Embed Pods Frameworks */, 164 | 99D8593E49593E40A35261F0 /* [CP] Copy Pods Resources */, 165 | ); 166 | buildRules = ( 167 | ); 168 | dependencies = ( 169 | 00E356F51AD99517003FC87E /* PBXTargetDependency */, 170 | ); 171 | name = exampleTests; 172 | productName = exampleTests; 173 | productReference = 00E356EE1AD99517003FC87E /* exampleTests.xctest */; 174 | productType = "com.apple.product-type.bundle.unit-test"; 175 | }; 176 | 13B07F861A680F5B00A75B9A /* example */ = { 177 | isa = PBXNativeTarget; 178 | buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "example" */; 179 | buildPhases = ( 180 | 28457246528D308D119D297D /* [CP] Check Pods Manifest.lock */, 181 | FD10A7F022414F080027D42C /* Start Packager */, 182 | 13B07F871A680F5B00A75B9A /* Sources */, 183 | 13B07F8C1A680F5B00A75B9A /* Frameworks */, 184 | 13B07F8E1A680F5B00A75B9A /* Resources */, 185 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, 186 | 780A62A65422F1A5D8C8539B /* [CP] Embed Pods Frameworks */, 187 | B94906C426C12F34E8BE977A /* [CP] Copy Pods Resources */, 188 | ); 189 | buildRules = ( 190 | ); 191 | dependencies = ( 192 | ); 193 | name = example; 194 | productName = example; 195 | productReference = 13B07F961A680F5B00A75B9A /* example.app */; 196 | productType = "com.apple.product-type.application"; 197 | }; 198 | /* End PBXNativeTarget section */ 199 | 200 | /* Begin PBXProject section */ 201 | 83CBB9F71A601CBA00E9B192 /* Project object */ = { 202 | isa = PBXProject; 203 | attributes = { 204 | LastUpgradeCheck = 1210; 205 | TargetAttributes = { 206 | 00E356ED1AD99517003FC87E = { 207 | CreatedOnToolsVersion = 6.2; 208 | TestTargetID = 13B07F861A680F5B00A75B9A; 209 | }; 210 | 13B07F861A680F5B00A75B9A = { 211 | LastSwiftMigration = 1120; 212 | }; 213 | }; 214 | }; 215 | buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "example" */; 216 | compatibilityVersion = "Xcode 12.0"; 217 | developmentRegion = en; 218 | hasScannedForEncodings = 0; 219 | knownRegions = ( 220 | en, 221 | Base, 222 | ); 223 | mainGroup = 83CBB9F61A601CBA00E9B192; 224 | productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; 225 | projectDirPath = ""; 226 | projectRoot = ""; 227 | targets = ( 228 | 13B07F861A680F5B00A75B9A /* example */, 229 | 00E356ED1AD99517003FC87E /* exampleTests */, 230 | ); 231 | }; 232 | /* End PBXProject section */ 233 | 234 | /* Begin PBXResourcesBuildPhase section */ 235 | 00E356EC1AD99517003FC87E /* Resources */ = { 236 | isa = PBXResourcesBuildPhase; 237 | buildActionMask = 2147483647; 238 | files = ( 239 | ); 240 | runOnlyForDeploymentPostprocessing = 0; 241 | }; 242 | 13B07F8E1A680F5B00A75B9A /* Resources */ = { 243 | isa = PBXResourcesBuildPhase; 244 | buildActionMask = 2147483647; 245 | files = ( 246 | 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */, 247 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, 248 | ); 249 | runOnlyForDeploymentPostprocessing = 0; 250 | }; 251 | /* End PBXResourcesBuildPhase section */ 252 | 253 | /* Begin PBXShellScriptBuildPhase section */ 254 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = { 255 | isa = PBXShellScriptBuildPhase; 256 | buildActionMask = 2147483647; 257 | files = ( 258 | ); 259 | inputPaths = ( 260 | ); 261 | name = "Bundle React Native code and images"; 262 | outputPaths = ( 263 | ); 264 | runOnlyForDeploymentPostprocessing = 0; 265 | shellPath = /bin/sh; 266 | shellScript = "set -e\n\nexport NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh\n"; 267 | }; 268 | 28457246528D308D119D297D /* [CP] Check Pods Manifest.lock */ = { 269 | isa = PBXShellScriptBuildPhase; 270 | buildActionMask = 2147483647; 271 | files = ( 272 | ); 273 | inputFileListPaths = ( 274 | ); 275 | inputPaths = ( 276 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 277 | "${PODS_ROOT}/Manifest.lock", 278 | ); 279 | name = "[CP] Check Pods Manifest.lock"; 280 | outputFileListPaths = ( 281 | ); 282 | outputPaths = ( 283 | "$(DERIVED_FILE_DIR)/Pods-example-checkManifestLockResult.txt", 284 | ); 285 | runOnlyForDeploymentPostprocessing = 0; 286 | shellPath = /bin/sh; 287 | 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"; 288 | showEnvVarsInLog = 0; 289 | }; 290 | 44EAD0FCE146D390EEADB0E5 /* [CP] Embed Pods Frameworks */ = { 291 | isa = PBXShellScriptBuildPhase; 292 | buildActionMask = 2147483647; 293 | files = ( 294 | ); 295 | inputFileListPaths = ( 296 | "${PODS_ROOT}/Target Support Files/Pods-example-exampleTests/Pods-example-exampleTests-frameworks-${CONFIGURATION}-input-files.xcfilelist", 297 | ); 298 | name = "[CP] Embed Pods Frameworks"; 299 | outputFileListPaths = ( 300 | "${PODS_ROOT}/Target Support Files/Pods-example-exampleTests/Pods-example-exampleTests-frameworks-${CONFIGURATION}-output-files.xcfilelist", 301 | ); 302 | runOnlyForDeploymentPostprocessing = 0; 303 | shellPath = /bin/sh; 304 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-example-exampleTests/Pods-example-exampleTests-frameworks.sh\"\n"; 305 | showEnvVarsInLog = 0; 306 | }; 307 | 780A62A65422F1A5D8C8539B /* [CP] Embed Pods Frameworks */ = { 308 | isa = PBXShellScriptBuildPhase; 309 | buildActionMask = 2147483647; 310 | files = ( 311 | ); 312 | inputFileListPaths = ( 313 | "${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-frameworks-${CONFIGURATION}-input-files.xcfilelist", 314 | ); 315 | name = "[CP] Embed Pods Frameworks"; 316 | outputFileListPaths = ( 317 | "${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-frameworks-${CONFIGURATION}-output-files.xcfilelist", 318 | ); 319 | runOnlyForDeploymentPostprocessing = 0; 320 | shellPath = /bin/sh; 321 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-frameworks.sh\"\n"; 322 | showEnvVarsInLog = 0; 323 | }; 324 | 99D8593E49593E40A35261F0 /* [CP] Copy Pods Resources */ = { 325 | isa = PBXShellScriptBuildPhase; 326 | buildActionMask = 2147483647; 327 | files = ( 328 | ); 329 | inputFileListPaths = ( 330 | "${PODS_ROOT}/Target Support Files/Pods-example-exampleTests/Pods-example-exampleTests-resources-${CONFIGURATION}-input-files.xcfilelist", 331 | ); 332 | name = "[CP] Copy Pods Resources"; 333 | outputFileListPaths = ( 334 | "${PODS_ROOT}/Target Support Files/Pods-example-exampleTests/Pods-example-exampleTests-resources-${CONFIGURATION}-output-files.xcfilelist", 335 | ); 336 | runOnlyForDeploymentPostprocessing = 0; 337 | shellPath = /bin/sh; 338 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-example-exampleTests/Pods-example-exampleTests-resources.sh\"\n"; 339 | showEnvVarsInLog = 0; 340 | }; 341 | B0A1F9FE9692FD59F385016A /* [CP] Check Pods Manifest.lock */ = { 342 | isa = PBXShellScriptBuildPhase; 343 | buildActionMask = 2147483647; 344 | files = ( 345 | ); 346 | inputFileListPaths = ( 347 | ); 348 | inputPaths = ( 349 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 350 | "${PODS_ROOT}/Manifest.lock", 351 | ); 352 | name = "[CP] Check Pods Manifest.lock"; 353 | outputFileListPaths = ( 354 | ); 355 | outputPaths = ( 356 | "$(DERIVED_FILE_DIR)/Pods-example-exampleTests-checkManifestLockResult.txt", 357 | ); 358 | runOnlyForDeploymentPostprocessing = 0; 359 | shellPath = /bin/sh; 360 | 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"; 361 | showEnvVarsInLog = 0; 362 | }; 363 | B94906C426C12F34E8BE977A /* [CP] Copy Pods Resources */ = { 364 | isa = PBXShellScriptBuildPhase; 365 | buildActionMask = 2147483647; 366 | files = ( 367 | ); 368 | inputFileListPaths = ( 369 | "${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-resources-${CONFIGURATION}-input-files.xcfilelist", 370 | ); 371 | name = "[CP] Copy Pods Resources"; 372 | outputFileListPaths = ( 373 | "${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-resources-${CONFIGURATION}-output-files.xcfilelist", 374 | ); 375 | runOnlyForDeploymentPostprocessing = 0; 376 | shellPath = /bin/sh; 377 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-resources.sh\"\n"; 378 | showEnvVarsInLog = 0; 379 | }; 380 | FD10A7F022414F080027D42C /* Start Packager */ = { 381 | isa = PBXShellScriptBuildPhase; 382 | buildActionMask = 2147483647; 383 | files = ( 384 | ); 385 | inputFileListPaths = ( 386 | ); 387 | inputPaths = ( 388 | ); 389 | name = "Start Packager"; 390 | outputFileListPaths = ( 391 | ); 392 | outputPaths = ( 393 | ); 394 | runOnlyForDeploymentPostprocessing = 0; 395 | shellPath = /bin/sh; 396 | 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"; 397 | showEnvVarsInLog = 0; 398 | }; 399 | /* End PBXShellScriptBuildPhase section */ 400 | 401 | /* Begin PBXSourcesBuildPhase section */ 402 | 00E356EA1AD99517003FC87E /* Sources */ = { 403 | isa = PBXSourcesBuildPhase; 404 | buildActionMask = 2147483647; 405 | files = ( 406 | 00E356F31AD99517003FC87E /* exampleTests.m in Sources */, 407 | ); 408 | runOnlyForDeploymentPostprocessing = 0; 409 | }; 410 | 13B07F871A680F5B00A75B9A /* Sources */ = { 411 | isa = PBXSourcesBuildPhase; 412 | buildActionMask = 2147483647; 413 | files = ( 414 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */, 415 | 13B07FC11A68108700A75B9A /* main.m in Sources */, 416 | ); 417 | runOnlyForDeploymentPostprocessing = 0; 418 | }; 419 | /* End PBXSourcesBuildPhase section */ 420 | 421 | /* Begin PBXTargetDependency section */ 422 | 00E356F51AD99517003FC87E /* PBXTargetDependency */ = { 423 | isa = PBXTargetDependency; 424 | target = 13B07F861A680F5B00A75B9A /* example */; 425 | targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */; 426 | }; 427 | /* End PBXTargetDependency section */ 428 | 429 | /* Begin XCBuildConfiguration section */ 430 | 00E356F61AD99517003FC87E /* Debug */ = { 431 | isa = XCBuildConfiguration; 432 | baseConfigurationReference = 7D5A564D3AB90CC443B278B6 /* Pods-example-exampleTests.debug.xcconfig */; 433 | buildSettings = { 434 | BUNDLE_LOADER = "$(TEST_HOST)"; 435 | GCC_PREPROCESSOR_DEFINITIONS = ( 436 | "DEBUG=1", 437 | "$(inherited)", 438 | ); 439 | INFOPLIST_FILE = exampleTests/Info.plist; 440 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 441 | LD_RUNPATH_SEARCH_PATHS = ( 442 | "$(inherited)", 443 | "@executable_path/Frameworks", 444 | "@loader_path/Frameworks", 445 | ); 446 | OTHER_LDFLAGS = ( 447 | "-ObjC", 448 | "-lc++", 449 | "$(inherited)", 450 | ); 451 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; 452 | PRODUCT_NAME = "$(TARGET_NAME)"; 453 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/example.app/example"; 454 | }; 455 | name = Debug; 456 | }; 457 | 00E356F71AD99517003FC87E /* Release */ = { 458 | isa = XCBuildConfiguration; 459 | baseConfigurationReference = 499F5AB0D51A6113A7BF6908 /* Pods-example-exampleTests.release.xcconfig */; 460 | buildSettings = { 461 | BUNDLE_LOADER = "$(TEST_HOST)"; 462 | COPY_PHASE_STRIP = NO; 463 | INFOPLIST_FILE = exampleTests/Info.plist; 464 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 465 | LD_RUNPATH_SEARCH_PATHS = ( 466 | "$(inherited)", 467 | "@executable_path/Frameworks", 468 | "@loader_path/Frameworks", 469 | ); 470 | OTHER_LDFLAGS = ( 471 | "-ObjC", 472 | "-lc++", 473 | "$(inherited)", 474 | ); 475 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; 476 | PRODUCT_NAME = "$(TARGET_NAME)"; 477 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/example.app/example"; 478 | }; 479 | name = Release; 480 | }; 481 | 13B07F941A680F5B00A75B9A /* Debug */ = { 482 | isa = XCBuildConfiguration; 483 | baseConfigurationReference = 4E656D54DC83190FC1DA62C3 /* Pods-example.debug.xcconfig */; 484 | buildSettings = { 485 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 486 | CLANG_ENABLE_MODULES = YES; 487 | CURRENT_PROJECT_VERSION = 1; 488 | ENABLE_BITCODE = NO; 489 | INFOPLIST_FILE = example/Info.plist; 490 | LD_RUNPATH_SEARCH_PATHS = ( 491 | "$(inherited)", 492 | "@executable_path/Frameworks", 493 | ); 494 | OTHER_LDFLAGS = ( 495 | "$(inherited)", 496 | "-ObjC", 497 | "-lc++", 498 | ); 499 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; 500 | PRODUCT_NAME = example; 501 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 502 | SWIFT_VERSION = 5.0; 503 | VERSIONING_SYSTEM = "apple-generic"; 504 | }; 505 | name = Debug; 506 | }; 507 | 13B07F951A680F5B00A75B9A /* Release */ = { 508 | isa = XCBuildConfiguration; 509 | baseConfigurationReference = 9F6D60D62A07955B50BFAAB6 /* Pods-example.release.xcconfig */; 510 | buildSettings = { 511 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 512 | CLANG_ENABLE_MODULES = YES; 513 | CURRENT_PROJECT_VERSION = 1; 514 | INFOPLIST_FILE = example/Info.plist; 515 | LD_RUNPATH_SEARCH_PATHS = ( 516 | "$(inherited)", 517 | "@executable_path/Frameworks", 518 | ); 519 | OTHER_LDFLAGS = ( 520 | "$(inherited)", 521 | "-ObjC", 522 | "-lc++", 523 | ); 524 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; 525 | PRODUCT_NAME = example; 526 | SWIFT_VERSION = 5.0; 527 | VERSIONING_SYSTEM = "apple-generic"; 528 | }; 529 | name = Release; 530 | }; 531 | 83CBBA201A601CBA00E9B192 /* Debug */ = { 532 | isa = XCBuildConfiguration; 533 | buildSettings = { 534 | ALWAYS_SEARCH_USER_PATHS = NO; 535 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 536 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 537 | CLANG_CXX_LIBRARY = "libc++"; 538 | CLANG_ENABLE_MODULES = YES; 539 | CLANG_ENABLE_OBJC_ARC = YES; 540 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 541 | CLANG_WARN_BOOL_CONVERSION = YES; 542 | CLANG_WARN_COMMA = YES; 543 | CLANG_WARN_CONSTANT_CONVERSION = YES; 544 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 545 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 546 | CLANG_WARN_EMPTY_BODY = YES; 547 | CLANG_WARN_ENUM_CONVERSION = YES; 548 | CLANG_WARN_INFINITE_RECURSION = YES; 549 | CLANG_WARN_INT_CONVERSION = YES; 550 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 551 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 552 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 553 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 554 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 555 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 556 | CLANG_WARN_STRICT_PROTOTYPES = YES; 557 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 558 | CLANG_WARN_UNREACHABLE_CODE = YES; 559 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 560 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 561 | COPY_PHASE_STRIP = NO; 562 | ENABLE_STRICT_OBJC_MSGSEND = YES; 563 | ENABLE_TESTABILITY = YES; 564 | "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = ""; 565 | GCC_C_LANGUAGE_STANDARD = gnu99; 566 | GCC_DYNAMIC_NO_PIC = NO; 567 | GCC_NO_COMMON_BLOCKS = YES; 568 | GCC_OPTIMIZATION_LEVEL = 0; 569 | GCC_PREPROCESSOR_DEFINITIONS = ( 570 | "DEBUG=1", 571 | "$(inherited)", 572 | ); 573 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 574 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 575 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 576 | GCC_WARN_UNDECLARED_SELECTOR = YES; 577 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 578 | GCC_WARN_UNUSED_FUNCTION = YES; 579 | GCC_WARN_UNUSED_VARIABLE = YES; 580 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 581 | LD_RUNPATH_SEARCH_PATHS = ( 582 | /usr/lib/swift, 583 | "$(inherited)", 584 | ); 585 | LIBRARY_SEARCH_PATHS = ( 586 | "\"$(SDKROOT)/usr/lib/swift\"", 587 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", 588 | "\"$(inherited)\"", 589 | ); 590 | MTL_ENABLE_DEBUG_INFO = YES; 591 | ONLY_ACTIVE_ARCH = YES; 592 | SDKROOT = iphoneos; 593 | }; 594 | name = Debug; 595 | }; 596 | 83CBBA211A601CBA00E9B192 /* Release */ = { 597 | isa = XCBuildConfiguration; 598 | buildSettings = { 599 | ALWAYS_SEARCH_USER_PATHS = NO; 600 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 601 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 602 | CLANG_CXX_LIBRARY = "libc++"; 603 | CLANG_ENABLE_MODULES = YES; 604 | CLANG_ENABLE_OBJC_ARC = YES; 605 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 606 | CLANG_WARN_BOOL_CONVERSION = YES; 607 | CLANG_WARN_COMMA = YES; 608 | CLANG_WARN_CONSTANT_CONVERSION = YES; 609 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 610 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 611 | CLANG_WARN_EMPTY_BODY = YES; 612 | CLANG_WARN_ENUM_CONVERSION = YES; 613 | CLANG_WARN_INFINITE_RECURSION = YES; 614 | CLANG_WARN_INT_CONVERSION = YES; 615 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 616 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 617 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 618 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 619 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 620 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 621 | CLANG_WARN_STRICT_PROTOTYPES = YES; 622 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 623 | CLANG_WARN_UNREACHABLE_CODE = YES; 624 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 625 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 626 | COPY_PHASE_STRIP = YES; 627 | ENABLE_NS_ASSERTIONS = NO; 628 | ENABLE_STRICT_OBJC_MSGSEND = YES; 629 | "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = ""; 630 | GCC_C_LANGUAGE_STANDARD = gnu99; 631 | GCC_NO_COMMON_BLOCKS = YES; 632 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 633 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 634 | GCC_WARN_UNDECLARED_SELECTOR = YES; 635 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 636 | GCC_WARN_UNUSED_FUNCTION = YES; 637 | GCC_WARN_UNUSED_VARIABLE = YES; 638 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 639 | LD_RUNPATH_SEARCH_PATHS = ( 640 | /usr/lib/swift, 641 | "$(inherited)", 642 | ); 643 | LIBRARY_SEARCH_PATHS = ( 644 | "\"$(SDKROOT)/usr/lib/swift\"", 645 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", 646 | "\"$(inherited)\"", 647 | ); 648 | MTL_ENABLE_DEBUG_INFO = NO; 649 | SDKROOT = iphoneos; 650 | VALIDATE_PRODUCT = YES; 651 | }; 652 | name = Release; 653 | }; 654 | /* End XCBuildConfiguration section */ 655 | 656 | /* Begin XCConfigurationList section */ 657 | 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "exampleTests" */ = { 658 | isa = XCConfigurationList; 659 | buildConfigurations = ( 660 | 00E356F61AD99517003FC87E /* Debug */, 661 | 00E356F71AD99517003FC87E /* Release */, 662 | ); 663 | defaultConfigurationIsVisible = 0; 664 | defaultConfigurationName = Release; 665 | }; 666 | 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "example" */ = { 667 | isa = XCConfigurationList; 668 | buildConfigurations = ( 669 | 13B07F941A680F5B00A75B9A /* Debug */, 670 | 13B07F951A680F5B00A75B9A /* Release */, 671 | ); 672 | defaultConfigurationIsVisible = 0; 673 | defaultConfigurationName = Release; 674 | }; 675 | 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "example" */ = { 676 | isa = XCConfigurationList; 677 | buildConfigurations = ( 678 | 83CBBA201A601CBA00E9B192 /* Debug */, 679 | 83CBBA211A601CBA00E9B192 /* Release */, 680 | ); 681 | defaultConfigurationIsVisible = 0; 682 | defaultConfigurationName = Release; 683 | }; 684 | /* End XCConfigurationList section */ 685 | }; 686 | rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; 687 | } 688 | -------------------------------------------------------------------------------- /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 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /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 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | example 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSRequiresIPhoneOS 26 | 27 | NSAppTransportSecurity 28 | 29 | NSExceptionDomains 30 | 31 | localhost 32 | 33 | NSExceptionAllowsInsecureHTTPLoads 34 | 35 | 36 | 37 | 38 | NSLocationWhenInUseUsageDescription 39 | 40 | UILaunchStoryboardName 41 | LaunchScreen 42 | UIRequiredDeviceCapabilities 43 | 44 | armv7 45 | 46 | UISupportedInterfaceOrientations 47 | 48 | UIInterfaceOrientationPortrait 49 | UIInterfaceOrientationLandscapeLeft 50 | UIInterfaceOrientationLandscapeRight 51 | 52 | UIViewControllerBasedStatusBarAppearance 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /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/exampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /example/ios/exampleTests/exampleTests.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | #import 5 | #import 6 | 7 | #define TIMEOUT_SECONDS 600 8 | #define TEXT_TO_LOOK_FOR @"Welcome to React" 9 | 10 | @interface exampleTests : XCTestCase 11 | 12 | @end 13 | 14 | @implementation exampleTests 15 | 16 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 17 | { 18 | if (test(view)) { 19 | return YES; 20 | } 21 | for (UIView *subview in [view subviews]) { 22 | if ([self findSubviewInView:subview matching:test]) { 23 | return YES; 24 | } 25 | } 26 | return NO; 27 | } 28 | 29 | - (void)testRendersWelcomeScreen 30 | { 31 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController]; 32 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 33 | BOOL foundElement = NO; 34 | 35 | __block NSString *redboxError = nil; 36 | #ifdef DEBUG 37 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 38 | if (level >= RCTLogLevelError) { 39 | redboxError = message; 40 | } 41 | }); 42 | #endif 43 | 44 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 45 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 46 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 47 | 48 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { 49 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 50 | return YES; 51 | } 52 | return NO; 53 | }]; 54 | } 55 | 56 | #ifdef DEBUG 57 | RCTSetLogFunction(RCTDefaultLogFunction); 58 | #endif 59 | 60 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 61 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 62 | } 63 | 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /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.2", 14 | "react-native": "0.67.2", 15 | "react-native-mlkit-translate-text": "link:../" 16 | }, 17 | "devDependencies": { 18 | "@babel/core": "^7.12.9", 19 | "@babel/runtime": "^7.12.5", 20 | "@react-native-community/eslint-config": "^2.0.0", 21 | "babel-jest": "^26.6.3", 22 | "eslint": "7.14.0", 23 | "jest": "^26.6.3", 24 | "@types/react": "^17.0.38", 25 | "@types/react-native": "^0.66.10", 26 | "@types/react-test-renderer": "^17.0.1", 27 | "metro-react-native-babel-preset": "^0.66.2", 28 | "react-native-typescript-transformer": "^1.2.13", 29 | "react-test-renderer": "17.0.2", 30 | "typescript": "^4.5.4" 31 | }, 32 | "jest": { 33 | "preset": "react-native" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /example/rn-cli.config.js: -------------------------------------------------------------------------------- 1 | module.exports={ 2 | getTransformModulePath(){ 3 | return require.resolve("react-native-typescript-transformer"); 4 | }, 5 | getSourceExts(){ 6 | return ["ts","tsx","js","jsx"]; 7 | } 8 | } -------------------------------------------------------------------------------- /example/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "exclude": ["node_modules", "babel.config.js", "metro.config.js", "jest.config.js","rn-cli.config.js"], 3 | "include": ["**/*.js", "**/*.ts", "**/*.tsx", "**/*.jsx"], 4 | "compilerOptions": { 5 | /* Basic Options */ 6 | "target": "esnext", 7 | "module": "esnext", 8 | "allowJs": true, 9 | "checkJs": false, 10 | "jsx": "react-native", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ 11 | "declaration": true, /* Generates corresponding '.d.ts' file. */ 12 | // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ 13 | // "sourceMap": true, /* Generates corresponding '.map' file. */ 14 | // "outFile": "./", /* Concatenate and emit output to single file. */ 15 | // "outDir": "./", /* Redirect output structure to the directory. */ 16 | // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ 17 | "removeComments": true, /* Do not emit comments to output. */ 18 | "noEmit": true, /* Do not emit outputs. */ 19 | "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ 20 | "noFallthroughCasesInSwitch": true, 21 | "resolveJsonModule": true, 22 | /* Strict Type-Checking Options */ 23 | "strict": true, /* Enable all strict type-checking options. */ 24 | "noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */ 25 | "strictNullChecks": false, /* Enable strict null checks. */ 26 | /* Module Resolution Options */ 27 | "moduleResolution": "node", 28 | "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ 29 | /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ 30 | // "rootDirs": [], 31 | "typeRoots": ["types/*"], /* List of folders to include type definitions from. */ 32 | // "types": ["./*.d.ts"], /* Type declaration files to be included in compilation. */ 33 | "allowSyntheticDefaultImports": true, 34 | "esModuleInterop": true, 35 | "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /index.ts: -------------------------------------------------------------------------------- 1 | // main index.js 2 | 3 | export {default as MLKitTranslator} from './src/MLKitTranslator'; 4 | export * from './src/MLKitTranslator'; 5 | -------------------------------------------------------------------------------- /ios/MlkitTranslateText.h: -------------------------------------------------------------------------------- 1 | // MlkitTranslateText.h 2 | 3 | #import 4 | 5 | @interface MlkitTranslateText : NSObject 6 | 7 | @end 8 | -------------------------------------------------------------------------------- /ios/MlkitTranslateText.m: -------------------------------------------------------------------------------- 1 | // MlkitTranslateText.m 2 | 3 | #import "MlkitTranslateText.h" 4 | @import MLKitLanguageID; 5 | @import MLKitTranslate; 6 | @import MLKitCommon; 7 | 8 | @implementation MlkitTranslateText 9 | 10 | RCT_EXPORT_MODULE(MLKitTranslateText) 11 | 12 | RCT_EXPORT_METHOD(identifyLanguage:(NSString *) text 13 | successCallback:(RCTResponseSenderBlock)successCallback 14 | failCallback:(RCTResponseSenderBlock)failCallback ) 15 | { 16 | MLKLanguageIdentification *client = [MLKLanguageIdentification languageIdentification]; 17 | 18 | [client identifyLanguageForText:text completion:^(NSString * _Nullable languageCode, 19 | NSError * _Nullable error) { 20 | if (error != nil) { 21 | failCallback(@[error.localizedDescription]); 22 | return; 23 | } 24 | successCallback(@[languageCode]); 25 | }]; 26 | } 27 | 28 | RCT_EXPORT_METHOD(identifyPossibleLanguages:(NSString *) text 29 | successCallback:(RCTResponseSenderBlock)successCallback 30 | failCallback:(RCTResponseSenderBlock)failCallback ) 31 | { 32 | MLKLanguageIdentification *client = [MLKLanguageIdentification languageIdentification]; 33 | 34 | [client identifyPossibleLanguagesForText:text 35 | completion:^(NSArray * _Nonnull identifiedLanguages, 36 | NSError * _Nullable error) { 37 | if (error != nil) { 38 | failCallback(@[error.localizedDescription]); 39 | return; 40 | } 41 | NSMutableArray* marr = [NSMutableArray new]; 42 | for (MLKIdentifiedLanguage *language in identifiedLanguages) { 43 | NSMutableDictionary* dictionary = [NSMutableDictionary new]; 44 | [dictionary setObject:language.languageTag forKey: @"code"]; 45 | [dictionary setObject: [[NSNumber alloc] initWithFloat:language.confidence] forKey: @"confidence"]; 46 | [marr addObject:dictionary]; 47 | } 48 | successCallback(@[marr]); 49 | }]; 50 | } 51 | 52 | RCT_EXPORT_METHOD(translateText:(NSString *) text 53 | sourceLanguageTag: (NSString *) sourceLanguageTag 54 | targetLanguageTag: (NSString *) targetLanguageTag 55 | successCallback:(RCTResponseSenderBlock)successCallback 56 | failCallback:(RCTResponseSenderBlock)failCallback ) 57 | { 58 | MLKTranslatorOptions *options = [[MLKTranslatorOptions alloc] initWithSourceLanguage:sourceLanguageTag targetLanguage:targetLanguageTag]; 59 | MLKTranslator *translator = [MLKTranslator translatorWithOptions: options]; 60 | [translator translateText:text completion:^(NSString *_Nullable translatedText, NSError *_Nullable error) { 61 | if (error != nil) { 62 | failCallback(@[error.localizedDescription]); 63 | return; 64 | } 65 | successCallback(@[translatedText]); 66 | }]; 67 | } 68 | 69 | RCT_EXPORT_METHOD(isModelDownloaded:(NSString *) lang 70 | callback:(RCTResponseSenderBlock)callback) 71 | { 72 | 73 | MLKTranslateRemoteModel *model = [MLKTranslateRemoteModel translateRemoteModelWithLanguage: lang]; 74 | bool downloaded = [[MLKModelManager modelManager] isModelDownloaded: model]; 75 | if (downloaded) { 76 | callback(@[@true]); 77 | }else{ 78 | callback(@[@false]); 79 | } 80 | } 81 | 82 | RCT_EXPORT_METHOD(deleteDownloadedModel:(NSString *) lang 83 | successCallback:(RCTResponseSenderBlock)successCallback 84 | failCallback:(RCTResponseSenderBlock)failCallback ) 85 | { 86 | MLKTranslateRemoteModel *model = [MLKTranslateRemoteModel translateRemoteModelWithLanguage: lang]; 87 | bool downloaded = [[MLKModelManager modelManager] isModelDownloaded: model]; 88 | if(downloaded) { 89 | [[MLKModelManager modelManager] deleteDownloadedModel:model completion:^(NSError * _Nullable error) { 90 | if (error != nil) { 91 | failCallback(@[error.localizedDescription]); 92 | return; 93 | } 94 | successCallback(@[@"success"]); 95 | }]; 96 | } 97 | } 98 | 99 | RCT_EXPORT_METHOD(downloadModel:(NSString *) lang 100 | successCallback:(RCTResponseSenderBlock)successCallback 101 | failCallback:(RCTResponseSenderBlock)failCallback ) 102 | { 103 | MLKModelDownloadConditions *conditions = [[MLKModelDownloadConditions alloc] initWithAllowsCellularAccess:NO 104 | allowsBackgroundDownloading:YES]; 105 | MLKTranslateRemoteModel *lmodel = [MLKTranslateRemoteModel translateRemoteModelWithLanguage: lang]; 106 | [[MLKModelManager modelManager] downloadModel:lmodel conditions:conditions]; 107 | id sob; 108 | id fob; 109 | sob = [NSNotificationCenter.defaultCenter 110 | addObserverForName:MLKModelDownloadDidSucceedNotification 111 | object:nil 112 | queue:nil 113 | usingBlock:^(NSNotification * _Nonnull note) { 114 | MLKTranslateRemoteModel *model = note.userInfo[MLKModelDownloadUserInfoKeyRemoteModel]; 115 | if ([model isKindOfClass:[MLKTranslateRemoteModel class]] && model == lmodel) { 116 | successCallback(@[@"success"]); 117 | } 118 | [NSNotificationCenter.defaultCenter removeObserver:sob]; 119 | [NSNotificationCenter.defaultCenter removeObserver:fob]; 120 | }]; 121 | fob = [NSNotificationCenter.defaultCenter 122 | addObserverForName:MLKModelDownloadDidFailNotification 123 | object:nil 124 | queue:nil 125 | usingBlock:^(NSNotification * _Nonnull note) { 126 | MLKTranslateRemoteModel *model = note.userInfo[MLKModelDownloadUserInfoKeyRemoteModel]; 127 | if ([model isKindOfClass:[MLKTranslateRemoteModel class]] && model == lmodel) { 128 | NSError *error = note.userInfo[MLKModelDownloadUserInfoKeyError]; 129 | failCallback(@[error.localizedDescription]); 130 | } 131 | [NSNotificationCenter.defaultCenter removeObserver:sob]; 132 | [NSNotificationCenter.defaultCenter removeObserver:fob]; 133 | }]; 134 | } 135 | 136 | @end 137 | -------------------------------------------------------------------------------- /ios/MlkitTranslateText.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1487613827B7DD7F00919796 /* MlkitTranslateText.m in Sources */ = {isa = PBXBuildFile; fileRef = 1487613727B7DD7F00919796 /* MlkitTranslateText.m */; }; 11 | /* End PBXBuildFile section */ 12 | 13 | /* Begin PBXCopyFilesBuildPhase section */ 14 | 58B511D91A9E6C8500147676 /* CopyFiles */ = { 15 | isa = PBXCopyFilesBuildPhase; 16 | buildActionMask = 2147483647; 17 | dstPath = "include/$(PRODUCT_NAME)"; 18 | dstSubfolderSpec = 16; 19 | files = ( 20 | ); 21 | runOnlyForDeploymentPostprocessing = 0; 22 | }; 23 | /* End PBXCopyFilesBuildPhase section */ 24 | 25 | /* Begin PBXFileReference section */ 26 | 134814201AA4EA6300B7C361 /* libMlkitTranslateText.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libMlkitTranslateText.a; sourceTree = BUILT_PRODUCTS_DIR; }; 27 | 1487613627B7DD7F00919796 /* MlkitTranslateText.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MlkitTranslateText.h; sourceTree = ""; }; 28 | 1487613727B7DD7F00919796 /* MlkitTranslateText.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MlkitTranslateText.m; sourceTree = ""; }; 29 | /* End PBXFileReference section */ 30 | 31 | /* Begin PBXFrameworksBuildPhase section */ 32 | 58B511D81A9E6C8500147676 /* Frameworks */ = { 33 | isa = PBXFrameworksBuildPhase; 34 | buildActionMask = 2147483647; 35 | files = ( 36 | ); 37 | runOnlyForDeploymentPostprocessing = 0; 38 | }; 39 | /* End PBXFrameworksBuildPhase section */ 40 | 41 | /* Begin PBXGroup section */ 42 | 134814211AA4EA7D00B7C361 /* Products */ = { 43 | isa = PBXGroup; 44 | children = ( 45 | 134814201AA4EA6300B7C361 /* libMlkitTranslateText.a */, 46 | ); 47 | name = Products; 48 | sourceTree = ""; 49 | }; 50 | 58B511D21A9E6C8500147676 = { 51 | isa = PBXGroup; 52 | children = ( 53 | 1487613627B7DD7F00919796 /* MlkitTranslateText.h */, 54 | 1487613727B7DD7F00919796 /* MlkitTranslateText.m */, 55 | 134814211AA4EA7D00B7C361 /* Products */, 56 | ); 57 | sourceTree = ""; 58 | }; 59 | /* End PBXGroup section */ 60 | 61 | /* Begin PBXNativeTarget section */ 62 | 58B511DA1A9E6C8500147676 /* MlkitTranslateText */ = { 63 | isa = PBXNativeTarget; 64 | buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "MlkitTranslateText" */; 65 | buildPhases = ( 66 | 58B511D71A9E6C8500147676 /* Sources */, 67 | 58B511D81A9E6C8500147676 /* Frameworks */, 68 | 58B511D91A9E6C8500147676 /* CopyFiles */, 69 | ); 70 | buildRules = ( 71 | ); 72 | dependencies = ( 73 | ); 74 | name = MlkitTranslateText; 75 | productName = RCTDataManager; 76 | productReference = 134814201AA4EA6300B7C361 /* libMlkitTranslateText.a */; 77 | productType = "com.apple.product-type.library.static"; 78 | }; 79 | /* End PBXNativeTarget section */ 80 | 81 | /* Begin PBXProject section */ 82 | 58B511D31A9E6C8500147676 /* Project object */ = { 83 | isa = PBXProject; 84 | attributes = { 85 | LastUpgradeCheck = 0920; 86 | ORGANIZATIONNAME = Facebook; 87 | TargetAttributes = { 88 | 58B511DA1A9E6C8500147676 = { 89 | CreatedOnToolsVersion = 6.1.1; 90 | }; 91 | }; 92 | }; 93 | buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "MlkitTranslateText" */; 94 | compatibilityVersion = "Xcode 3.2"; 95 | developmentRegion = en; 96 | hasScannedForEncodings = 0; 97 | knownRegions = ( 98 | en, 99 | Base, 100 | ); 101 | mainGroup = 58B511D21A9E6C8500147676; 102 | productRefGroup = 58B511D21A9E6C8500147676; 103 | projectDirPath = ""; 104 | projectRoot = ""; 105 | targets = ( 106 | 58B511DA1A9E6C8500147676 /* MlkitTranslateText */, 107 | ); 108 | }; 109 | /* End PBXProject section */ 110 | 111 | /* Begin PBXSourcesBuildPhase section */ 112 | 58B511D71A9E6C8500147676 /* Sources */ = { 113 | isa = PBXSourcesBuildPhase; 114 | buildActionMask = 2147483647; 115 | files = ( 116 | 1487613827B7DD7F00919796 /* MlkitTranslateText.m in Sources */, 117 | ); 118 | runOnlyForDeploymentPostprocessing = 0; 119 | }; 120 | /* End PBXSourcesBuildPhase section */ 121 | 122 | /* Begin XCBuildConfiguration section */ 123 | 58B511ED1A9E6C8500147676 /* Debug */ = { 124 | isa = XCBuildConfiguration; 125 | buildSettings = { 126 | ALWAYS_SEARCH_USER_PATHS = NO; 127 | CLANG_ANALYZER_NONNULL = YES; 128 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 129 | CLANG_CXX_LIBRARY = "libc++"; 130 | CLANG_ENABLE_MODULES = YES; 131 | CLANG_ENABLE_OBJC_ARC = YES; 132 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 133 | CLANG_WARN_BOOL_CONVERSION = YES; 134 | CLANG_WARN_COMMA = YES; 135 | CLANG_WARN_CONSTANT_CONVERSION = YES; 136 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 137 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 138 | CLANG_WARN_EMPTY_BODY = YES; 139 | CLANG_WARN_ENUM_CONVERSION = YES; 140 | CLANG_WARN_INFINITE_RECURSION = YES; 141 | CLANG_WARN_INT_CONVERSION = YES; 142 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 143 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 144 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 145 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 146 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 147 | CLANG_WARN_STRICT_PROTOTYPES = YES; 148 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 149 | CLANG_WARN_UNREACHABLE_CODE = YES; 150 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 151 | COPY_PHASE_STRIP = NO; 152 | ENABLE_STRICT_OBJC_MSGSEND = YES; 153 | ENABLE_TESTABILITY = YES; 154 | GCC_C_LANGUAGE_STANDARD = gnu99; 155 | GCC_DYNAMIC_NO_PIC = NO; 156 | GCC_NO_COMMON_BLOCKS = YES; 157 | GCC_OPTIMIZATION_LEVEL = 0; 158 | GCC_PREPROCESSOR_DEFINITIONS = ( 159 | "DEBUG=1", 160 | "$(inherited)", 161 | ); 162 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 163 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 164 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 165 | GCC_WARN_UNDECLARED_SELECTOR = YES; 166 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 167 | GCC_WARN_UNUSED_FUNCTION = YES; 168 | GCC_WARN_UNUSED_VARIABLE = YES; 169 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 170 | LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)"; 171 | LIBRARY_SEARCH_PATHS = ( 172 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", 173 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"", 174 | "\"$(inherited)\"", 175 | ); 176 | MTL_ENABLE_DEBUG_INFO = YES; 177 | ONLY_ACTIVE_ARCH = YES; 178 | SDKROOT = iphoneos; 179 | }; 180 | name = Debug; 181 | }; 182 | 58B511EE1A9E6C8500147676 /* Release */ = { 183 | isa = XCBuildConfiguration; 184 | buildSettings = { 185 | ALWAYS_SEARCH_USER_PATHS = NO; 186 | CLANG_ANALYZER_NONNULL = YES; 187 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 188 | CLANG_CXX_LIBRARY = "libc++"; 189 | CLANG_ENABLE_MODULES = YES; 190 | CLANG_ENABLE_OBJC_ARC = YES; 191 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 192 | CLANG_WARN_BOOL_CONVERSION = YES; 193 | CLANG_WARN_COMMA = YES; 194 | CLANG_WARN_CONSTANT_CONVERSION = YES; 195 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 196 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 197 | CLANG_WARN_EMPTY_BODY = YES; 198 | CLANG_WARN_ENUM_CONVERSION = YES; 199 | CLANG_WARN_INFINITE_RECURSION = YES; 200 | CLANG_WARN_INT_CONVERSION = YES; 201 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 202 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 203 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 204 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 205 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 206 | CLANG_WARN_STRICT_PROTOTYPES = YES; 207 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 208 | CLANG_WARN_UNREACHABLE_CODE = YES; 209 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 210 | COPY_PHASE_STRIP = YES; 211 | ENABLE_NS_ASSERTIONS = NO; 212 | ENABLE_STRICT_OBJC_MSGSEND = YES; 213 | GCC_C_LANGUAGE_STANDARD = gnu99; 214 | GCC_NO_COMMON_BLOCKS = YES; 215 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 216 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 217 | GCC_WARN_UNDECLARED_SELECTOR = YES; 218 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 219 | GCC_WARN_UNUSED_FUNCTION = YES; 220 | GCC_WARN_UNUSED_VARIABLE = YES; 221 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 222 | LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)"; 223 | LIBRARY_SEARCH_PATHS = ( 224 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", 225 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"", 226 | "\"$(inherited)\"", 227 | ); 228 | MTL_ENABLE_DEBUG_INFO = NO; 229 | SDKROOT = iphoneos; 230 | VALIDATE_PRODUCT = YES; 231 | }; 232 | name = Release; 233 | }; 234 | 58B511F01A9E6C8500147676 /* Debug */ = { 235 | isa = XCBuildConfiguration; 236 | buildSettings = { 237 | HEADER_SEARCH_PATHS = ( 238 | "$(inherited)", 239 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 240 | "$(SRCROOT)/../../../React/**", 241 | "$(SRCROOT)/../../react-native/React/**", 242 | ); 243 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 244 | OTHER_LDFLAGS = "-ObjC"; 245 | PRODUCT_NAME = MlkitTranslateText; 246 | SKIP_INSTALL = YES; 247 | }; 248 | name = Debug; 249 | }; 250 | 58B511F11A9E6C8500147676 /* Release */ = { 251 | isa = XCBuildConfiguration; 252 | buildSettings = { 253 | HEADER_SEARCH_PATHS = ( 254 | "$(inherited)", 255 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 256 | "$(SRCROOT)/../../../React/**", 257 | "$(SRCROOT)/../../react-native/React/**", 258 | ); 259 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 260 | OTHER_LDFLAGS = "-ObjC"; 261 | PRODUCT_NAME = MlkitTranslateText; 262 | SKIP_INSTALL = YES; 263 | }; 264 | name = Release; 265 | }; 266 | /* End XCBuildConfiguration section */ 267 | 268 | /* Begin XCConfigurationList section */ 269 | 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "MlkitTranslateText" */ = { 270 | isa = XCConfigurationList; 271 | buildConfigurations = ( 272 | 58B511ED1A9E6C8500147676 /* Debug */, 273 | 58B511EE1A9E6C8500147676 /* Release */, 274 | ); 275 | defaultConfigurationIsVisible = 0; 276 | defaultConfigurationName = Release; 277 | }; 278 | 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "MlkitTranslateText" */ = { 279 | isa = XCConfigurationList; 280 | buildConfigurations = ( 281 | 58B511F01A9E6C8500147676 /* Debug */, 282 | 58B511F11A9E6C8500147676 /* Release */, 283 | ); 284 | defaultConfigurationIsVisible = 0; 285 | defaultConfigurationName = Release; 286 | }; 287 | /* End XCConfigurationList section */ 288 | }; 289 | rootObject = 58B511D31A9E6C8500147676 /* Project object */; 290 | } 291 | -------------------------------------------------------------------------------- /ios/MlkitTranslateText.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-mlkit-translate-text", 3 | "title": "React Native Mlkit Translate Text", 4 | "version": "1.0.3", 5 | "description": "language identify and translate module based on MLKits", 6 | "main": "index.ts", 7 | "types": "./types/*", 8 | "files": [ 9 | "README.md", 10 | "android", 11 | "ios", 12 | "types", 13 | "index.ts", 14 | "src", 15 | "react-native-mlkit-translate-text.podspec" 16 | ], 17 | "scripts": { 18 | "test": "echo \"Error: no test specified\" && exit 1" 19 | }, 20 | "repository": { 21 | "type": "git", 22 | "url": "git+https://github.com/yaaliuzhipeng/react-native-mlkit-translate-text.git", 23 | "baseUrl": "https://github.com/yaaliuzhipeng/react-native-mlkit-translate-text" 24 | }, 25 | "keywords": [ 26 | "react-native", 27 | "MLKit", 28 | "translate-text" 29 | ], 30 | "author": { 31 | "name": "yaaliuzhipeng", 32 | "email": "yaaliuzhipeng@outlook.com" 33 | }, 34 | "license": "MIT", 35 | "licenseFilename": "LICENSE", 36 | "readmeFilename": "README.md", 37 | "peerDependencies": { 38 | "react": ">=16.8.1", 39 | "react-native": ">=0.66.0-rc.0 <1.0.x" 40 | }, 41 | "devDependencies": { 42 | "react": "^16.9.0", 43 | "react-native": "^0.66.0", 44 | "typescript": "^4.3.0" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /raw/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasonCareter/react-native-mlkit-translate-text/c0a38d74331b0d65ed0e895b75a1158218f65910/raw/logo.png -------------------------------------------------------------------------------- /react-native-mlkit-translate-text.podspec: -------------------------------------------------------------------------------- 1 | # react-native-mlkit-translate-text.podspec 2 | 3 | require "json" 4 | 5 | package = JSON.parse(File.read(File.join(__dir__, "package.json"))) 6 | 7 | Pod::Spec.new do |s| 8 | s.name = "react-native-mlkit-translate-text" 9 | s.version = package["version"] 10 | s.summary = package["description"] 11 | s.description = <<-DESC 12 | react-native-mlkit-translate-text 13 | DESC 14 | s.homepage = "https://github.com/yaaliuzhipeng/react-native-mlkit-translate-text" 15 | # brief license entry: 16 | s.license = "MIT" 17 | # optional - use expanded license entry instead: 18 | # s.license = { :type => "MIT", :file => "LICENSE" } 19 | s.authors = { "yaaliuzhipeng" => "yaaliuzhipeng@outlook.com" } 20 | s.platforms = { :ios => "11.0" } 21 | s.source = { :git => "https://github.com/yaaliuzhipeng/react-native-mlkit-translate-text.git", :tag => "#{s.version}" } 22 | 23 | s.source_files = "ios/**/*.{h,c,cc,cpp,m,mm,swift}" 24 | s.requires_arc = true 25 | 26 | s.dependency "React" 27 | s.dependency "GoogleMLKit/Translate", "2.5.0" 28 | s.dependency "GoogleMLKit/LanguageID", "2.5.0" 29 | # ... 30 | # s.dependency "..." 31 | end 32 | 33 | -------------------------------------------------------------------------------- /src/MLKitTranslator.ts: -------------------------------------------------------------------------------- 1 | import { NativeModules, Platform } from 'react-native'; 2 | 3 | const { MLKitTranslateText: NativeMLKitTranslateText } = NativeModules; 4 | 5 | export const LANG_TAGS = { 6 | AFRIKAANS: "af", 7 | ALBANIAN: "sq", 8 | ARABIC: "ar", 9 | BELARUSIAN: "be", 10 | BULGARIAN: "bg", 11 | BENGALI: "bn", 12 | CATALAN: "ca", 13 | CHINESE: "zh", 14 | CROATIAN: "hr", 15 | CZECH: "cs", 16 | DANISH: "da", 17 | DUTCH: "nl", 18 | ENGLISH: "en", 19 | ESPERANTO: "eo", 20 | ESTONIAN: "et", 21 | FINNISH: "fi", 22 | FRENCH: "fr", 23 | GALICIAN: "gl", 24 | GEORGIAN: "ka", 25 | GERMAN: "de", 26 | GREEK: "el", 27 | GUJARATI: "gu", 28 | HAITIAN_CREOLE: "ht", 29 | HEBREW: "he", 30 | HINDI: "hi", 31 | HUNGARIAN: "hu", 32 | ICELANDIC: "is", 33 | INDONESIAN: "id", 34 | IRISH: "ga", 35 | ITALIAN: "it", 36 | JAPANESE: "ja", 37 | KANNADA: "kn", 38 | KOREAN: "ko", 39 | LITHUANIAN: "lt", 40 | LATVIAN: "lv", 41 | MACEDONIAN: "mk", 42 | MARATHI: "mr", 43 | MALAY: "ms", 44 | MALTESE: "mt", 45 | NORWEGIAN: "no", 46 | PERSIAN: "fa", 47 | POLISH: "pl", 48 | PORTUGUESE: "pt", 49 | ROMANIAN: "ro", 50 | RUSSIAN: "ru", 51 | SLOVAK: "sk", 52 | SLOVENIAN: "sl", 53 | SPANISH: "es", 54 | SWEDISH: "sv", 55 | SWAHILI: "sw", 56 | TAGALOG: "tl", 57 | TAMIL: "ta", 58 | TELUGU: "te", 59 | THAI: "th", 60 | TURKISH: "tr", 61 | UKRAINIAN: "uk", 62 | URDU: "ur", 63 | VIETNAMESE: "vi", 64 | WELSH: "cy", 65 | } 66 | export type LANG_TAGS_TYPE = 'AFRIKAANS' | 67 | 'ALBANIAN' | 68 | 'ARABIC' | 69 | 'BELARUSIAN' | 70 | 'BULGARIAN' | 71 | 'BENGALI' | 72 | 'CATALAN' | 73 | 'CHINESE' | 74 | 'CROATIAN' | 75 | 'CZECH' | 76 | 'DANISH' | 77 | 'DUTCH' | 78 | 'ENGLISH' | 79 | 'ESPERANTO' | 80 | 'ESTONIAN' | 81 | 'FINNISH' | 82 | 'FRENCH' | 83 | 'GALICIAN' | 84 | 'GEORGIAN' | 85 | 'GERMAN' | 86 | 'GREEK' | 87 | 'GUJARATI' | 88 | 'HAITIAN_CREOLE' | 89 | 'HEBREW' | 90 | 'HINDI' | 91 | 'HUNGARIAN' | 92 | 'ICELANDIC' | 93 | 'INDONESIAN' | 94 | 'IRISH' | 95 | 'ITALIAN' | 96 | 'JAPANESE' | 97 | 'KANNADA' | 98 | 'KOREAN' | 99 | 'LITHUANIAN' | 100 | 'LATVIAN' | 101 | 'MACEDONIAN' | 102 | 'MARATHI' | 103 | 'MALAY' | 104 | 'MALTESE' | 105 | 'NORWEGIAN' | 106 | 'PERSIAN' | 107 | 'POLISH' | 108 | 'PORTUGUESE' | 109 | 'ROMANIAN' | 110 | 'RUSSIAN' | 111 | 'SLOVAK' | 112 | 'SLOVENIAN' | 113 | 'SPANISH' | 114 | 'SWEDISH' | 115 | 'SWAHILI' | 116 | 'TAGALOG' | 117 | 'TAMIL' | 118 | 'TELUGU' | 119 | 'THAI' | 120 | 'TURKISH' | 121 | 'UKRAINIAN' | 122 | 'URDU' | 123 | 'VIETNAMESE' | 124 | 'WELSH'; 125 | 126 | const identifyLanguage = (text: string) => { 127 | return new Promise((resolver, rejecter) => { 128 | NativeMLKitTranslateText.identifyLanguage( 129 | text, 130 | (v) => { resolver(v); }, 131 | (e) => { rejecter(e); }); 132 | }); 133 | } 134 | const identifyPossibleLanguages = (text: string) => { 135 | return new Promise((resolver, rejecter) => { 136 | NativeMLKitTranslateText.identifyLanguage( 137 | text, 138 | (v) => { resolver(v); }, 139 | (e) => { rejecter(e); }); 140 | }); 141 | } 142 | const translateText = (text: string, sourceLanguage: LANG_TAGS_TYPE, targetLanguage: LANG_TAGS_TYPE) => { 143 | return new Promise((resolver, rejecter) => { 144 | if (LANG_TAGS[sourceLanguage] === undefined || LANG_TAGS[targetLanguage] === undefined) { 145 | rejecter('unsupport language'); 146 | return; 147 | } 148 | NativeMLKitTranslateText.translateText( 149 | text, 150 | LANG_TAGS[sourceLanguage], 151 | LANG_TAGS[targetLanguage], 152 | (v) => { resolver(v); }, 153 | (e) => { rejecter(e); }); 154 | }); 155 | } 156 | const isModelDownloaded = (language: LANG_TAGS_TYPE) => { 157 | return new Promise((resolver, rejecter) => { 158 | if (LANG_TAGS[language] === undefined) { 159 | rejecter('unsupport language'); 160 | return; 161 | } 162 | NativeMLKitTranslateText.isModelDownloaded( 163 | LANG_TAGS[language], 164 | (v) => { 165 | if (Platform.OS === 'ios') { 166 | resolver(v === 1 ? true : false); 167 | } else { 168 | resolver(v); 169 | } 170 | }, 171 | // (e) => { rejecter(e); } // no need for now 172 | ); 173 | }); 174 | } 175 | const deleteDownloadedModel = (language: LANG_TAGS_TYPE) => { 176 | return new Promise((resolver, rejecter) => { 177 | if (LANG_TAGS[language] === undefined) { 178 | rejecter('unsupport language'); 179 | return; 180 | } 181 | NativeMLKitTranslateText.deleteDownloadedModel( 182 | LANG_TAGS[language], 183 | (v) => { resolver(v); }, 184 | (e) => { rejecter(e); } 185 | ); 186 | }); 187 | } 188 | const downloadModel = (language: LANG_TAGS_TYPE) => { 189 | return new Promise((resolver, rejecter) => { 190 | if (LANG_TAGS[language] === undefined) { 191 | rejecter('unsupport language'); 192 | return; 193 | } 194 | NativeMLKitTranslateText.downloadModel( 195 | LANG_TAGS[language], 196 | (v) => { resolver(v); }, 197 | (e) => { rejecter(e); } 198 | ); 199 | }); 200 | } 201 | 202 | const MLKitTranslator = { 203 | identifyLanguage, 204 | identifyPossibleLanguages, 205 | translateText, 206 | isModelDownloaded, 207 | deleteDownloadedModel, 208 | downloadModel 209 | } 210 | export default MLKitTranslator; 211 | export { 212 | identifyLanguage, 213 | identifyPossibleLanguages, 214 | translateText, 215 | isModelDownloaded, 216 | deleteDownloadedModel, 217 | downloadModel 218 | } --------------------------------------------------------------------------------