├── .gitignore ├── Examples └── Hello │ ├── .babelrc │ ├── .buckconfig │ ├── .flowconfig │ ├── .gitattributes │ ├── .gitignore │ ├── .watchmanconfig │ ├── __tests__ │ ├── index.android.js │ └── index.ios.js │ ├── android │ ├── app │ │ ├── BUCK │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── assets │ │ │ └── i18n │ │ │ ├── java │ │ │ └── com │ │ │ │ └── hello │ │ │ │ ├── MainActivity.java │ │ │ │ └── MainApplication.java │ │ │ └── res │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── keystores │ │ ├── BUCK │ │ └── debug.keystore.properties │ └── settings.gradle │ ├── i18n │ ├── fr_FR.mo │ ├── fr_FR.po │ ├── ko_KR.mo │ └── ko_KR.po │ ├── index.android.js │ ├── index.ios.js │ ├── ios │ ├── Hello.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Hello.xcscheme │ ├── Hello │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Base.lproj │ │ │ └── LaunchScreen.xib │ │ ├── Images.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── Info.plist │ │ └── main.m │ ├── HelloTests │ │ ├── HelloTests.m │ │ └── Info.plist │ └── i18n │ │ ├── fr_FR.mo │ │ ├── fr_FR.po │ │ ├── ko_KR.mo │ │ └── ko_KR.po │ ├── package.json │ └── yarn.lock ├── LICENSE ├── README.md ├── RNIntl.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── taggon.xcuserdatad │ │ ├── UserInterfaceState.xcuserstate │ │ └── WorkspaceSettings.xcsettings └── xcuserdata │ └── taggon.xcuserdatad │ └── xcschemes │ ├── RNIntl.xcscheme │ └── xcschememanagement.plist ├── RNIntl ├── GettextParser.h ├── GettextParser.m ├── RNIntl.h └── RNIntl.m ├── android ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── kim │ └── taegon │ └── rnintl │ ├── GettextParser.java │ ├── ReactNativeIntl.java │ └── ReactNativeIntlPackage.java ├── index.js ├── lib ├── BaseFormat.js ├── Collator.js ├── DateTimeFormat.js ├── NumberFormat.js └── Translation.js └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # node-waf configuration 20 | .lock-wscript 21 | 22 | # Compiled binary addons (http://nodejs.org/api/addons.html) 23 | build/Release 24 | 25 | # Dependency directory 26 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git 27 | node_modules 28 | 29 | .idea 30 | android/build 31 | android/local.properties 32 | 33 | # OSX 34 | .DS_Store 35 | -------------------------------------------------------------------------------- /Examples/Hello/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["react-native"] 3 | } -------------------------------------------------------------------------------- /Examples/Hello/.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /Examples/Hello/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | ; We fork some components by platform 3 | .*/*[.]android.js 4 | 5 | ; Ignore "BUCK" generated dirs 6 | /\.buckd/ 7 | 8 | ; Ignore unexpected extra "@providesModule" 9 | .*/node_modules/.*/node_modules/fbjs/.* 10 | 11 | ; Ignore duplicate module providers 12 | ; For RN Apps installed via npm, "Libraries" folder is inside 13 | ; "node_modules/react-native" but in the source repo it is in the root 14 | .*/Libraries/react-native/React.js 15 | .*/Libraries/react-native/ReactNative.js 16 | 17 | [include] 18 | 19 | [libs] 20 | node_modules/react-native/Libraries/react-native/react-native-interface.js 21 | node_modules/react-native/flow 22 | flow/ 23 | 24 | [options] 25 | module.system=haste 26 | 27 | experimental.strict_type_args=true 28 | 29 | munge_underscores=true 30 | 31 | 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\)$' -> 'RelativeImageStub' 32 | 33 | suppress_type=$FlowIssue 34 | suppress_type=$FlowFixMe 35 | suppress_type=$FixMe 36 | 37 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-6]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) 38 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-6]\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ 39 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy 40 | 41 | unsafe.enable_getters_and_setters=true 42 | 43 | [version] 44 | ^0.36.0 45 | -------------------------------------------------------------------------------- /Examples/Hello/.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /Examples/Hello/.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | project.xcworkspace 24 | 25 | # Android/IntelliJ 26 | # 27 | build/ 28 | .idea 29 | .gradle 30 | local.properties 31 | *.iml 32 | 33 | # node.js 34 | # 35 | node_modules/ 36 | npm-debug.log 37 | 38 | # BUCK 39 | buck-out/ 40 | \.buckd/ 41 | android/app/libs 42 | *.keystore 43 | 44 | # fastlane 45 | # 46 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 47 | # screenshots whenever they are needed. 48 | # For more information about the recommended setup visit: 49 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 50 | 51 | fastlane/report.xml 52 | fastlane/Preview.html 53 | fastlane/screenshots 54 | -------------------------------------------------------------------------------- /Examples/Hello/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /Examples/Hello/__tests__/index.android.js: -------------------------------------------------------------------------------- 1 | import 'react-native'; 2 | import React from 'react'; 3 | import Index from '../index.android.js'; 4 | 5 | // Note: test renderer must be required after react-native. 6 | import renderer from 'react-test-renderer'; 7 | 8 | it('renders correctly', () => { 9 | const tree = renderer.create( 10 | 11 | ); 12 | }); 13 | -------------------------------------------------------------------------------- /Examples/Hello/__tests__/index.ios.js: -------------------------------------------------------------------------------- 1 | import 'react-native'; 2 | import React from 'react'; 3 | import Index from '../index.ios.js'; 4 | 5 | // Note: test renderer must be required after react-native. 6 | import renderer from 'react-test-renderer'; 7 | 8 | it('renders correctly', () => { 9 | const tree = renderer.create( 10 | 11 | ); 12 | }); 13 | -------------------------------------------------------------------------------- /Examples/Hello/android/app/BUCK: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | # To learn about Buck see [Docs](https://buckbuild.com/). 4 | # To run your application with Buck: 5 | # - install Buck 6 | # - `npm start` - to start the packager 7 | # - `cd android` 8 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` 9 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck 10 | # - `buck install -r android/app` - compile, install and run application 11 | # 12 | 13 | lib_deps = [] 14 | for jarfile in glob(['libs/*.jar']): 15 | name = 'jars__' + re.sub(r'^.*/([^/]+)\.jar$', r'\1', jarfile) 16 | lib_deps.append(':' + name) 17 | prebuilt_jar( 18 | name = name, 19 | binary_jar = jarfile, 20 | ) 21 | 22 | for aarfile in glob(['libs/*.aar']): 23 | name = 'aars__' + re.sub(r'^.*/([^/]+)\.aar$', r'\1', aarfile) 24 | lib_deps.append(':' + name) 25 | android_prebuilt_aar( 26 | name = name, 27 | aar = aarfile, 28 | ) 29 | 30 | android_library( 31 | name = 'all-libs', 32 | exported_deps = lib_deps 33 | ) 34 | 35 | android_library( 36 | name = 'app-code', 37 | srcs = glob([ 38 | 'src/main/java/**/*.java', 39 | ]), 40 | deps = [ 41 | ':all-libs', 42 | ':build_config', 43 | ':res', 44 | ], 45 | ) 46 | 47 | android_build_config( 48 | name = 'build_config', 49 | package = 'com.hello', 50 | ) 51 | 52 | android_resource( 53 | name = 'res', 54 | res = 'src/main/res', 55 | package = 'com.hello', 56 | ) 57 | 58 | android_binary( 59 | name = 'app', 60 | package_type = 'debug', 61 | manifest = 'src/main/AndroidManifest.xml', 62 | keystore = '//android/keystores:debug', 63 | deps = [ 64 | ':app-code', 65 | ], 66 | ) 67 | -------------------------------------------------------------------------------- /Examples/Hello/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 19 | * entryFile: "index.android.js", 20 | * 21 | * // whether to bundle JS and assets in debug mode 22 | * bundleInDebug: false, 23 | * 24 | * // whether to bundle JS and assets in release mode 25 | * bundleInRelease: true, 26 | * 27 | * // whether to bundle JS and assets in another build variant (if configured). 28 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants 29 | * // The configuration property can be in the following formats 30 | * // 'bundleIn${productFlavor}${buildType}' 31 | * // 'bundleIn${buildType}' 32 | * // bundleInFreeDebug: true, 33 | * // bundleInPaidRelease: true, 34 | * // bundleInBeta: true, 35 | * 36 | * // the root of your project, i.e. where "package.json" lives 37 | * root: "../../", 38 | * 39 | * // where to put the JS bundle asset in debug mode 40 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", 41 | * 42 | * // where to put the JS bundle asset in release mode 43 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release", 44 | * 45 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 46 | * // require('./image.png')), in debug mode 47 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", 48 | * 49 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 50 | * // require('./image.png')), in release mode 51 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", 52 | * 53 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means 54 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to 55 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle 56 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ 57 | * // for example, you might want to remove it from here. 58 | * inputExcludes: ["android/**", "ios/**"], 59 | * 60 | * // override which node gets called and with what additional arguments 61 | * nodeExecutableAndArgs: ["node"] 62 | * 63 | * // supply additional arguments to the packager 64 | * extraPackagerArgs: [] 65 | * ] 66 | */ 67 | 68 | apply from: "../../node_modules/react-native/react.gradle" 69 | 70 | /** 71 | * Set this to true to create two separate APKs instead of one: 72 | * - An APK that only works on ARM devices 73 | * - An APK that only works on x86 devices 74 | * The advantage is the size of the APK is reduced by about 4MB. 75 | * Upload all the APKs to the Play Store and people will download 76 | * the correct one based on the CPU architecture of their device. 77 | */ 78 | def enableSeparateBuildPerCPUArchitecture = false 79 | 80 | /** 81 | * Run Proguard to shrink the Java bytecode in release builds. 82 | */ 83 | def enableProguardInReleaseBuilds = false 84 | 85 | android { 86 | compileSdkVersion 23 87 | buildToolsVersion "23.0.1" 88 | 89 | defaultConfig { 90 | applicationId "com.hello" 91 | minSdkVersion 16 92 | targetSdkVersion 22 93 | versionCode 1 94 | versionName "1.0" 95 | ndk { 96 | abiFilters "armeabi-v7a", "x86" 97 | } 98 | } 99 | splits { 100 | abi { 101 | reset() 102 | enable enableSeparateBuildPerCPUArchitecture 103 | universalApk false // If true, also generate a universal APK 104 | include "armeabi-v7a", "x86" 105 | } 106 | } 107 | buildTypes { 108 | release { 109 | minifyEnabled enableProguardInReleaseBuilds 110 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 111 | } 112 | } 113 | // applicationVariants are e.g. debug, release 114 | applicationVariants.all { variant -> 115 | variant.outputs.each { output -> 116 | // For each separate APK per architecture, set a unique version code as described here: 117 | // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits 118 | def versionCodes = ["armeabi-v7a":1, "x86":2] 119 | def abi = output.getFilter(OutputFile.ABI) 120 | if (abi != null) { // null for the universal-debug, universal-release variants 121 | output.versionCodeOverride = 122 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode 123 | } 124 | } 125 | } 126 | } 127 | 128 | dependencies { 129 | compile project(':react-native-intl') 130 | compile fileTree(dir: "libs", include: ["*.jar"]) 131 | compile "com.android.support:appcompat-v7:23.0.1" 132 | compile "com.facebook.react:react-native:+" // From node_modules 133 | } 134 | 135 | // Run this once to be able to run the application with BUCK 136 | // puts all compile dependencies into folder libs for BUCK to use 137 | task copyDownloadableDepsToLibs(type: Copy) { 138 | from configurations.compile 139 | into 'libs' 140 | } 141 | -------------------------------------------------------------------------------- /Examples/Hello/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 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Disabling obfuscation is useful if you collect stack traces from production crashes 20 | # (unless you are using a system that supports de-obfuscate the stack traces). 21 | -dontobfuscate 22 | 23 | # React Native 24 | 25 | # Keep our interfaces so they can be used by other ProGuard rules. 26 | # See http://sourceforge.net/p/proguard/bugs/466/ 27 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip 28 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters 29 | -keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip 30 | 31 | # Do not strip any method/class that is annotated with @DoNotStrip 32 | -keep @com.facebook.proguard.annotations.DoNotStrip class * 33 | -keep @com.facebook.common.internal.DoNotStrip class * 34 | -keepclassmembers class * { 35 | @com.facebook.proguard.annotations.DoNotStrip *; 36 | @com.facebook.common.internal.DoNotStrip *; 37 | } 38 | 39 | -keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * { 40 | void set*(***); 41 | *** get*(); 42 | } 43 | 44 | -keep class * extends com.facebook.react.bridge.JavaScriptModule { *; } 45 | -keep class * extends com.facebook.react.bridge.NativeModule { *; } 46 | -keepclassmembers,includedescriptorclasses class * { native ; } 47 | -keepclassmembers class * { @com.facebook.react.uimanager.UIProp ; } 48 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp ; } 49 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup ; } 50 | 51 | -dontwarn com.facebook.react.** 52 | 53 | # okhttp 54 | 55 | -keepattributes Signature 56 | -keepattributes *Annotation* 57 | -keep class okhttp3.** { *; } 58 | -keep interface okhttp3.** { *; } 59 | -dontwarn okhttp3.** 60 | 61 | # okio 62 | 63 | -keep class sun.misc.Unsafe { *; } 64 | -dontwarn java.nio.file.* 65 | -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement 66 | -dontwarn okio.** 67 | -------------------------------------------------------------------------------- /Examples/Hello/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 12 | 13 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /Examples/Hello/android/app/src/main/assets/i18n: -------------------------------------------------------------------------------- 1 | ../../../../../i18n -------------------------------------------------------------------------------- /Examples/Hello/android/app/src/main/java/com/hello/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.hello; 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. 9 | * This is used to schedule rendering of the component. 10 | */ 11 | @Override 12 | protected String getMainComponentName() { 13 | return "Hello"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Examples/Hello/android/app/src/main/java/com/hello/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.hello; 2 | 3 | import android.app.Application; 4 | import android.util.Log; 5 | 6 | import com.facebook.react.ReactApplication; 7 | import kim.taegon.rnintl.ReactNativeIntlPackage; 8 | import com.facebook.react.ReactInstanceManager; 9 | import com.facebook.react.ReactNativeHost; 10 | import com.facebook.react.ReactPackage; 11 | import com.facebook.react.shell.MainReactPackage; 12 | import com.facebook.soloader.SoLoader; 13 | 14 | import java.util.Arrays; 15 | import java.util.List; 16 | 17 | public class MainApplication extends Application implements ReactApplication { 18 | 19 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { 20 | @Override 21 | protected boolean getUseDeveloperSupport() { 22 | return BuildConfig.DEBUG; 23 | } 24 | 25 | @Override 26 | protected List getPackages() { 27 | return Arrays.asList( 28 | new MainReactPackage(), 29 | new ReactNativeIntlPackage() 30 | ); 31 | } 32 | }; 33 | 34 | @Override 35 | public ReactNativeHost getReactNativeHost() { 36 | return mReactNativeHost; 37 | } 38 | 39 | @Override 40 | public void onCreate() { 41 | super.onCreate(); 42 | SoLoader.init(this, /* native exopackage */ false); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Examples/Hello/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taggon/react-native-intl/445fe5e2f330a11969f4c7ffac80faa1d93535bb/Examples/Hello/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /Examples/Hello/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taggon/react-native-intl/445fe5e2f330a11969f4c7ffac80faa1d93535bb/Examples/Hello/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /Examples/Hello/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taggon/react-native-intl/445fe5e2f330a11969f4c7ffac80faa1d93535bb/Examples/Hello/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Examples/Hello/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taggon/react-native-intl/445fe5e2f330a11969f4c7ffac80faa1d93535bb/Examples/Hello/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Examples/Hello/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Hello 3 | 4 | -------------------------------------------------------------------------------- /Examples/Hello/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Examples/Hello/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:1.3.1' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | mavenLocal() 18 | jcenter() 19 | maven { 20 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 21 | url "$rootDir/../node_modules/react-native/android" 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Examples/Hello/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | android.useDeprecatedNdk=true 21 | -------------------------------------------------------------------------------- /Examples/Hello/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taggon/react-native-intl/445fe5e2f330a11969f4c7ffac80faa1d93535bb/Examples/Hello/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /Examples/Hello/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip 6 | -------------------------------------------------------------------------------- /Examples/Hello/android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /Examples/Hello/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /Examples/Hello/android/keystores/BUCK: -------------------------------------------------------------------------------- 1 | keystore( 2 | name = 'debug', 3 | store = 'debug.keystore', 4 | properties = 'debug.keystore.properties', 5 | visibility = [ 6 | 'PUBLIC', 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /Examples/Hello/android/keystores/debug.keystore.properties: -------------------------------------------------------------------------------- 1 | key.store=debug.keystore 2 | key.alias=androiddebugkey 3 | key.store.password=android 4 | key.alias.password=android 5 | -------------------------------------------------------------------------------- /Examples/Hello/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'Hello' 2 | include ':react-native-intl' 3 | project(':react-native-intl').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-intl/android') 4 | 5 | include ':app' 6 | -------------------------------------------------------------------------------- /Examples/Hello/i18n/fr_FR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taggon/react-native-intl/445fe5e2f330a11969f4c7ffac80faa1d93535bb/Examples/Hello/i18n/fr_FR.mo -------------------------------------------------------------------------------- /Examples/Hello/i18n/fr_FR.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: Hello\n" 4 | "POT-Creation-Date: 2015-12-22 17:43+0900\n" 5 | "PO-Revision-Date: 2015-12-22 17:50+0900\n" 6 | "Language-Team: \n" 7 | "MIME-Version: 1.0\n" 8 | "Content-Type: text/plain; charset=UTF-8\n" 9 | "Content-Transfer-Encoding: 8bit\n" 10 | "X-Generator: Poedit 1.8.6\n" 11 | "X-Poedit-Basepath: .\n" 12 | "Plural-Forms: nplurals=2; plural=(n > 1);\n" 13 | "X-Poedit-SourceCharset: UTF-8\n" 14 | "Last-Translator: \n" 15 | "Language: fr_FR\n" 16 | 17 | msgid "Hello, it's me" 18 | msgstr "Bonjour, il est moi" 19 | 20 | msgid "Click to change your language" 21 | msgstr "Cliquez pour changer votre langue" 22 | -------------------------------------------------------------------------------- /Examples/Hello/i18n/ko_KR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taggon/react-native-intl/445fe5e2f330a11969f4c7ffac80faa1d93535bb/Examples/Hello/i18n/ko_KR.mo -------------------------------------------------------------------------------- /Examples/Hello/i18n/ko_KR.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: Hello\n" 4 | "POT-Creation-Date: 2015-12-22 17:43+0900\n" 5 | "PO-Revision-Date: 2015-12-22 17:46+0900\n" 6 | "Last-Translator: \n" 7 | "Language-Team: \n" 8 | "MIME-Version: 1.0\n" 9 | "Content-Type: text/plain; charset=UTF-8\n" 10 | "Content-Transfer-Encoding: 8bit\n" 11 | "X-Generator: Poedit 1.8.6\n" 12 | "X-Poedit-Basepath: .\n" 13 | "Plural-Forms: nplurals=1; plural=0;\n" 14 | "Language: ko_KR\n" 15 | "X-Poedit-SourceCharset: UTF-8\n" 16 | 17 | msgid "Hello, it's me" 18 | msgstr "안녕하세요, 저예요" 19 | 20 | msgid "Click to change your language" 21 | msgstr "언어를 변경하려면 클릭하세요" 22 | -------------------------------------------------------------------------------- /Examples/Hello/index.android.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | * @flow 5 | */ 6 | 7 | import React, { Component } from 'react'; 8 | import { 9 | AppRegistry, 10 | StyleSheet, 11 | Text, 12 | View, 13 | Alert 14 | } from 'react-native'; 15 | import Intl from 'react-native-intl'; 16 | 17 | export default class Hello extends Component { 18 | constructor() { 19 | super(); 20 | this.state = { 21 | _(msgid){ return msgid }, 22 | today: '', 23 | number: '', 24 | currency: '', 25 | }; 26 | this.showLanguages = this.showLanguages.bind(this); 27 | } 28 | 29 | componentDidMount() { 30 | this.onChangeLanguage('en-US'); 31 | } 32 | 33 | async onChangeLanguage(localeIdentifier) { 34 | const dateFormatter = new Intl.DateTimeFormat(localeIdentifier, {year:'numeric', month:'2-digit', day:'2-digit', hour:'2-digit', minute:'2-digit', second:'2-digit', hour12:false}); 35 | 36 | this.setState({ 37 | today: await dateFormatter.format(new Date()), 38 | integer: await (new Intl.NumberFormat(localeIdentifier)).format(123456), 39 | number: await (new Intl.NumberFormat(localeIdentifier)).format(123456.78), 40 | currency: await (new Intl.NumberFormat(localeIdentifier, {style:'currency'})).format(123456.78), 41 | _: await (new Intl.Translation(localeIdentifier)).getTranslator() 42 | }); 43 | } 44 | 45 | showLanguages() { 46 | Alert.alert( 47 | 'Languages', 48 | '', 49 | [ 50 | {text:'English', onPress: ()=>this.onChangeLanguage('en-US') }, 51 | {text:'Français', onPress: ()=>this.onChangeLanguage('fr-FR') }, 52 | {text:'한국어', onPress: ()=>this.onChangeLanguage('ko-KR') } 53 | ] 54 | ); 55 | } 56 | 57 | render() { 58 | return ( 59 | 60 | 61 | {this.state._("Hello, it's me")} 62 | 63 | 64 | {this.state.today} 65 | 66 | 67 | {this.state.integer} 68 | 69 | 70 | {this.state.number} 71 | 72 | 73 | {this.state.currency} 74 | 75 | 76 | {this.state._("Click to change your language")} 77 | 78 | 79 | ); 80 | } 81 | } 82 | 83 | const styles = StyleSheet.create({ 84 | container: { 85 | flex: 1, 86 | justifyContent: 'center', 87 | alignItems: 'center', 88 | backgroundColor: '#F5FCFF', 89 | }, 90 | hello: { 91 | fontSize: 20, 92 | textAlign: 'center', 93 | margin: 10, 94 | }, 95 | date: { 96 | textAlign: 'center', 97 | color: '#333333', 98 | marginBottom: 5, 99 | }, 100 | number: { 101 | textAlign: 'center', 102 | color: '#333333', 103 | marginBottom: 5, 104 | }, 105 | button: { 106 | textAlign: 'center', 107 | backgroundColor: '#dddddd', 108 | padding: 15, 109 | marginTop: 20 110 | } 111 | }); 112 | 113 | AppRegistry.registerComponent('Hello', () => Hello); 114 | -------------------------------------------------------------------------------- /Examples/Hello/index.ios.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | * @flow 5 | */ 6 | 7 | import React, { Component } from 'react'; 8 | import { 9 | AppRegistry, 10 | StyleSheet, 11 | Text, 12 | View, 13 | ActionSheetIOS 14 | } from 'react-native'; 15 | import Intl from 'react-native-intl'; 16 | 17 | export default class Hello extends Component { 18 | constructor() { 19 | super(); 20 | this.state = { 21 | _(msgid){ return msgid }, 22 | today: '', 23 | number: '', 24 | currency: '', 25 | }; 26 | this.showActionSheet = this.showActionSheet.bind(this); 27 | } 28 | 29 | componentDidMount() { 30 | this.onChangeLanguage('en-US'); 31 | } 32 | 33 | showActionSheet() { 34 | ActionSheetIOS.showActionSheetWithOptions( 35 | { options: [ 'English', 'Français', '한국어' ] }, 36 | (buttonIndex) => { 37 | this.onChangeLanguage(['en-US', 'fr-FR', 'ko-KR'][buttonIndex]); 38 | } 39 | ); 40 | } 41 | 42 | async onChangeLanguage(localeIdentifier) { 43 | const dateFormatter = new Intl.DateTimeFormat(localeIdentifier, {year:'numeric', month:'2-digit', day:'2-digit', hour:'2-digit', minute:'2-digit', second:'2-digit', hour12:false}); 44 | 45 | this.setState({ 46 | today: await dateFormatter.format(new Date()), 47 | integer: await (new Intl.NumberFormat(localeIdentifier)).format(123456), 48 | number: await (new Intl.NumberFormat(localeIdentifier)).format(123456.78), 49 | currency: await (new Intl.NumberFormat(localeIdentifier, {style:'currency'})).format(123456.78), 50 | _: await (new Intl.Translation(localeIdentifier)).getTranslator() 51 | }); 52 | } 53 | 54 | render() { 55 | return ( 56 | 57 | 58 | {this.state._("Hello, it's me")} 59 | 60 | 61 | {this.state.today} 62 | 63 | 64 | {this.state.integer} 65 | 66 | 67 | {this.state.number} 68 | 69 | 70 | {this.state.currency} 71 | 72 | 73 | {this.state._("Click to change your language")} 74 | 75 | 76 | ); 77 | } 78 | } 79 | 80 | const styles = StyleSheet.create({ 81 | container: { 82 | flex: 1, 83 | justifyContent: 'center', 84 | alignItems: 'center', 85 | backgroundColor: '#F5FCFF', 86 | }, 87 | hello: { 88 | fontSize: 20, 89 | textAlign: 'center', 90 | margin: 10, 91 | }, 92 | date: { 93 | textAlign: 'center', 94 | color: '#333333', 95 | marginBottom: 5, 96 | }, 97 | number: { 98 | textAlign: 'center', 99 | color: '#333333', 100 | marginBottom: 5, 101 | }, 102 | button: { 103 | textAlign: 'center', 104 | backgroundColor: '#dddddd', 105 | padding: 15, 106 | marginTop: 20 107 | } 108 | }); 109 | 110 | AppRegistry.registerComponent('Hello', () => Hello); 111 | -------------------------------------------------------------------------------- /Examples/Hello/ios/Hello.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; }; 11 | 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; }; 12 | 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; }; 13 | 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; }; 14 | 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; }; 15 | 00E356F31AD99517003FC87E /* HelloTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* HelloTests.m */; }; 16 | 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; }; 17 | 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; }; 18 | 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */; }; 19 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; 20 | 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; }; 21 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 22 | 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 23 | 140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; 24 | 146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; 25 | 472B448F2152473A98ABEAD1 /* libRNIntl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B23191BEF50401FAF005832 /* libRNIntl.a */; }; 26 | 5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; }; 27 | 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; }; 28 | F2B0111D1E4216D000EC9CCA /* i18n in Resources */ = {isa = PBXBuildFile; fileRef = F2B0111C1E4216D000EC9CCA /* i18n */; }; 29 | /* End PBXBuildFile section */ 30 | 31 | /* Begin PBXContainerItemProxy section */ 32 | 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */ = { 33 | isa = PBXContainerItemProxy; 34 | containerPortal = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; 35 | proxyType = 2; 36 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 37 | remoteInfo = RCTActionSheet; 38 | }; 39 | 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */ = { 40 | isa = PBXContainerItemProxy; 41 | containerPortal = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; 42 | proxyType = 2; 43 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 44 | remoteInfo = RCTGeolocation; 45 | }; 46 | 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */ = { 47 | isa = PBXContainerItemProxy; 48 | containerPortal = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; 49 | proxyType = 2; 50 | remoteGlobalIDString = 58B5115D1A9E6B3D00147676; 51 | remoteInfo = RCTImage; 52 | }; 53 | 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */ = { 54 | isa = PBXContainerItemProxy; 55 | containerPortal = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; 56 | proxyType = 2; 57 | remoteGlobalIDString = 58B511DB1A9E6C8500147676; 58 | remoteInfo = RCTNetwork; 59 | }; 60 | 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */ = { 61 | isa = PBXContainerItemProxy; 62 | containerPortal = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */; 63 | proxyType = 2; 64 | remoteGlobalIDString = 832C81801AAF6DEF007FA2F7; 65 | remoteInfo = RCTVibration; 66 | }; 67 | 00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = { 68 | isa = PBXContainerItemProxy; 69 | containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; 70 | proxyType = 1; 71 | remoteGlobalIDString = 13B07F861A680F5B00A75B9A; 72 | remoteInfo = Hello; 73 | }; 74 | 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */ = { 75 | isa = PBXContainerItemProxy; 76 | containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; 77 | proxyType = 2; 78 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 79 | remoteInfo = RCTSettings; 80 | }; 81 | 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */ = { 82 | isa = PBXContainerItemProxy; 83 | containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; 84 | proxyType = 2; 85 | remoteGlobalIDString = 3C86DF461ADF2C930047B81A; 86 | remoteInfo = RCTWebSocket; 87 | }; 88 | 146834031AC3E56700842450 /* PBXContainerItemProxy */ = { 89 | isa = PBXContainerItemProxy; 90 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; 91 | proxyType = 2; 92 | remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192; 93 | remoteInfo = React; 94 | }; 95 | 3DAD3E831DF850E9000B6D8A /* PBXContainerItemProxy */ = { 96 | isa = PBXContainerItemProxy; 97 | containerPortal = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; 98 | proxyType = 2; 99 | remoteGlobalIDString = 2D2A283A1D9B042B00D4039D; 100 | remoteInfo = "RCTImage-tvOS"; 101 | }; 102 | 3DAD3E871DF850E9000B6D8A /* PBXContainerItemProxy */ = { 103 | isa = PBXContainerItemProxy; 104 | containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; 105 | proxyType = 2; 106 | remoteGlobalIDString = 2D2A28471D9B043800D4039D; 107 | remoteInfo = "RCTLinking-tvOS"; 108 | }; 109 | 3DAD3E8B1DF850E9000B6D8A /* PBXContainerItemProxy */ = { 110 | isa = PBXContainerItemProxy; 111 | containerPortal = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; 112 | proxyType = 2; 113 | remoteGlobalIDString = 2D2A28541D9B044C00D4039D; 114 | remoteInfo = "RCTNetwork-tvOS"; 115 | }; 116 | 3DAD3E8F1DF850E9000B6D8A /* PBXContainerItemProxy */ = { 117 | isa = PBXContainerItemProxy; 118 | containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; 119 | proxyType = 2; 120 | remoteGlobalIDString = 2D2A28611D9B046600D4039D; 121 | remoteInfo = "RCTSettings-tvOS"; 122 | }; 123 | 3DAD3E931DF850E9000B6D8A /* PBXContainerItemProxy */ = { 124 | isa = PBXContainerItemProxy; 125 | containerPortal = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; 126 | proxyType = 2; 127 | remoteGlobalIDString = 2D2A287B1D9B048500D4039D; 128 | remoteInfo = "RCTText-tvOS"; 129 | }; 130 | 3DAD3E981DF850E9000B6D8A /* PBXContainerItemProxy */ = { 131 | isa = PBXContainerItemProxy; 132 | containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; 133 | proxyType = 2; 134 | remoteGlobalIDString = 2D2A28881D9B049200D4039D; 135 | remoteInfo = "RCTWebSocket-tvOS"; 136 | }; 137 | 3DAD3EA21DF850E9000B6D8A /* PBXContainerItemProxy */ = { 138 | isa = PBXContainerItemProxy; 139 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; 140 | proxyType = 2; 141 | remoteGlobalIDString = 2D2A28131D9B038B00D4039D; 142 | remoteInfo = "React-tvOS"; 143 | }; 144 | 3DAD3EA41DF850E9000B6D8A /* PBXContainerItemProxy */ = { 145 | isa = PBXContainerItemProxy; 146 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; 147 | proxyType = 2; 148 | remoteGlobalIDString = 3D3C059A1DE3340900C268FA; 149 | remoteInfo = yoga; 150 | }; 151 | 3DAD3EA61DF850E9000B6D8A /* PBXContainerItemProxy */ = { 152 | isa = PBXContainerItemProxy; 153 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; 154 | proxyType = 2; 155 | remoteGlobalIDString = 3D3C06751DE3340C00C268FA; 156 | remoteInfo = "yoga-tvOS"; 157 | }; 158 | 3DAD3EA81DF850E9000B6D8A /* PBXContainerItemProxy */ = { 159 | isa = PBXContainerItemProxy; 160 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; 161 | proxyType = 2; 162 | remoteGlobalIDString = 3D3CD9251DE5FBEC00167DC4; 163 | remoteInfo = cxxreact; 164 | }; 165 | 3DAD3EAA1DF850E9000B6D8A /* PBXContainerItemProxy */ = { 166 | isa = PBXContainerItemProxy; 167 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; 168 | proxyType = 2; 169 | remoteGlobalIDString = 3D3CD9321DE5FBEE00167DC4; 170 | remoteInfo = "cxxreact-tvOS"; 171 | }; 172 | 3DAD3EAC1DF850E9000B6D8A /* PBXContainerItemProxy */ = { 173 | isa = PBXContainerItemProxy; 174 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; 175 | proxyType = 2; 176 | remoteGlobalIDString = 3D3CD90B1DE5FBD600167DC4; 177 | remoteInfo = jschelpers; 178 | }; 179 | 3DAD3EAE1DF850E9000B6D8A /* PBXContainerItemProxy */ = { 180 | isa = PBXContainerItemProxy; 181 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; 182 | proxyType = 2; 183 | remoteGlobalIDString = 3D3CD9181DE5FBD800167DC4; 184 | remoteInfo = "jschelpers-tvOS"; 185 | }; 186 | 5E9157321DD0AC6500FF2AA8 /* PBXContainerItemProxy */ = { 187 | isa = PBXContainerItemProxy; 188 | containerPortal = 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */; 189 | proxyType = 2; 190 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 191 | remoteInfo = RCTAnimation; 192 | }; 193 | 5E9157341DD0AC6500FF2AA8 /* PBXContainerItemProxy */ = { 194 | isa = PBXContainerItemProxy; 195 | containerPortal = 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */; 196 | proxyType = 2; 197 | remoteGlobalIDString = 2D2A28201D9B03D100D4039D; 198 | remoteInfo = "RCTAnimation-tvOS"; 199 | }; 200 | 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */ = { 201 | isa = PBXContainerItemProxy; 202 | containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; 203 | proxyType = 2; 204 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 205 | remoteInfo = RCTLinking; 206 | }; 207 | 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */ = { 208 | isa = PBXContainerItemProxy; 209 | containerPortal = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; 210 | proxyType = 2; 211 | remoteGlobalIDString = 58B5119B1A9E6C1200147676; 212 | remoteInfo = RCTText; 213 | }; 214 | F2B0111A1E42111400EC9CCA /* PBXContainerItemProxy */ = { 215 | isa = PBXContainerItemProxy; 216 | containerPortal = A1BD061A101C4E7D9A173CD5 /* RNIntl.xcodeproj */; 217 | proxyType = 2; 218 | remoteGlobalIDString = F24A65DC1C19B9FC007767E9; 219 | remoteInfo = RNIntl; 220 | }; 221 | /* End PBXContainerItemProxy section */ 222 | 223 | /* Begin PBXFileReference section */ 224 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = ""; }; 225 | 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = "../node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj"; sourceTree = ""; }; 226 | 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = "../node_modules/react-native/Libraries/Geolocation/RCTGeolocation.xcodeproj"; sourceTree = ""; }; 227 | 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = "../node_modules/react-native/Libraries/Image/RCTImage.xcodeproj"; sourceTree = ""; }; 228 | 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = "../node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj"; sourceTree = ""; }; 229 | 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = "../node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj"; sourceTree = ""; }; 230 | 00E356EE1AD99517003FC87E /* HelloTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = HelloTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 231 | 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 232 | 00E356F21AD99517003FC87E /* HelloTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HelloTests.m; sourceTree = ""; }; 233 | 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = ""; }; 234 | 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = ""; }; 235 | 13B07F961A680F5B00A75B9A /* Hello.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Hello.app; sourceTree = BUILT_PRODUCTS_DIR; }; 236 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = Hello/AppDelegate.h; sourceTree = ""; }; 237 | 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = Hello/AppDelegate.m; sourceTree = ""; }; 238 | 13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 239 | 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = Hello/Images.xcassets; sourceTree = ""; }; 240 | 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Hello/Info.plist; sourceTree = ""; }; 241 | 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Hello/main.m; sourceTree = ""; }; 242 | 146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = ""; }; 243 | 3B23191BEF50401FAF005832 /* libRNIntl.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNIntl.a; sourceTree = ""; }; 244 | 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = ""; }; 245 | 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = ""; }; 246 | 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = ""; }; 247 | A1BD061A101C4E7D9A173CD5 /* RNIntl.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNIntl.xcodeproj; path = "../node_modules/react-native-intl/RNIntl.xcodeproj"; sourceTree = ""; }; 248 | F2B0111C1E4216D000EC9CCA /* i18n */ = {isa = PBXFileReference; lastKnownFileType = folder; path = i18n; sourceTree = ""; }; 249 | /* End PBXFileReference section */ 250 | 251 | /* Begin PBXFrameworksBuildPhase section */ 252 | 00E356EB1AD99517003FC87E /* Frameworks */ = { 253 | isa = PBXFrameworksBuildPhase; 254 | buildActionMask = 2147483647; 255 | files = ( 256 | 140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */, 257 | ); 258 | runOnlyForDeploymentPostprocessing = 0; 259 | }; 260 | 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { 261 | isa = PBXFrameworksBuildPhase; 262 | buildActionMask = 2147483647; 263 | files = ( 264 | 5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */, 265 | 146834051AC3E58100842450 /* libReact.a in Frameworks */, 266 | 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */, 267 | 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */, 268 | 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */, 269 | 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */, 270 | 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */, 271 | 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */, 272 | 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */, 273 | 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */, 274 | 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */, 275 | 472B448F2152473A98ABEAD1 /* libRNIntl.a in Frameworks */, 276 | ); 277 | runOnlyForDeploymentPostprocessing = 0; 278 | }; 279 | /* End PBXFrameworksBuildPhase section */ 280 | 281 | /* Begin PBXGroup section */ 282 | 00C302A81ABCB8CE00DB3ED1 /* Products */ = { 283 | isa = PBXGroup; 284 | children = ( 285 | 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */, 286 | ); 287 | name = Products; 288 | sourceTree = ""; 289 | }; 290 | 00C302B61ABCB90400DB3ED1 /* Products */ = { 291 | isa = PBXGroup; 292 | children = ( 293 | 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */, 294 | ); 295 | name = Products; 296 | sourceTree = ""; 297 | }; 298 | 00C302BC1ABCB91800DB3ED1 /* Products */ = { 299 | isa = PBXGroup; 300 | children = ( 301 | 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */, 302 | 3DAD3E841DF850E9000B6D8A /* libRCTImage-tvOS.a */, 303 | ); 304 | name = Products; 305 | sourceTree = ""; 306 | }; 307 | 00C302D41ABCB9D200DB3ED1 /* Products */ = { 308 | isa = PBXGroup; 309 | children = ( 310 | 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */, 311 | 3DAD3E8C1DF850E9000B6D8A /* libRCTNetwork-tvOS.a */, 312 | ); 313 | name = Products; 314 | sourceTree = ""; 315 | }; 316 | 00C302E01ABCB9EE00DB3ED1 /* Products */ = { 317 | isa = PBXGroup; 318 | children = ( 319 | 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */, 320 | ); 321 | name = Products; 322 | sourceTree = ""; 323 | }; 324 | 00E356EF1AD99517003FC87E /* HelloTests */ = { 325 | isa = PBXGroup; 326 | children = ( 327 | 00E356F21AD99517003FC87E /* HelloTests.m */, 328 | 00E356F01AD99517003FC87E /* Supporting Files */, 329 | ); 330 | path = HelloTests; 331 | sourceTree = ""; 332 | }; 333 | 00E356F01AD99517003FC87E /* Supporting Files */ = { 334 | isa = PBXGroup; 335 | children = ( 336 | 00E356F11AD99517003FC87E /* Info.plist */, 337 | ); 338 | name = "Supporting Files"; 339 | sourceTree = ""; 340 | }; 341 | 139105B71AF99BAD00B5F7CC /* Products */ = { 342 | isa = PBXGroup; 343 | children = ( 344 | 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */, 345 | 3DAD3E901DF850E9000B6D8A /* libRCTSettings-tvOS.a */, 346 | ); 347 | name = Products; 348 | sourceTree = ""; 349 | }; 350 | 139FDEE71B06529A00C62182 /* Products */ = { 351 | isa = PBXGroup; 352 | children = ( 353 | 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */, 354 | 3DAD3E991DF850E9000B6D8A /* libRCTWebSocket-tvOS.a */, 355 | ); 356 | name = Products; 357 | sourceTree = ""; 358 | }; 359 | 13B07FAE1A68108700A75B9A /* Hello */ = { 360 | isa = PBXGroup; 361 | children = ( 362 | F2B0111C1E4216D000EC9CCA /* i18n */, 363 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */, 364 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */, 365 | 13B07FB01A68108700A75B9A /* AppDelegate.m */, 366 | 13B07FB51A68108700A75B9A /* Images.xcassets */, 367 | 13B07FB61A68108700A75B9A /* Info.plist */, 368 | 13B07FB11A68108700A75B9A /* LaunchScreen.xib */, 369 | 13B07FB71A68108700A75B9A /* main.m */, 370 | ); 371 | name = Hello; 372 | sourceTree = ""; 373 | }; 374 | 146834001AC3E56700842450 /* Products */ = { 375 | isa = PBXGroup; 376 | children = ( 377 | 146834041AC3E56700842450 /* libReact.a */, 378 | 3DAD3EA31DF850E9000B6D8A /* libReact.a */, 379 | 3DAD3EA51DF850E9000B6D8A /* libyoga.a */, 380 | 3DAD3EA71DF850E9000B6D8A /* libyoga.a */, 381 | 3DAD3EA91DF850E9000B6D8A /* libcxxreact.a */, 382 | 3DAD3EAB1DF850E9000B6D8A /* libcxxreact.a */, 383 | 3DAD3EAD1DF850E9000B6D8A /* libjschelpers.a */, 384 | 3DAD3EAF1DF850E9000B6D8A /* libjschelpers.a */, 385 | ); 386 | name = Products; 387 | sourceTree = ""; 388 | }; 389 | 5E91572E1DD0AC6500FF2AA8 /* Products */ = { 390 | isa = PBXGroup; 391 | children = ( 392 | 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */, 393 | 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation-tvOS.a */, 394 | ); 395 | name = Products; 396 | sourceTree = ""; 397 | }; 398 | 78C398B11ACF4ADC00677621 /* Products */ = { 399 | isa = PBXGroup; 400 | children = ( 401 | 78C398B91ACF4ADC00677621 /* libRCTLinking.a */, 402 | 3DAD3E881DF850E9000B6D8A /* libRCTLinking-tvOS.a */, 403 | ); 404 | name = Products; 405 | sourceTree = ""; 406 | }; 407 | 832341AE1AAA6A7D00B99B32 /* Libraries */ = { 408 | isa = PBXGroup; 409 | children = ( 410 | 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */, 411 | 146833FF1AC3E56700842450 /* React.xcodeproj */, 412 | 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */, 413 | 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */, 414 | 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */, 415 | 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */, 416 | 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */, 417 | 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */, 418 | 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */, 419 | 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */, 420 | 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */, 421 | A1BD061A101C4E7D9A173CD5 /* RNIntl.xcodeproj */, 422 | ); 423 | name = Libraries; 424 | sourceTree = ""; 425 | }; 426 | 832341B11AAA6A8300B99B32 /* Products */ = { 427 | isa = PBXGroup; 428 | children = ( 429 | 832341B51AAA6A8300B99B32 /* libRCTText.a */, 430 | 3DAD3E941DF850E9000B6D8A /* libRCTText-tvOS.a */, 431 | ); 432 | name = Products; 433 | sourceTree = ""; 434 | }; 435 | 83CBB9F61A601CBA00E9B192 = { 436 | isa = PBXGroup; 437 | children = ( 438 | 13B07FAE1A68108700A75B9A /* Hello */, 439 | 832341AE1AAA6A7D00B99B32 /* Libraries */, 440 | 00E356EF1AD99517003FC87E /* HelloTests */, 441 | 83CBBA001A601CBA00E9B192 /* Products */, 442 | ); 443 | indentWidth = 2; 444 | sourceTree = ""; 445 | tabWidth = 2; 446 | }; 447 | 83CBBA001A601CBA00E9B192 /* Products */ = { 448 | isa = PBXGroup; 449 | children = ( 450 | 13B07F961A680F5B00A75B9A /* Hello.app */, 451 | 00E356EE1AD99517003FC87E /* HelloTests.xctest */, 452 | ); 453 | name = Products; 454 | sourceTree = ""; 455 | }; 456 | F2B010FE1E42111300EC9CCA /* Products */ = { 457 | isa = PBXGroup; 458 | children = ( 459 | F2B0111B1E42111400EC9CCA /* libRNIntl.a */, 460 | ); 461 | name = Products; 462 | sourceTree = ""; 463 | }; 464 | /* End PBXGroup section */ 465 | 466 | /* Begin PBXNativeTarget section */ 467 | 00E356ED1AD99517003FC87E /* HelloTests */ = { 468 | isa = PBXNativeTarget; 469 | buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "HelloTests" */; 470 | buildPhases = ( 471 | 00E356EA1AD99517003FC87E /* Sources */, 472 | 00E356EB1AD99517003FC87E /* Frameworks */, 473 | 00E356EC1AD99517003FC87E /* Resources */, 474 | ); 475 | buildRules = ( 476 | ); 477 | dependencies = ( 478 | 00E356F51AD99517003FC87E /* PBXTargetDependency */, 479 | ); 480 | name = HelloTests; 481 | productName = HelloTests; 482 | productReference = 00E356EE1AD99517003FC87E /* HelloTests.xctest */; 483 | productType = "com.apple.product-type.bundle.unit-test"; 484 | }; 485 | 13B07F861A680F5B00A75B9A /* Hello */ = { 486 | isa = PBXNativeTarget; 487 | buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "Hello" */; 488 | buildPhases = ( 489 | 13B07F871A680F5B00A75B9A /* Sources */, 490 | 13B07F8C1A680F5B00A75B9A /* Frameworks */, 491 | 13B07F8E1A680F5B00A75B9A /* Resources */, 492 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, 493 | ); 494 | buildRules = ( 495 | ); 496 | dependencies = ( 497 | ); 498 | name = Hello; 499 | productName = "Hello World"; 500 | productReference = 13B07F961A680F5B00A75B9A /* Hello.app */; 501 | productType = "com.apple.product-type.application"; 502 | }; 503 | /* End PBXNativeTarget section */ 504 | 505 | /* Begin PBXProject section */ 506 | 83CBB9F71A601CBA00E9B192 /* Project object */ = { 507 | isa = PBXProject; 508 | attributes = { 509 | LastUpgradeCheck = 610; 510 | ORGANIZATIONNAME = Facebook; 511 | TargetAttributes = { 512 | 00E356ED1AD99517003FC87E = { 513 | CreatedOnToolsVersion = 6.2; 514 | TestTargetID = 13B07F861A680F5B00A75B9A; 515 | }; 516 | }; 517 | }; 518 | buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "Hello" */; 519 | compatibilityVersion = "Xcode 3.2"; 520 | developmentRegion = English; 521 | hasScannedForEncodings = 0; 522 | knownRegions = ( 523 | en, 524 | Base, 525 | ); 526 | mainGroup = 83CBB9F61A601CBA00E9B192; 527 | productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; 528 | projectDirPath = ""; 529 | projectReferences = ( 530 | { 531 | ProductGroup = 00C302A81ABCB8CE00DB3ED1 /* Products */; 532 | ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; 533 | }, 534 | { 535 | ProductGroup = 5E91572E1DD0AC6500FF2AA8 /* Products */; 536 | ProjectRef = 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */; 537 | }, 538 | { 539 | ProductGroup = 00C302B61ABCB90400DB3ED1 /* Products */; 540 | ProjectRef = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; 541 | }, 542 | { 543 | ProductGroup = 00C302BC1ABCB91800DB3ED1 /* Products */; 544 | ProjectRef = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; 545 | }, 546 | { 547 | ProductGroup = 78C398B11ACF4ADC00677621 /* Products */; 548 | ProjectRef = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; 549 | }, 550 | { 551 | ProductGroup = 00C302D41ABCB9D200DB3ED1 /* Products */; 552 | ProjectRef = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; 553 | }, 554 | { 555 | ProductGroup = 139105B71AF99BAD00B5F7CC /* Products */; 556 | ProjectRef = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; 557 | }, 558 | { 559 | ProductGroup = 832341B11AAA6A8300B99B32 /* Products */; 560 | ProjectRef = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; 561 | }, 562 | { 563 | ProductGroup = 00C302E01ABCB9EE00DB3ED1 /* Products */; 564 | ProjectRef = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */; 565 | }, 566 | { 567 | ProductGroup = 139FDEE71B06529A00C62182 /* Products */; 568 | ProjectRef = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; 569 | }, 570 | { 571 | ProductGroup = 146834001AC3E56700842450 /* Products */; 572 | ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */; 573 | }, 574 | { 575 | ProductGroup = F2B010FE1E42111300EC9CCA /* Products */; 576 | ProjectRef = A1BD061A101C4E7D9A173CD5 /* RNIntl.xcodeproj */; 577 | }, 578 | ); 579 | projectRoot = ""; 580 | targets = ( 581 | 13B07F861A680F5B00A75B9A /* Hello */, 582 | 00E356ED1AD99517003FC87E /* HelloTests */, 583 | ); 584 | }; 585 | /* End PBXProject section */ 586 | 587 | /* Begin PBXReferenceProxy section */ 588 | 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */ = { 589 | isa = PBXReferenceProxy; 590 | fileType = archive.ar; 591 | path = libRCTActionSheet.a; 592 | remoteRef = 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */; 593 | sourceTree = BUILT_PRODUCTS_DIR; 594 | }; 595 | 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */ = { 596 | isa = PBXReferenceProxy; 597 | fileType = archive.ar; 598 | path = libRCTGeolocation.a; 599 | remoteRef = 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */; 600 | sourceTree = BUILT_PRODUCTS_DIR; 601 | }; 602 | 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */ = { 603 | isa = PBXReferenceProxy; 604 | fileType = archive.ar; 605 | path = libRCTImage.a; 606 | remoteRef = 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */; 607 | sourceTree = BUILT_PRODUCTS_DIR; 608 | }; 609 | 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */ = { 610 | isa = PBXReferenceProxy; 611 | fileType = archive.ar; 612 | path = libRCTNetwork.a; 613 | remoteRef = 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */; 614 | sourceTree = BUILT_PRODUCTS_DIR; 615 | }; 616 | 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */ = { 617 | isa = PBXReferenceProxy; 618 | fileType = archive.ar; 619 | path = libRCTVibration.a; 620 | remoteRef = 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */; 621 | sourceTree = BUILT_PRODUCTS_DIR; 622 | }; 623 | 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */ = { 624 | isa = PBXReferenceProxy; 625 | fileType = archive.ar; 626 | path = libRCTSettings.a; 627 | remoteRef = 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */; 628 | sourceTree = BUILT_PRODUCTS_DIR; 629 | }; 630 | 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */ = { 631 | isa = PBXReferenceProxy; 632 | fileType = archive.ar; 633 | path = libRCTWebSocket.a; 634 | remoteRef = 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */; 635 | sourceTree = BUILT_PRODUCTS_DIR; 636 | }; 637 | 146834041AC3E56700842450 /* libReact.a */ = { 638 | isa = PBXReferenceProxy; 639 | fileType = archive.ar; 640 | path = libReact.a; 641 | remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */; 642 | sourceTree = BUILT_PRODUCTS_DIR; 643 | }; 644 | 3DAD3E841DF850E9000B6D8A /* libRCTImage-tvOS.a */ = { 645 | isa = PBXReferenceProxy; 646 | fileType = archive.ar; 647 | path = "libRCTImage-tvOS.a"; 648 | remoteRef = 3DAD3E831DF850E9000B6D8A /* PBXContainerItemProxy */; 649 | sourceTree = BUILT_PRODUCTS_DIR; 650 | }; 651 | 3DAD3E881DF850E9000B6D8A /* libRCTLinking-tvOS.a */ = { 652 | isa = PBXReferenceProxy; 653 | fileType = archive.ar; 654 | path = "libRCTLinking-tvOS.a"; 655 | remoteRef = 3DAD3E871DF850E9000B6D8A /* PBXContainerItemProxy */; 656 | sourceTree = BUILT_PRODUCTS_DIR; 657 | }; 658 | 3DAD3E8C1DF850E9000B6D8A /* libRCTNetwork-tvOS.a */ = { 659 | isa = PBXReferenceProxy; 660 | fileType = archive.ar; 661 | path = "libRCTNetwork-tvOS.a"; 662 | remoteRef = 3DAD3E8B1DF850E9000B6D8A /* PBXContainerItemProxy */; 663 | sourceTree = BUILT_PRODUCTS_DIR; 664 | }; 665 | 3DAD3E901DF850E9000B6D8A /* libRCTSettings-tvOS.a */ = { 666 | isa = PBXReferenceProxy; 667 | fileType = archive.ar; 668 | path = "libRCTSettings-tvOS.a"; 669 | remoteRef = 3DAD3E8F1DF850E9000B6D8A /* PBXContainerItemProxy */; 670 | sourceTree = BUILT_PRODUCTS_DIR; 671 | }; 672 | 3DAD3E941DF850E9000B6D8A /* libRCTText-tvOS.a */ = { 673 | isa = PBXReferenceProxy; 674 | fileType = archive.ar; 675 | path = "libRCTText-tvOS.a"; 676 | remoteRef = 3DAD3E931DF850E9000B6D8A /* PBXContainerItemProxy */; 677 | sourceTree = BUILT_PRODUCTS_DIR; 678 | }; 679 | 3DAD3E991DF850E9000B6D8A /* libRCTWebSocket-tvOS.a */ = { 680 | isa = PBXReferenceProxy; 681 | fileType = archive.ar; 682 | path = "libRCTWebSocket-tvOS.a"; 683 | remoteRef = 3DAD3E981DF850E9000B6D8A /* PBXContainerItemProxy */; 684 | sourceTree = BUILT_PRODUCTS_DIR; 685 | }; 686 | 3DAD3EA31DF850E9000B6D8A /* libReact.a */ = { 687 | isa = PBXReferenceProxy; 688 | fileType = archive.ar; 689 | path = libReact.a; 690 | remoteRef = 3DAD3EA21DF850E9000B6D8A /* PBXContainerItemProxy */; 691 | sourceTree = BUILT_PRODUCTS_DIR; 692 | }; 693 | 3DAD3EA51DF850E9000B6D8A /* libyoga.a */ = { 694 | isa = PBXReferenceProxy; 695 | fileType = archive.ar; 696 | path = libyoga.a; 697 | remoteRef = 3DAD3EA41DF850E9000B6D8A /* PBXContainerItemProxy */; 698 | sourceTree = BUILT_PRODUCTS_DIR; 699 | }; 700 | 3DAD3EA71DF850E9000B6D8A /* libyoga.a */ = { 701 | isa = PBXReferenceProxy; 702 | fileType = archive.ar; 703 | path = libyoga.a; 704 | remoteRef = 3DAD3EA61DF850E9000B6D8A /* PBXContainerItemProxy */; 705 | sourceTree = BUILT_PRODUCTS_DIR; 706 | }; 707 | 3DAD3EA91DF850E9000B6D8A /* libcxxreact.a */ = { 708 | isa = PBXReferenceProxy; 709 | fileType = archive.ar; 710 | path = libcxxreact.a; 711 | remoteRef = 3DAD3EA81DF850E9000B6D8A /* PBXContainerItemProxy */; 712 | sourceTree = BUILT_PRODUCTS_DIR; 713 | }; 714 | 3DAD3EAB1DF850E9000B6D8A /* libcxxreact.a */ = { 715 | isa = PBXReferenceProxy; 716 | fileType = archive.ar; 717 | path = libcxxreact.a; 718 | remoteRef = 3DAD3EAA1DF850E9000B6D8A /* PBXContainerItemProxy */; 719 | sourceTree = BUILT_PRODUCTS_DIR; 720 | }; 721 | 3DAD3EAD1DF850E9000B6D8A /* libjschelpers.a */ = { 722 | isa = PBXReferenceProxy; 723 | fileType = archive.ar; 724 | path = libjschelpers.a; 725 | remoteRef = 3DAD3EAC1DF850E9000B6D8A /* PBXContainerItemProxy */; 726 | sourceTree = BUILT_PRODUCTS_DIR; 727 | }; 728 | 3DAD3EAF1DF850E9000B6D8A /* libjschelpers.a */ = { 729 | isa = PBXReferenceProxy; 730 | fileType = archive.ar; 731 | path = libjschelpers.a; 732 | remoteRef = 3DAD3EAE1DF850E9000B6D8A /* PBXContainerItemProxy */; 733 | sourceTree = BUILT_PRODUCTS_DIR; 734 | }; 735 | 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */ = { 736 | isa = PBXReferenceProxy; 737 | fileType = archive.ar; 738 | path = libRCTAnimation.a; 739 | remoteRef = 5E9157321DD0AC6500FF2AA8 /* PBXContainerItemProxy */; 740 | sourceTree = BUILT_PRODUCTS_DIR; 741 | }; 742 | 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation-tvOS.a */ = { 743 | isa = PBXReferenceProxy; 744 | fileType = archive.ar; 745 | path = "libRCTAnimation-tvOS.a"; 746 | remoteRef = 5E9157341DD0AC6500FF2AA8 /* PBXContainerItemProxy */; 747 | sourceTree = BUILT_PRODUCTS_DIR; 748 | }; 749 | 78C398B91ACF4ADC00677621 /* libRCTLinking.a */ = { 750 | isa = PBXReferenceProxy; 751 | fileType = archive.ar; 752 | path = libRCTLinking.a; 753 | remoteRef = 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */; 754 | sourceTree = BUILT_PRODUCTS_DIR; 755 | }; 756 | 832341B51AAA6A8300B99B32 /* libRCTText.a */ = { 757 | isa = PBXReferenceProxy; 758 | fileType = archive.ar; 759 | path = libRCTText.a; 760 | remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */; 761 | sourceTree = BUILT_PRODUCTS_DIR; 762 | }; 763 | F2B0111B1E42111400EC9CCA /* libRNIntl.a */ = { 764 | isa = PBXReferenceProxy; 765 | fileType = archive.ar; 766 | path = libRNIntl.a; 767 | remoteRef = F2B0111A1E42111400EC9CCA /* PBXContainerItemProxy */; 768 | sourceTree = BUILT_PRODUCTS_DIR; 769 | }; 770 | /* End PBXReferenceProxy section */ 771 | 772 | /* Begin PBXResourcesBuildPhase section */ 773 | 00E356EC1AD99517003FC87E /* Resources */ = { 774 | isa = PBXResourcesBuildPhase; 775 | buildActionMask = 2147483647; 776 | files = ( 777 | ); 778 | runOnlyForDeploymentPostprocessing = 0; 779 | }; 780 | 13B07F8E1A680F5B00A75B9A /* Resources */ = { 781 | isa = PBXResourcesBuildPhase; 782 | buildActionMask = 2147483647; 783 | files = ( 784 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, 785 | 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */, 786 | F2B0111D1E4216D000EC9CCA /* i18n in Resources */, 787 | ); 788 | runOnlyForDeploymentPostprocessing = 0; 789 | }; 790 | /* End PBXResourcesBuildPhase section */ 791 | 792 | /* Begin PBXShellScriptBuildPhase section */ 793 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = { 794 | isa = PBXShellScriptBuildPhase; 795 | buildActionMask = 2147483647; 796 | files = ( 797 | ); 798 | inputPaths = ( 799 | ); 800 | name = "Bundle React Native code and images"; 801 | outputPaths = ( 802 | ); 803 | runOnlyForDeploymentPostprocessing = 0; 804 | shellPath = /bin/sh; 805 | shellScript = "export NODE_BINARY=node\n../node_modules/react-native/packager/react-native-xcode.sh"; 806 | }; 807 | /* End PBXShellScriptBuildPhase section */ 808 | 809 | /* Begin PBXSourcesBuildPhase section */ 810 | 00E356EA1AD99517003FC87E /* Sources */ = { 811 | isa = PBXSourcesBuildPhase; 812 | buildActionMask = 2147483647; 813 | files = ( 814 | 00E356F31AD99517003FC87E /* HelloTests.m in Sources */, 815 | ); 816 | runOnlyForDeploymentPostprocessing = 0; 817 | }; 818 | 13B07F871A680F5B00A75B9A /* Sources */ = { 819 | isa = PBXSourcesBuildPhase; 820 | buildActionMask = 2147483647; 821 | files = ( 822 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */, 823 | 13B07FC11A68108700A75B9A /* main.m in Sources */, 824 | ); 825 | runOnlyForDeploymentPostprocessing = 0; 826 | }; 827 | /* End PBXSourcesBuildPhase section */ 828 | 829 | /* Begin PBXTargetDependency section */ 830 | 00E356F51AD99517003FC87E /* PBXTargetDependency */ = { 831 | isa = PBXTargetDependency; 832 | target = 13B07F861A680F5B00A75B9A /* Hello */; 833 | targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */; 834 | }; 835 | /* End PBXTargetDependency section */ 836 | 837 | /* Begin PBXVariantGroup section */ 838 | 13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = { 839 | isa = PBXVariantGroup; 840 | children = ( 841 | 13B07FB21A68108700A75B9A /* Base */, 842 | ); 843 | name = LaunchScreen.xib; 844 | path = Hello; 845 | sourceTree = ""; 846 | }; 847 | /* End PBXVariantGroup section */ 848 | 849 | /* Begin XCBuildConfiguration section */ 850 | 00E356F61AD99517003FC87E /* Debug */ = { 851 | isa = XCBuildConfiguration; 852 | buildSettings = { 853 | BUNDLE_LOADER = "$(TEST_HOST)"; 854 | GCC_PREPROCESSOR_DEFINITIONS = ( 855 | "DEBUG=1", 856 | "$(inherited)", 857 | ); 858 | INFOPLIST_FILE = HelloTests/Info.plist; 859 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 860 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 861 | LIBRARY_SEARCH_PATHS = ( 862 | "$(inherited)", 863 | "\"$(SRCROOT)/$(TARGET_NAME)\"", 864 | ); 865 | PRODUCT_NAME = "$(TARGET_NAME)"; 866 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Hello.app/Hello"; 867 | }; 868 | name = Debug; 869 | }; 870 | 00E356F71AD99517003FC87E /* Release */ = { 871 | isa = XCBuildConfiguration; 872 | buildSettings = { 873 | BUNDLE_LOADER = "$(TEST_HOST)"; 874 | COPY_PHASE_STRIP = NO; 875 | INFOPLIST_FILE = HelloTests/Info.plist; 876 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 877 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 878 | LIBRARY_SEARCH_PATHS = ( 879 | "$(inherited)", 880 | "\"$(SRCROOT)/$(TARGET_NAME)\"", 881 | ); 882 | PRODUCT_NAME = "$(TARGET_NAME)"; 883 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Hello.app/Hello"; 884 | }; 885 | name = Release; 886 | }; 887 | 13B07F941A680F5B00A75B9A /* Debug */ = { 888 | isa = XCBuildConfiguration; 889 | buildSettings = { 890 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 891 | CURRENT_PROJECT_VERSION = 1; 892 | DEAD_CODE_STRIPPING = NO; 893 | INFOPLIST_FILE = Hello/Info.plist; 894 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 895 | OTHER_LDFLAGS = ( 896 | "$(inherited)", 897 | "-ObjC", 898 | "-lc++", 899 | ); 900 | PRODUCT_NAME = Hello; 901 | VERSIONING_SYSTEM = "apple-generic"; 902 | }; 903 | name = Debug; 904 | }; 905 | 13B07F951A680F5B00A75B9A /* Release */ = { 906 | isa = XCBuildConfiguration; 907 | buildSettings = { 908 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 909 | CURRENT_PROJECT_VERSION = 1; 910 | INFOPLIST_FILE = Hello/Info.plist; 911 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 912 | OTHER_LDFLAGS = ( 913 | "$(inherited)", 914 | "-ObjC", 915 | "-lc++", 916 | ); 917 | PRODUCT_NAME = Hello; 918 | VERSIONING_SYSTEM = "apple-generic"; 919 | }; 920 | name = Release; 921 | }; 922 | 83CBBA201A601CBA00E9B192 /* Debug */ = { 923 | isa = XCBuildConfiguration; 924 | buildSettings = { 925 | ALWAYS_SEARCH_USER_PATHS = NO; 926 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 927 | CLANG_CXX_LIBRARY = "libc++"; 928 | CLANG_ENABLE_MODULES = YES; 929 | CLANG_ENABLE_OBJC_ARC = YES; 930 | CLANG_WARN_BOOL_CONVERSION = YES; 931 | CLANG_WARN_CONSTANT_CONVERSION = YES; 932 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 933 | CLANG_WARN_EMPTY_BODY = YES; 934 | CLANG_WARN_ENUM_CONVERSION = YES; 935 | CLANG_WARN_INT_CONVERSION = YES; 936 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 937 | CLANG_WARN_UNREACHABLE_CODE = YES; 938 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 939 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 940 | COPY_PHASE_STRIP = NO; 941 | ENABLE_STRICT_OBJC_MSGSEND = YES; 942 | GCC_C_LANGUAGE_STANDARD = gnu99; 943 | GCC_DYNAMIC_NO_PIC = NO; 944 | GCC_OPTIMIZATION_LEVEL = 0; 945 | GCC_PREPROCESSOR_DEFINITIONS = ( 946 | "DEBUG=1", 947 | "$(inherited)", 948 | ); 949 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 950 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 951 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 952 | GCC_WARN_UNDECLARED_SELECTOR = YES; 953 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 954 | GCC_WARN_UNUSED_FUNCTION = YES; 955 | GCC_WARN_UNUSED_VARIABLE = YES; 956 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 957 | MTL_ENABLE_DEBUG_INFO = YES; 958 | ONLY_ACTIVE_ARCH = YES; 959 | SDKROOT = iphoneos; 960 | }; 961 | name = Debug; 962 | }; 963 | 83CBBA211A601CBA00E9B192 /* Release */ = { 964 | isa = XCBuildConfiguration; 965 | buildSettings = { 966 | ALWAYS_SEARCH_USER_PATHS = NO; 967 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 968 | CLANG_CXX_LIBRARY = "libc++"; 969 | CLANG_ENABLE_MODULES = YES; 970 | CLANG_ENABLE_OBJC_ARC = YES; 971 | CLANG_WARN_BOOL_CONVERSION = YES; 972 | CLANG_WARN_CONSTANT_CONVERSION = YES; 973 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 974 | CLANG_WARN_EMPTY_BODY = YES; 975 | CLANG_WARN_ENUM_CONVERSION = YES; 976 | CLANG_WARN_INT_CONVERSION = YES; 977 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 978 | CLANG_WARN_UNREACHABLE_CODE = YES; 979 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 980 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 981 | COPY_PHASE_STRIP = YES; 982 | ENABLE_NS_ASSERTIONS = NO; 983 | ENABLE_STRICT_OBJC_MSGSEND = YES; 984 | GCC_C_LANGUAGE_STANDARD = gnu99; 985 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 986 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 987 | GCC_WARN_UNDECLARED_SELECTOR = YES; 988 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 989 | GCC_WARN_UNUSED_FUNCTION = YES; 990 | GCC_WARN_UNUSED_VARIABLE = YES; 991 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 992 | MTL_ENABLE_DEBUG_INFO = NO; 993 | SDKROOT = iphoneos; 994 | VALIDATE_PRODUCT = YES; 995 | }; 996 | name = Release; 997 | }; 998 | /* End XCBuildConfiguration section */ 999 | 1000 | /* Begin XCConfigurationList section */ 1001 | 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "HelloTests" */ = { 1002 | isa = XCConfigurationList; 1003 | buildConfigurations = ( 1004 | 00E356F61AD99517003FC87E /* Debug */, 1005 | 00E356F71AD99517003FC87E /* Release */, 1006 | ); 1007 | defaultConfigurationIsVisible = 0; 1008 | defaultConfigurationName = Release; 1009 | }; 1010 | 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "Hello" */ = { 1011 | isa = XCConfigurationList; 1012 | buildConfigurations = ( 1013 | 13B07F941A680F5B00A75B9A /* Debug */, 1014 | 13B07F951A680F5B00A75B9A /* Release */, 1015 | ); 1016 | defaultConfigurationIsVisible = 0; 1017 | defaultConfigurationName = Release; 1018 | }; 1019 | 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "Hello" */ = { 1020 | isa = XCConfigurationList; 1021 | buildConfigurations = ( 1022 | 83CBBA201A601CBA00E9B192 /* Debug */, 1023 | 83CBBA211A601CBA00E9B192 /* Release */, 1024 | ); 1025 | defaultConfigurationIsVisible = 0; 1026 | defaultConfigurationName = Release; 1027 | }; 1028 | /* End XCConfigurationList section */ 1029 | }; 1030 | rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; 1031 | } 1032 | -------------------------------------------------------------------------------- /Examples/Hello/ios/Hello.xcodeproj/xcshareddata/xcschemes/Hello.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 43 | 49 | 50 | 51 | 52 | 53 | 58 | 59 | 61 | 67 | 68 | 69 | 70 | 71 | 77 | 78 | 79 | 80 | 81 | 82 | 92 | 94 | 100 | 101 | 102 | 103 | 104 | 105 | 111 | 113 | 119 | 120 | 121 | 122 | 124 | 125 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /Examples/Hello/ios/Hello/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @interface AppDelegate : UIResponder 13 | 14 | @property (nonatomic, strong) UIWindow *window; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Examples/Hello/ios/Hello/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "AppDelegate.h" 11 | 12 | #import 13 | #import 14 | 15 | @implementation AppDelegate 16 | 17 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 18 | { 19 | NSURL *jsCodeLocation; 20 | 21 | jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil]; 22 | 23 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 24 | moduleName:@"Hello" 25 | initialProperties:nil 26 | launchOptions:launchOptions]; 27 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; 28 | 29 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 30 | UIViewController *rootViewController = [UIViewController new]; 31 | rootViewController.view = rootView; 32 | self.window.rootViewController = rootViewController; 33 | [self.window makeKeyAndVisible]; 34 | return YES; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /Examples/Hello/ios/Hello/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /Examples/Hello/ios/Hello/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 | } -------------------------------------------------------------------------------- /Examples/Hello/ios/Hello/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UIViewControllerBasedStatusBarAppearance 38 | 39 | NSLocationWhenInUseUsageDescription 40 | 41 | NSAppTransportSecurity 42 | 43 | 44 | NSExceptionDomains 45 | 46 | localhost 47 | 48 | NSExceptionAllowsInsecureHTTPLoads 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /Examples/Hello/ios/Hello/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "AppDelegate.h" 13 | 14 | int main(int argc, char * argv[]) { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Examples/Hello/ios/HelloTests/HelloTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | #import 12 | 13 | #import 14 | #import 15 | 16 | #define TIMEOUT_SECONDS 600 17 | #define TEXT_TO_LOOK_FOR @"Welcome to React Native!" 18 | 19 | @interface HelloTests : XCTestCase 20 | 21 | @end 22 | 23 | @implementation HelloTests 24 | 25 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 26 | { 27 | if (test(view)) { 28 | return YES; 29 | } 30 | for (UIView *subview in [view subviews]) { 31 | if ([self findSubviewInView:subview matching:test]) { 32 | return YES; 33 | } 34 | } 35 | return NO; 36 | } 37 | 38 | - (void)testRendersWelcomeScreen 39 | { 40 | UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController]; 41 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 42 | BOOL foundElement = NO; 43 | 44 | __block NSString *redboxError = nil; 45 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 46 | if (level >= RCTLogLevelError) { 47 | redboxError = message; 48 | } 49 | }); 50 | 51 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 52 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 53 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 54 | 55 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { 56 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 57 | return YES; 58 | } 59 | return NO; 60 | }]; 61 | } 62 | 63 | RCTSetLogFunction(RCTDefaultLogFunction); 64 | 65 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 66 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 67 | } 68 | 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /Examples/Hello/ios/HelloTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 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 | -------------------------------------------------------------------------------- /Examples/Hello/ios/i18n/fr_FR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taggon/react-native-intl/445fe5e2f330a11969f4c7ffac80faa1d93535bb/Examples/Hello/ios/i18n/fr_FR.mo -------------------------------------------------------------------------------- /Examples/Hello/ios/i18n/fr_FR.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: Hello\n" 4 | "POT-Creation-Date: 2015-12-22 17:43+0900\n" 5 | "PO-Revision-Date: 2015-12-22 17:50+0900\n" 6 | "Language-Team: \n" 7 | "MIME-Version: 1.0\n" 8 | "Content-Type: text/plain; charset=UTF-8\n" 9 | "Content-Transfer-Encoding: 8bit\n" 10 | "X-Generator: Poedit 1.8.6\n" 11 | "X-Poedit-Basepath: .\n" 12 | "Plural-Forms: nplurals=2; plural=(n > 1);\n" 13 | "X-Poedit-SourceCharset: UTF-8\n" 14 | "Last-Translator: \n" 15 | "Language: fr_FR\n" 16 | 17 | msgid "Hello, it's me" 18 | msgstr "Bonjour, il est moi" 19 | 20 | msgid "Click to change your language" 21 | msgstr "Cliquez pour changer votre langue" 22 | -------------------------------------------------------------------------------- /Examples/Hello/ios/i18n/ko_KR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taggon/react-native-intl/445fe5e2f330a11969f4c7ffac80faa1d93535bb/Examples/Hello/ios/i18n/ko_KR.mo -------------------------------------------------------------------------------- /Examples/Hello/ios/i18n/ko_KR.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: Hello\n" 4 | "POT-Creation-Date: 2015-12-22 17:43+0900\n" 5 | "PO-Revision-Date: 2015-12-22 17:46+0900\n" 6 | "Last-Translator: \n" 7 | "Language-Team: \n" 8 | "MIME-Version: 1.0\n" 9 | "Content-Type: text/plain; charset=UTF-8\n" 10 | "Content-Transfer-Encoding: 8bit\n" 11 | "X-Generator: Poedit 1.8.6\n" 12 | "X-Poedit-Basepath: .\n" 13 | "Plural-Forms: nplurals=1; plural=0;\n" 14 | "Language: ko_KR\n" 15 | "X-Poedit-SourceCharset: UTF-8\n" 16 | 17 | msgid "Hello, it's me" 18 | msgstr "안녕하세요, 저예요" 19 | 20 | msgid "Click to change your language" 21 | msgstr "언어를 변경하려면 클릭하세요" 22 | -------------------------------------------------------------------------------- /Examples/Hello/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Hello", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "node node_modules/react-native/local-cli/cli.js start", 7 | "test": "jest" 8 | }, 9 | "dependencies": { 10 | "react": "~15.4.0-rc.4", 11 | "react-native": "0.40.0", 12 | "react-native-intl": "file:../../" 13 | }, 14 | "devDependencies": { 15 | "babel-jest": "18.0.0", 16 | "babel-preset-react-native": "1.9.1", 17 | "jest": "18.1.0", 18 | "react-test-renderer": "~15.4.0-rc.4" 19 | }, 20 | "jest": { 21 | "preset": "react-native" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Taegon Kim 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # react-native-intl 2 | 3 | Native [Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl) implementation and Translation extension. The extension loads translation catalog from [gettext `.mo` files](https://www.gnu.org/software/gettext/manual/html_node/MO-Files.html). Note that PO files are **not supported.** 4 | 5 | ## Features 6 | 7 | * [*Collator*](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Collator) 8 | **Not yet supported** 9 | * [*DateTimeFormat*](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat) 10 | Constructor for objects that format dates and times to match a specified locale. 11 | * [*NumberFormat*](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat) 12 | Constructor for objects that format numbers to match a specified locale. 13 | * *Translation* (not a part of ECMAScript) 14 | Constructor for objects that translate messages into another languages using `.mo` files. 15 | 16 | ## Installation 17 | 18 | ``` 19 | $ npm install react-native-intl --save 20 | $ react-native link 21 | ``` 22 | 23 | ## Translations 24 | 25 | Once you've installed the module, you need to refer a folder, which contains translated `.mo` files, to the project. 26 | 27 | 1. Create `i18n` folder in your React Native project's root. 28 | 2. Put `.mo` translation files into the folder. 29 | 3. The files should be named with locale code. For instance, `fr_FR.mo` will be used for French locale. 30 | 31 | Then, you need to... 32 | 33 | - drag the folder to your project in Xcode and create a folder reference for iOS project. 34 | - create `PROJECT_ROOT/android/app/src/main/assets` (unless it exists) and copy/link the `i18n` folder into the `assets` folder for Android project. 35 | 36 | ## API 37 | 38 | * **DateTimeFormat** objects are similar to JavaScript [Intl.DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat) except `format` method returns a Promise. 39 | * **NumberFormat** objects are similar to JavaScript [Intl.NumberFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat) except `format` method returns a Promise. 40 | * **Translation** objects load translation catalog from local file system and translates the passed message into another language. It also supports plural forms. 41 | * Constructor can take a locale identifier as an argument. 42 | 43 | ``` 44 | new Intl.Translation([locale]) 45 | ``` 46 | 47 | * `getTranslator` returns a Promise that passes the message translator function which takes two arguments, message id and optional plural counter. If the function can't find any proper string, it returns the message id. 48 | 49 | ``` 50 | new Intl.Translation().getTranslator().then( _ => { 51 | console.log( _("Hello, world") ); 52 | }); 53 | 54 | // or you can use await syntax 55 | 56 | const _ = await new Intl.Translation().getTranslator(); 57 | console.log( _("Hello, world") ); 58 | ``` 59 | 60 | ## How to format dates/numbers 61 | 62 | Load `react-native-intl` module in your JavaScript code. 63 | 64 | ``` 65 | const Intl = require('react-native-intl'); 66 | ``` 67 | 68 | Like [the JavaScript objects](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl), create an instance with/without a locale identifier and call its `format` method. Unlike JavaScript, the method returns a Promise because React Native's JS-Native bridge should work asynchronous. 69 | 70 | ``` 71 | var date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0)); 72 | 73 | new Intl.DateTimeFormat('en-US').format(date).then( 74 | str => console.log(str) 75 | ); 76 | ``` 77 | 78 | If you omit the locale identifier, system locale will be used by default. 79 | 80 | ## How to translate messages 81 | 82 | Load `react-native-intl` module in your JavaScript code and create a translation instance with your locale. Get a translator function through the promise `getTranslator()` returned and call it to get translated messages. The translator function works like ngettext, you can pass a plural counter to it. 83 | 84 | ```javascript 85 | const Intl = require('react-native-intl'); 86 | const french = new Intl.Translation('fr-FR'); 87 | 88 | french.getTranslator().then( _ => { 89 | console.log(_("Hello")); // "Allô" 90 | console.log(_("Not translated message")); // "Not translated message" returns the original message 91 | console.log(_("one product")); // "un produit" 92 | console.log(_("one product", "%d product", 1)); // "un produit" 93 | console.log(_("one product", "%d products", 2)); // it returns "%d produits" as the translator works like ngettext. 94 | }); 95 | ``` 96 | 97 | ## Why gettext `.mo` files? 98 | 99 | Although I prefer to use `json` format in most cases, `mo` format is better as it supports plural form and context. I don't want to embed `po` files in my app due to its bigger footprint. 100 | 101 | ## Notes 102 | 103 | Because of the difference of platforms, some features can be limited based on platform. 104 | The following table shows what features supported on each platform. 105 | 106 | `o` = fully, `△` = partially, `x` = not supported 107 | 108 | | Feature | iOS | Android | 109 | |------------------------------|-----|---------| 110 | | Collator | x | x | 111 | | DateTimeFormat | △ | △ | 112 | | - numbering system | x | x | 113 | | - calendar | o | x | 114 | | - resolveOptions() | x | x | 115 | | - options | △ | △ | 116 | | -- locale matcher | x | x | 117 | | -- format matcher | x | x | 118 | | -- hour12 | x | x | 119 | | -- all other options | o | o | 120 | | NumberFormat | △ | △ | 121 | | - numbering system | x | x | 122 | | - resolveOptions() | x | x | 123 | | - options | △ | △ | 124 | | -- locale matcher | x | x | 125 | | -- currencyDisplay | x | x | 126 | | -- minimumSignificantDigits | o | x | 127 | | -- maximumSignificantDigits | o | x | 128 | | -- all other options | o | o | 129 | | Translation | o | o | 130 | 131 | ## Feedback 132 | 133 | This project is in early stage and I'm very new in both native platforms and even the programming languages. 134 | In fact, I've created this module learning them from basic syntax. So, the code may not be fine, unsafe or insecure. 135 | 136 | I will welcome any contributions from you including pull requests, bug reports, suggestions and even documentation. 137 | Don't hesitate to leave your feedback. 138 | -------------------------------------------------------------------------------- /RNIntl.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | F24A65E01C19B9FC007767E9 /* RNIntl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = F24A65DF1C19B9FC007767E9 /* RNIntl.h */; }; 11 | F24A65E21C19B9FC007767E9 /* RNIntl.m in Sources */ = {isa = PBXBuildFile; fileRef = F24A65E11C19B9FC007767E9 /* RNIntl.m */; }; 12 | F274BAFE1C1C200700DA222E /* GettextParser.m in Sources */ = {isa = PBXBuildFile; fileRef = F274BAFD1C1C200700DA222E /* GettextParser.m */; }; 13 | /* End PBXBuildFile section */ 14 | 15 | /* Begin PBXCopyFilesBuildPhase section */ 16 | F24A65DA1C19B9FC007767E9 /* CopyFiles */ = { 17 | isa = PBXCopyFilesBuildPhase; 18 | buildActionMask = 2147483647; 19 | dstPath = "include/$(PRODUCT_NAME)"; 20 | dstSubfolderSpec = 16; 21 | files = ( 22 | F24A65E01C19B9FC007767E9 /* RNIntl.h in CopyFiles */, 23 | ); 24 | runOnlyForDeploymentPostprocessing = 0; 25 | }; 26 | /* End PBXCopyFilesBuildPhase section */ 27 | 28 | /* Begin PBXFileReference section */ 29 | F24A65DC1C19B9FC007767E9 /* libRNIntl.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNIntl.a; sourceTree = BUILT_PRODUCTS_DIR; }; 30 | F24A65DF1C19B9FC007767E9 /* RNIntl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNIntl.h; sourceTree = ""; }; 31 | F24A65E11C19B9FC007767E9 /* RNIntl.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNIntl.m; sourceTree = ""; }; 32 | F274BAFD1C1C200700DA222E /* GettextParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GettextParser.m; sourceTree = ""; }; 33 | F274BAFF1C1C201700DA222E /* GettextParser.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GettextParser.h; sourceTree = ""; }; 34 | /* End PBXFileReference section */ 35 | 36 | /* Begin PBXFrameworksBuildPhase section */ 37 | F24A65D91C19B9FC007767E9 /* Frameworks */ = { 38 | isa = PBXFrameworksBuildPhase; 39 | buildActionMask = 2147483647; 40 | files = ( 41 | ); 42 | runOnlyForDeploymentPostprocessing = 0; 43 | }; 44 | /* End PBXFrameworksBuildPhase section */ 45 | 46 | /* Begin PBXGroup section */ 47 | F24A65D31C19B9FC007767E9 = { 48 | isa = PBXGroup; 49 | children = ( 50 | F24A65DE1C19B9FC007767E9 /* RNIntl */, 51 | F24A65DD1C19B9FC007767E9 /* Products */, 52 | ); 53 | sourceTree = ""; 54 | }; 55 | F24A65DD1C19B9FC007767E9 /* Products */ = { 56 | isa = PBXGroup; 57 | children = ( 58 | F24A65DC1C19B9FC007767E9 /* libRNIntl.a */, 59 | ); 60 | name = Products; 61 | sourceTree = ""; 62 | }; 63 | F24A65DE1C19B9FC007767E9 /* RNIntl */ = { 64 | isa = PBXGroup; 65 | children = ( 66 | F24A65DF1C19B9FC007767E9 /* RNIntl.h */, 67 | F24A65E11C19B9FC007767E9 /* RNIntl.m */, 68 | F274BAFD1C1C200700DA222E /* GettextParser.m */, 69 | F274BAFF1C1C201700DA222E /* GettextParser.h */, 70 | ); 71 | path = RNIntl; 72 | sourceTree = ""; 73 | }; 74 | /* End PBXGroup section */ 75 | 76 | /* Begin PBXNativeTarget section */ 77 | F24A65DB1C19B9FC007767E9 /* RNIntl */ = { 78 | isa = PBXNativeTarget; 79 | buildConfigurationList = F24A65E51C19B9FC007767E9 /* Build configuration list for PBXNativeTarget "RNIntl" */; 80 | buildPhases = ( 81 | F24A65D81C19B9FC007767E9 /* Sources */, 82 | F24A65D91C19B9FC007767E9 /* Frameworks */, 83 | F24A65DA1C19B9FC007767E9 /* CopyFiles */, 84 | ); 85 | buildRules = ( 86 | ); 87 | dependencies = ( 88 | ); 89 | name = RNIntl; 90 | productName = RNIntl; 91 | productReference = F24A65DC1C19B9FC007767E9 /* libRNIntl.a */; 92 | productType = "com.apple.product-type.library.static"; 93 | }; 94 | /* End PBXNativeTarget section */ 95 | 96 | /* Begin PBXProject section */ 97 | F24A65D41C19B9FC007767E9 /* Project object */ = { 98 | isa = PBXProject; 99 | attributes = { 100 | LastUpgradeCheck = 0710; 101 | ORGANIZATIONNAME = "Taegon Kim"; 102 | TargetAttributes = { 103 | F24A65DB1C19B9FC007767E9 = { 104 | CreatedOnToolsVersion = 7.1.1; 105 | }; 106 | }; 107 | }; 108 | buildConfigurationList = F24A65D71C19B9FC007767E9 /* Build configuration list for PBXProject "RNIntl" */; 109 | compatibilityVersion = "Xcode 3.2"; 110 | developmentRegion = English; 111 | hasScannedForEncodings = 0; 112 | knownRegions = ( 113 | en, 114 | ); 115 | mainGroup = F24A65D31C19B9FC007767E9; 116 | productRefGroup = F24A65DD1C19B9FC007767E9 /* Products */; 117 | projectDirPath = ""; 118 | projectRoot = ""; 119 | targets = ( 120 | F24A65DB1C19B9FC007767E9 /* RNIntl */, 121 | ); 122 | }; 123 | /* End PBXProject section */ 124 | 125 | /* Begin PBXSourcesBuildPhase section */ 126 | F24A65D81C19B9FC007767E9 /* Sources */ = { 127 | isa = PBXSourcesBuildPhase; 128 | buildActionMask = 2147483647; 129 | files = ( 130 | F274BAFE1C1C200700DA222E /* GettextParser.m in Sources */, 131 | F24A65E21C19B9FC007767E9 /* RNIntl.m in Sources */, 132 | ); 133 | runOnlyForDeploymentPostprocessing = 0; 134 | }; 135 | /* End PBXSourcesBuildPhase section */ 136 | 137 | /* Begin XCBuildConfiguration section */ 138 | F24A65E31C19B9FC007767E9 /* Debug */ = { 139 | isa = XCBuildConfiguration; 140 | buildSettings = { 141 | ALWAYS_SEARCH_USER_PATHS = NO; 142 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 143 | CLANG_CXX_LIBRARY = "libc++"; 144 | CLANG_ENABLE_MODULES = YES; 145 | CLANG_ENABLE_OBJC_ARC = YES; 146 | CLANG_WARN_BOOL_CONVERSION = YES; 147 | CLANG_WARN_CONSTANT_CONVERSION = YES; 148 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 149 | CLANG_WARN_EMPTY_BODY = YES; 150 | CLANG_WARN_ENUM_CONVERSION = YES; 151 | CLANG_WARN_INT_CONVERSION = YES; 152 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 153 | CLANG_WARN_UNREACHABLE_CODE = YES; 154 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 155 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 156 | COPY_PHASE_STRIP = NO; 157 | DEBUG_INFORMATION_FORMAT = dwarf; 158 | ENABLE_STRICT_OBJC_MSGSEND = YES; 159 | ENABLE_TESTABILITY = YES; 160 | GCC_C_LANGUAGE_STANDARD = gnu99; 161 | GCC_DYNAMIC_NO_PIC = NO; 162 | GCC_NO_COMMON_BLOCKS = YES; 163 | GCC_OPTIMIZATION_LEVEL = 0; 164 | GCC_PREPROCESSOR_DEFINITIONS = ( 165 | "DEBUG=1", 166 | "$(inherited)", 167 | ); 168 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 169 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 170 | GCC_WARN_UNDECLARED_SELECTOR = YES; 171 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 172 | GCC_WARN_UNUSED_FUNCTION = YES; 173 | GCC_WARN_UNUSED_VARIABLE = YES; 174 | IPHONEOS_DEPLOYMENT_TARGET = 9.1; 175 | MTL_ENABLE_DEBUG_INFO = YES; 176 | ONLY_ACTIVE_ARCH = YES; 177 | SDKROOT = iphoneos; 178 | }; 179 | name = Debug; 180 | }; 181 | F24A65E41C19B9FC007767E9 /* Release */ = { 182 | isa = XCBuildConfiguration; 183 | buildSettings = { 184 | ALWAYS_SEARCH_USER_PATHS = NO; 185 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 186 | CLANG_CXX_LIBRARY = "libc++"; 187 | CLANG_ENABLE_MODULES = YES; 188 | CLANG_ENABLE_OBJC_ARC = YES; 189 | CLANG_WARN_BOOL_CONVERSION = YES; 190 | CLANG_WARN_CONSTANT_CONVERSION = YES; 191 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 192 | CLANG_WARN_EMPTY_BODY = YES; 193 | CLANG_WARN_ENUM_CONVERSION = YES; 194 | CLANG_WARN_INT_CONVERSION = YES; 195 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 196 | CLANG_WARN_UNREACHABLE_CODE = YES; 197 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 198 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 199 | COPY_PHASE_STRIP = NO; 200 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 201 | ENABLE_NS_ASSERTIONS = NO; 202 | ENABLE_STRICT_OBJC_MSGSEND = YES; 203 | GCC_C_LANGUAGE_STANDARD = gnu99; 204 | GCC_NO_COMMON_BLOCKS = YES; 205 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 206 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 207 | GCC_WARN_UNDECLARED_SELECTOR = YES; 208 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 209 | GCC_WARN_UNUSED_FUNCTION = YES; 210 | GCC_WARN_UNUSED_VARIABLE = YES; 211 | IPHONEOS_DEPLOYMENT_TARGET = 9.1; 212 | MTL_ENABLE_DEBUG_INFO = NO; 213 | SDKROOT = iphoneos; 214 | VALIDATE_PRODUCT = YES; 215 | }; 216 | name = Release; 217 | }; 218 | F24A65E61C19B9FC007767E9 /* Debug */ = { 219 | isa = XCBuildConfiguration; 220 | buildSettings = { 221 | CLANG_ENABLE_MODULES = YES; 222 | HEADER_SEARCH_PATHS = ( 223 | "$(SRCROOT)/../react-native/React/**", 224 | "$(SRCROOT)/../../React/**", 225 | ); 226 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 227 | OTHER_LDFLAGS = "-ObjC"; 228 | PRODUCT_NAME = "$(TARGET_NAME)"; 229 | SKIP_INSTALL = YES; 230 | SWIFT_OBJC_BRIDGING_HEADER = "RNIntl/RNIntl-Bridging-Header.h"; 231 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 232 | }; 233 | name = Debug; 234 | }; 235 | F24A65E71C19B9FC007767E9 /* Release */ = { 236 | isa = XCBuildConfiguration; 237 | buildSettings = { 238 | CLANG_ENABLE_MODULES = YES; 239 | HEADER_SEARCH_PATHS = ( 240 | "$(SRCROOT)/../react-native/React/**", 241 | "$(SRCROOT)/../../React/**", 242 | ); 243 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 244 | OTHER_LDFLAGS = "-ObjC"; 245 | PRODUCT_NAME = "$(TARGET_NAME)"; 246 | SKIP_INSTALL = YES; 247 | SWIFT_OBJC_BRIDGING_HEADER = "RNIntl/RNIntl-Bridging-Header.h"; 248 | }; 249 | name = Release; 250 | }; 251 | /* End XCBuildConfiguration section */ 252 | 253 | /* Begin XCConfigurationList section */ 254 | F24A65D71C19B9FC007767E9 /* Build configuration list for PBXProject "RNIntl" */ = { 255 | isa = XCConfigurationList; 256 | buildConfigurations = ( 257 | F24A65E31C19B9FC007767E9 /* Debug */, 258 | F24A65E41C19B9FC007767E9 /* Release */, 259 | ); 260 | defaultConfigurationIsVisible = 0; 261 | defaultConfigurationName = Release; 262 | }; 263 | F24A65E51C19B9FC007767E9 /* Build configuration list for PBXNativeTarget "RNIntl" */ = { 264 | isa = XCConfigurationList; 265 | buildConfigurations = ( 266 | F24A65E61C19B9FC007767E9 /* Debug */, 267 | F24A65E71C19B9FC007767E9 /* Release */, 268 | ); 269 | defaultConfigurationIsVisible = 0; 270 | defaultConfigurationName = Release; 271 | }; 272 | /* End XCConfigurationList section */ 273 | }; 274 | rootObject = F24A65D41C19B9FC007767E9 /* Project object */; 275 | } 276 | -------------------------------------------------------------------------------- /RNIntl.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /RNIntl.xcodeproj/project.xcworkspace/xcuserdata/taggon.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taggon/react-native-intl/445fe5e2f330a11969f4c7ffac80faa1d93535bb/RNIntl.xcodeproj/project.xcworkspace/xcuserdata/taggon.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /RNIntl.xcodeproj/project.xcworkspace/xcuserdata/taggon.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildLocationStyle 6 | UseAppPreferences 7 | CustomBuildLocationType 8 | RelativeToDerivedData 9 | DerivedDataLocationStyle 10 | Default 11 | IssueFilterStyle 12 | ShowActiveSchemeOnly 13 | LiveSourceIssuesEnabled 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /RNIntl.xcodeproj/xcuserdata/taggon.xcuserdatad/xcschemes/RNIntl.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /RNIntl.xcodeproj/xcuserdata/taggon.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | RNIntl.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | F24A65DB1C19B9FC007767E9 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /RNIntl/GettextParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // GettextParser.h 3 | // RNIntl 4 | // 5 | // Created by Taegon Kim on 2015. 12. 12.. 6 | // Copyright © 2015 Taegon Kim. All rights reserved. 7 | // 8 | 9 | #ifndef GettextParser_h 10 | #define GettextParser_h 11 | 12 | #import 13 | 14 | @interface GettextParser: NSObject 15 | 16 | @property (nonatomic, retain, nullable) NSError *lastError; 17 | @property (nonatomic, retain, nullable) NSDictionary *catalog; 18 | 19 | - (instancetype)initWithFileAtPath:(nonnull NSString *)filepath; 20 | - (BOOL)loadFileAtPath:(nonnull NSString *)filepath; 21 | 22 | @end 23 | 24 | 25 | #endif /* GettextParser_h */ 26 | -------------------------------------------------------------------------------- /RNIntl/GettextParser.m: -------------------------------------------------------------------------------- 1 | // 2 | // GettextParser.m 3 | // RNIntl 4 | // 5 | // Created by Taegon Kim on 2015. 12. 12.. 6 | // Copyright © 2015 Taegon Kim. All rights reserved. 7 | // 8 | 9 | #import "GettextParser.h" 10 | 11 | #define MAGIC_NUMBER 0x950412de 12 | 13 | typedef struct { 14 | uint32_t magic; 15 | uint32_t revision; 16 | uint32_t stringCount; 17 | uint32_t originalStringOffset; 18 | uint32_t translationStringOffset; 19 | uint32_t hashTableSize; 20 | uint32_t hashTableOffset; 21 | } MoHeader; 22 | 23 | typedef struct { 24 | uint32_t length; 25 | uint32_t offset; 26 | } Position; 27 | 28 | @implementation GettextParser 29 | 30 | @synthesize lastError; 31 | @synthesize catalog; 32 | 33 | - (instancetype)initWithFileAtPath:(nonnull NSString *)filepath { 34 | if (self = [super init]) { 35 | [self loadFileAtPath:filepath]; 36 | } 37 | return self; 38 | } 39 | 40 | - (BOOL)loadFileAtPath:(NSString *)filepath { 41 | MoHeader header = { 0 }; 42 | NSError *err = nil; 43 | NSData *data = [NSData dataWithContentsOfFile:filepath options:NSDataReadingMappedIfSafe error:&err]; 44 | 45 | if (err != nil) { 46 | lastError = err; 47 | return NO; 48 | } 49 | 50 | // get header 51 | [data getBytes:&header length:sizeof(header)]; 52 | 53 | // check magic number 54 | if (header.magic != MAGIC_NUMBER && header.magic != OSSwapInt32(MAGIC_NUMBER)) { 55 | return NO; 56 | } 57 | 58 | NSDictionary *headers = nil; 59 | NSMutableDictionary *messages = [[NSMutableDictionary alloc] init]; 60 | for (uint i = 0; i < header.stringCount; i++) { 61 | Position pos = { 0 }; 62 | uint32_t offset = 0; 63 | 64 | // msgid - original string 65 | offset = header.originalStringOffset + i * sizeof(pos); 66 | [data getBytes:&pos range:NSMakeRange(offset, sizeof(pos))]; 67 | NSArray *idList = [self getStringsFromData:[data subdataWithRange:NSMakeRange(pos.offset, pos.length)]]; 68 | 69 | // msgstr - translation string 70 | offset = header.translationStringOffset + i * sizeof(pos); 71 | [data getBytes:&pos range:NSMakeRange(offset, sizeof(pos))]; 72 | NSArray *translationList = [self getStringsFromData:[data subdataWithRange:NSMakeRange(pos.offset, pos.length)]]; 73 | 74 | for (uint j = 0; j < idList.count; j++) { 75 | if ([[idList objectAtIndex:0] isEqualToString:@""]) { 76 | headers = [self parseHeader:[translationList objectAtIndex:0]]; 77 | } else { 78 | [messages setValue:translationList forKey:[idList objectAtIndex:j]]; 79 | } 80 | } 81 | } 82 | 83 | catalog = @{ @"headers": headers, @"translations": messages }; 84 | 85 | return YES; 86 | } 87 | 88 | - (NSDictionary *)parseHeader:(nonnull NSString *)headerString { 89 | NSArray *_headers = [headerString componentsSeparatedByString:@"\n"]; 90 | NSMutableDictionary *headers = [[NSMutableDictionary alloc] init]; 91 | 92 | for (int i=0; i < _headers.count; i++) { 93 | NSRange range = [_headers[i] rangeOfString:@":"]; 94 | if (range.location == NSNotFound) continue; 95 | 96 | NSString *key = [_headers[i] substringToIndex:range.location]; 97 | NSString *value = [_headers[i] substringFromIndex:range.location+range.length]; 98 | 99 | key = [key stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; 100 | value = [value stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; 101 | 102 | [headers setValue:value forKey:key]; 103 | } 104 | 105 | return headers; 106 | } 107 | 108 | - (NSDictionary *)getCatalog { 109 | return catalog; 110 | } 111 | 112 | - (NSArray *)getStringsFromData:(nonnull NSData *) data{ 113 | NSMutableArray *result = [[NSMutableArray alloc] init]; 114 | NSData *pattern = [[NSData alloc] initWithBytes:(unsigned char[]){0x04} length:1]; 115 | NSRange range = [data rangeOfData:pattern options:0 range:NSMakeRange(0, data.length)]; 116 | NSUInteger from = 0; 117 | 118 | // strip context 119 | if (range.location != NSNotFound) { 120 | data = [data subdataWithRange:NSMakeRange(0, range.location)]; 121 | } 122 | 123 | // null pattern 124 | pattern = [[NSData alloc] initWithBytes:(unsigned char[]){0x00} length:1]; 125 | 126 | do { 127 | range = [data rangeOfData:pattern options:0 range:NSMakeRange(from, data.length - from)]; 128 | if (range.location == NSNotFound) break; 129 | 130 | NSString *str = [[NSString alloc] initWithData:[data subdataWithRange:NSMakeRange(from, range.location - from)] encoding:NSUTF8StringEncoding]; 131 | [result addObject:str]; 132 | 133 | from = range.location + range.length; 134 | } while (TRUE); 135 | 136 | if (result.count == 0 && data.length == 0) { 137 | [result addObject:@""]; 138 | } else { 139 | if (from > 0) { 140 | data = [data subdataWithRange:NSMakeRange(from, data.length - from)]; 141 | } 142 | [result addObject:[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]]; 143 | } 144 | 145 | return result; 146 | } 147 | 148 | @end 149 | -------------------------------------------------------------------------------- /RNIntl/RNIntl.h: -------------------------------------------------------------------------------- 1 | // 2 | // RNIntl.h 3 | // RNIntl 4 | // 5 | // Created by Taegon Kim on 2015. 12. 10.. 6 | // Copyright © 2015 Taegon Kim. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface RNIntl : NSObject 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /RNIntl/RNIntl.m: -------------------------------------------------------------------------------- 1 | // 2 | // RNIntl.m 3 | // RNIntl 4 | // 5 | // Created by Taegon Kim on 2015. 12. 10.. 6 | // Copyright © 2015 Taegon Kim. All rights reserved. 7 | // 8 | 9 | #import "RNIntl.h" 10 | #import "GettextParser.h" 11 | 12 | @implementation RNIntl 13 | 14 | RCT_EXPORT_MODULE() 15 | 16 | RCT_EXPORT_METHOD(formatNumber: (double)number 17 | localeCode: (NSString *)locale 18 | options: (NSDictionary *)options 19 | resolver:(RCTPromiseResolveBlock)resolve 20 | rejecter:(RCTPromiseRejectBlock)reject) 21 | { 22 | // use system locale by default 23 | NSString *localeIndentifier = locale; 24 | if ([localeIndentifier isEqualToString:@""]) { 25 | localeIndentifier = [self getSystemLocale]; 26 | } 27 | localeIndentifier = [localeIndentifier stringByReplacingOccurrencesOfString:@"-" withString:@"_"]; 28 | 29 | NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]; 30 | [formatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:localeIndentifier]]; 31 | 32 | NSNumber *num = [NSNumber numberWithDouble:number]; 33 | 34 | if (options) { 35 | // style 36 | NSString *style = [options valueForKey:@"style"] ? options[@"style"] : @"decimal"; 37 | if ([style isEqualToString:@"currency"]) { 38 | [formatter setNumberStyle: NSNumberFormatterCurrencyStyle]; 39 | } else if ([style isEqualToString:@"percent"]) { 40 | [formatter setNumberStyle: NSNumberFormatterPercentStyle]; 41 | } else { 42 | [formatter setNumberStyle: NSNumberFormatterDecimalStyle]; 43 | } 44 | 45 | // currency 46 | if ([options objectForKey:@"currency"]) { 47 | [formatter setCurrencyCode:options[@"currency"]]; 48 | } 49 | 50 | // TODO: currencyDisplay 51 | 52 | // useGrouping 53 | [formatter setUsesGroupingSeparator: [options objectForKey:@"useGrouping"] ? [options[@"useGrouping"] boolValue] : YES ]; 54 | 55 | // minimumIntegerDigits 56 | [formatter setMinimumIntegerDigits:[options objectForKey:@"mimumIntegerDigits"] ? (int)options[@"minimumIntegerDigits"] : 1]; 57 | 58 | // minimumFractionDigits 59 | if ([options objectForKey:@"minimumFractionDigits"]) { 60 | [formatter setMinimumFractionDigits: (int)options[@"minimumFractionDigits"]]; 61 | } else if (![style isEqualToString:@"currency"]) { 62 | [formatter setMinimumFractionDigits:0]; 63 | } 64 | 65 | // maximumFractionDigits 66 | if ([options objectForKey:@"maximumFractionDigits"]) { 67 | [formatter setMaximumFractionDigits: (int)options[@"maximumFractionDigits"]]; 68 | } 69 | 70 | // minimumSignificantDigits 71 | if ([options objectForKey:@"minimumSignificantDigits"]) { 72 | [formatter setMinimumSignificantDigits: (int)options[@"minimumSignificantDigits"]]; 73 | } 74 | 75 | // maximumSignificantDigits 76 | if ([options objectForKey:@"maximumSignificantDigits"]) { 77 | [formatter setMaximumSignificantDigits: (int)options[@"maximumSignificantDigits"]]; 78 | } 79 | } 80 | 81 | NSString *result = [formatter stringFromNumber:num]; 82 | resolve(result); 83 | } 84 | 85 | RCT_EXPORT_METHOD(formatDate: (NSDate *) date 86 | localeCode: (NSString *)locale 87 | options: (NSDictionary *)options 88 | resolver:(RCTPromiseResolveBlock)resolve 89 | rejecter:(RCTPromiseRejectBlock)reject) 90 | { 91 | // use system locale by default 92 | NSString *localeIndentifier = locale; 93 | if ([localeIndentifier isEqualToString:@""]) { 94 | localeIndentifier = [self getSystemLocale]; 95 | } 96 | localeIndentifier = [localeIndentifier stringByReplacingOccurrencesOfString:@"-" withString:@"_"]; 97 | 98 | NSLocale *currentLocale = [[NSLocale alloc] initWithLocaleIdentifier:localeIndentifier]; 99 | NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; 100 | [formatter setLocale:currentLocale]; 101 | [formatter setDateStyle:NSDateFormatterShortStyle]; 102 | 103 | [formatter setDateFormat:[formatter.dateFormat stringByReplacingOccurrencesOfString:@"yy" withString:@"yyyy"]]; 104 | 105 | if (options) { 106 | NSString *template = options[@"template"]; 107 | 108 | // calendar 109 | if ([options valueForKey:@"calendar"] != nil) { 110 | formatter.calendar = options[@"calendar"]; 111 | } 112 | 113 | // timezone 114 | if ([options valueForKey:@"timeZone"] != nil) { 115 | [formatter setTimeZone:[[NSTimeZone alloc] initWithName:options[@"timeZone"]]]; 116 | } 117 | 118 | // hour12 119 | if ([options objectForKey:@"hour12"]) { 120 | if ((bool)options[@"hour12"]) { 121 | template = [template stringByReplacingOccurrencesOfString:@"H" withString:@"h"]; 122 | } else { 123 | template = [template stringByReplacingOccurrencesOfString:@"h" withString:@"H"]; 124 | } 125 | } 126 | 127 | // template 128 | [formatter setDateFormat:[NSDateFormatter dateFormatFromTemplate:template options:0 locale:currentLocale]]; 129 | } 130 | 131 | NSString *result = [formatter stringFromDate:date]; 132 | resolve(result); 133 | } 134 | 135 | RCT_EXPORT_METHOD(loadCatalog: (nonnull NSString *)localeCode 136 | resolver:(RCTPromiseResolveBlock)resolve 137 | rejecter:(RCTPromiseRejectBlock)reject) 138 | { 139 | localeCode = [localeCode stringByReplacingOccurrencesOfString:@"-" withString:@"_"]; 140 | NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:localeCode]; 141 | NSString *code = locale.localeIdentifier; 142 | NSString *filePath = [[NSBundle mainBundle] pathForResource:code ofType:@"mo" inDirectory:@"i18n"]; 143 | BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:filePath]; 144 | 145 | // fallback locale 146 | if (!fileExists) { 147 | filePath = [[NSBundle mainBundle] pathForResource:[locale objectForKey:NSLocaleLanguageCode] ofType:@"mo" inDirectory:@"i18n"]; 148 | fileExists = [[NSFileManager defaultManager] fileExistsAtPath:filePath]; 149 | } 150 | 151 | if (!fileExists) { 152 | NSError *error = [NSError 153 | errorWithDomain: @"File not found" 154 | code: 404 155 | userInfo: @{ @"locale": localeCode }]; 156 | reject(@"no_file", @"File not found", error); 157 | return; 158 | } 159 | 160 | GettextParser *parser = [[GettextParser alloc] initWithFileAtPath:filePath]; 161 | 162 | if (parser.catalog != nil) { 163 | NSMutableDictionary *result = [[NSMutableDictionary alloc] initWithDictionary:parser.catalog]; 164 | [result setValue:code forKey:@"locale"]; 165 | 166 | resolve(result); 167 | } else { 168 | // TODO reject with error message 169 | } 170 | } 171 | 172 | - (NSString *) getSystemLocale { 173 | NSString *localeString = [[NSLocale preferredLanguages] firstObject]; 174 | return [localeString stringByReplacingOccurrencesOfString:@"_" withString:@"-"]; 175 | } 176 | 177 | - (NSArray *) getAvailableLocales { 178 | NSArray *allLocales = [NSLocale availableLocaleIdentifiers]; 179 | NSMutableArray *result = [[NSMutableArray alloc] initWithCapacity:allLocales.count]; 180 | 181 | for (int i = 0; i < allLocales.count; i++) { 182 | [result addObject:[[allLocales objectAtIndex:i] stringByReplacingOccurrencesOfString:@"_" withString:@"-"]]; 183 | } 184 | 185 | return result; 186 | } 187 | 188 | - (NSDictionary *)constantsToExport { 189 | return @{ 190 | @"systemLocale": [self getSystemLocale], 191 | @"languages": [NSLocale preferredLanguages], 192 | @"availableLocales": [self getAvailableLocales], 193 | @"availableCalendars": @{ 194 | @"buddhist": NSCalendarIdentifierBuddhist, 195 | @"chinese": NSCalendarIdentifierChinese, 196 | @"coptic": NSCalendarIdentifierCoptic, 197 | @"ethioaa": NSCalendarIdentifierEthiopicAmeteAlem, 198 | @"ethiopic": NSCalendarIdentifierEthiopicAmeteMihret, 199 | @"gregory": NSCalendarIdentifierGregorian, 200 | @"hebrew": NSCalendarIdentifierHebrew, 201 | @"indian": NSCalendarIdentifierIndian, 202 | @"islamic": NSCalendarIdentifierIslamic, 203 | @"islamicc": NSCalendarIdentifierIslamicCivil, 204 | @"iso8601": NSCalendarIdentifierISO8601, 205 | @"japanese": NSCalendarIdentifierJapanese, 206 | @"persian": NSCalendarIdentifierPersian, 207 | @"roc": NSCalendarIdentifierRepublicOfChina } 208 | }; 209 | } 210 | 211 | @end 212 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:1.3.1' 9 | } 10 | } 11 | 12 | android { 13 | compileSdkVersion 23 14 | buildToolsVersion "23.0.1" 15 | 16 | defaultConfig { 17 | minSdkVersion 16 18 | targetSdkVersion 22 19 | versionCode 5 20 | versionName "1.5" 21 | } 22 | } 23 | 24 | dependencies { 25 | compile 'com.facebook.react:react-native:0.17.+' 26 | } 27 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /android/src/main/java/kim/taegon/rnintl/GettextParser.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by taggon 3 | */ 4 | package kim.taegon.rnintl; 5 | 6 | import java.io.DataInputStream; 7 | import java.io.FileInputStream; 8 | import java.io.InputStream; 9 | import java.nio.charset.StandardCharsets; 10 | import java.util.Map; 11 | import java.util.HashMap; 12 | import java.util.Arrays; 13 | import java.util.List; 14 | import java.util.ArrayList; 15 | import java.nio.ByteBuffer; 16 | 17 | public class GettextParser { 18 | public final static long MAGIC_NUMBER = 0x950412DEL; 19 | public final static long LE_MAGIC_NUMBER = 0xDE120495L; 20 | public final static long UINT = 0xffffffffL; 21 | 22 | protected String lastError = ""; 23 | protected Map catalog = new HashMap<>(); 24 | protected boolean isLittleEndian = false; 25 | 26 | public GettextParser(String filepath) { 27 | loadFile(filepath); 28 | } 29 | 30 | public GettextParser(InputStream stream) { 31 | loadFile(stream); 32 | } 33 | 34 | public boolean loadFile(String filepath) { 35 | try { 36 | InputStream stream = new FileInputStream(filepath); 37 | loadFile(stream); 38 | stream.close(); 39 | } catch (Exception e) { 40 | lastError = e.getMessage(); 41 | return false; 42 | } 43 | 44 | return true; 45 | } 46 | 47 | public boolean loadFile(InputStream stream) { 48 | Map headers = new HashMap<>(); 49 | Map translations = new HashMap<>(); 50 | 51 | try { 52 | DataInputStream ds = new DataInputStream(stream); 53 | 54 | Map fileHeader = readFileHeader(ds); 55 | 56 | for (int i = 0; i < fileHeader.get("stringCount"); i++) { 57 | // msgid - original string 58 | String[] idList = getStringsFromFile(ds, fileHeader.get("originalStringOffset") + i * 8); 59 | 60 | // msgstr - translation string 61 | String[] translationList = getStringsFromFile(ds, fileHeader.get("translationStringOffset") + i * 8); 62 | 63 | if (idList.length == 1 && idList[0].isEmpty()) { 64 | headers = parseHeader(translationList[0]); 65 | continue; 66 | } 67 | 68 | for (String msgid: idList) { 69 | translations.put(msgid, translationList); 70 | } 71 | } 72 | } catch (Exception e) { 73 | e.printStackTrace(); 74 | lastError = e.getMessage(); 75 | return false; 76 | } 77 | 78 | catalog.put("headers", headers); 79 | catalog.put("translations", translations); 80 | 81 | return true; 82 | } 83 | 84 | protected Map readFileHeader(DataInputStream ds) throws Exception { 85 | Map header = new HashMap<>(); 86 | long magicNumber = 0; 87 | 88 | try { 89 | // reset the position 90 | ds.reset(); 91 | 92 | // magic number 93 | magicNumber = ds.readInt() & UINT; 94 | 95 | if (magicNumber != MAGIC_NUMBER && magicNumber != LE_MAGIC_NUMBER) { 96 | throw new Exception("Invalid magic number"); 97 | } 98 | 99 | // little endian? 100 | isLittleEndian = (magicNumber == LE_MAGIC_NUMBER); 101 | 102 | // revision 103 | header.put("revision", swapInteger(ds.readInt())); 104 | 105 | // string count 106 | header.put("stringCount", swapInteger(ds.readInt())); 107 | 108 | // original string offset 109 | header.put("originalStringOffset", swapInteger(ds.readInt())); 110 | 111 | // translation string offset 112 | header.put("translationStringOffset", swapInteger(ds.readInt())); 113 | 114 | // hash table size 115 | header.put("hashTableSize", swapInteger(ds.readInt())); 116 | 117 | // hash table offset 118 | header.put("hashTableOffset", swapInteger(ds.readInt())); 119 | } catch(Exception e) { 120 | throw e; 121 | } 122 | 123 | return header; 124 | } 125 | 126 | final protected int swapInteger(int n) { 127 | if (isLittleEndian) { 128 | byte[] b = ByteBuffer.allocate(4).putInt(n).array(); 129 | n = ((b[3]&0xff)<<24) + ((b[2]&0xff)<<16) + ((b[1]&0xff)<<8) + (b[0]&0xff); 130 | } 131 | return n; 132 | } 133 | 134 | protected String[] getStringsFromFile(DataInputStream ds, int offset) { 135 | List result = new ArrayList<>(); 136 | int len = 0, pos = 0; 137 | 138 | try { 139 | ds.reset(); 140 | ds.skip(offset); 141 | len = swapInteger(ds.readInt()); 142 | pos = swapInteger(ds.readInt()); 143 | 144 | byte[] data = new byte[len]; 145 | ds.reset(); 146 | ds.skip(pos); 147 | ds.read(data); 148 | 149 | // strip context 150 | int contextSeparatorPos = -1; 151 | for (int i = 0; i < data.length; i++) { 152 | if (data[i] == 4) { 153 | contextSeparatorPos = i; 154 | break; 155 | } 156 | } 157 | if (contextSeparatorPos > -1) { 158 | len -= contextSeparatorPos; 159 | data = Arrays.copyOfRange(data, contextSeparatorPos+1, len); 160 | } 161 | 162 | int nullSeparatorPos = 0; 163 | do { 164 | nullSeparatorPos = -1; 165 | for (int i = 0; i < data.length; i++) { 166 | if (data[i] == 0) { 167 | nullSeparatorPos = i; 168 | break; 169 | } 170 | } 171 | if (nullSeparatorPos < 0) break; 172 | 173 | String str = new String(Arrays.copyOfRange(data, 0, nullSeparatorPos), StandardCharsets.UTF_8); 174 | result.add(str); 175 | 176 | data = Arrays.copyOfRange(data, nullSeparatorPos+1, data.length); 177 | } while(true); 178 | 179 | if (result.size() == 0 && data.length == 0) { 180 | result.add(""); 181 | } else if (data.length > 0) { 182 | String str = new String(data, StandardCharsets.UTF_8); 183 | result.add(str); 184 | } 185 | } catch (Exception e) { 186 | lastError = e.getMessage(); 187 | return null; 188 | } 189 | 190 | return result.toArray(new String[result.size()]); 191 | } 192 | 193 | public Map parseHeader(String headerString) { 194 | String[] headers = headerString.split("\\n"); 195 | Map result = new HashMap<>(); 196 | 197 | for(String header: headers) { 198 | String[] entry = header.split("\\s*:\\s*", 2); 199 | if (entry.length < 2) continue; 200 | 201 | result.put(entry[0], entry[1]); 202 | } 203 | 204 | return result; 205 | } 206 | 207 | public Map getCatalog() { 208 | return catalog; 209 | } 210 | } 211 | -------------------------------------------------------------------------------- /android/src/main/java/kim/taegon/rnintl/ReactNativeIntl.java: -------------------------------------------------------------------------------- 1 | package kim.taegon.rnintl; 2 | 3 | import com.facebook.react.bridge.Arguments; 4 | import com.facebook.react.bridge.WritableArray; 5 | import com.facebook.react.common.MapBuilder; 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.Promise; 10 | import com.facebook.react.bridge.ReadableArray; 11 | import com.facebook.react.bridge.ReadableMap; 12 | import com.facebook.react.bridge.WritableMap; 13 | 14 | import java.io.IOException; 15 | import java.io.InputStream; 16 | import java.util.Map; 17 | import java.util.HashMap; 18 | import java.util.List; 19 | import java.util.Arrays; 20 | import java.util.ArrayList; 21 | import java.util.Locale; 22 | import java.util.Date; 23 | import java.util.Set; 24 | import java.util.HashSet; 25 | import java.util.Currency; 26 | import java.text.NumberFormat; 27 | import java.text.SimpleDateFormat; 28 | import java.util.StringTokenizer; 29 | import java.util.TimeZone; 30 | 31 | import javax.annotation.Nullable; 32 | 33 | import android.content.Context; 34 | import android.text.format.DateFormat; 35 | 36 | public class ReactNativeIntl extends ReactContextBaseJavaModule { 37 | public ReactNativeIntl(ReactApplicationContext reactContext) { 38 | super(reactContext); 39 | } 40 | 41 | @Override 42 | public String getName() { 43 | return "RNIntl"; 44 | } 45 | 46 | @Override 47 | public Map getConstants() { 48 | MapBuilder.Builder builder = MapBuilder.builder(); 49 | 50 | builder.put("systemLocale", getSystemLocale()); 51 | builder.put("languages", getAvailableLocales()); 52 | builder.put("availableLocales", getAvailableLocales()); 53 | builder.put("availableCalendars", ""); 54 | 55 | return builder.build(); 56 | } 57 | 58 | @ReactMethod 59 | public void formatNumber(double number, String localeIdenfitier, @Nullable ReadableMap options, Promise promise) { 60 | Locale locale; 61 | 62 | try { 63 | locale = Locale.forLanguageTag(localeIdenfitier); 64 | } catch(Exception e) { 65 | // fallback 66 | locale = Locale.forLanguageTag(getSystemLocale().replace('-', '_')); 67 | } 68 | 69 | try { 70 | NumberFormat nf = NumberFormat.getInstance(locale); 71 | 72 | if (options != null) { 73 | String style = options.hasKey("style") ? options.getString("style") : "decimal"; 74 | if (style.equals("currency")) { 75 | nf = NumberFormat.getCurrencyInstance(locale); 76 | 77 | // currency 78 | if (options.hasKey("currency")) { 79 | nf.setCurrency(Currency.getInstance(options.getString("currency"))); 80 | } 81 | 82 | // TODO: currencyDisplay 83 | } else if (style.equals("percent")) { 84 | nf = NumberFormat.getPercentInstance(locale); 85 | } 86 | 87 | // useGrouping 88 | nf.setGroupingUsed(!options.hasKey("useGrouping") || options.getBoolean("useGrouping")); 89 | 90 | // minimumIntegerDigits 91 | if (options.hasKey("minimumIntegerDigits")) { 92 | int minimumIntegerDigits = options.getInt("minimumIntegerDigits"); 93 | if (0 < minimumIntegerDigits && minimumIntegerDigits < 22) { 94 | nf.setMinimumIntegerDigits(minimumIntegerDigits); 95 | } 96 | } 97 | 98 | // minimumFractionDigits 99 | if (options.hasKey("minimumFractionDigits")) { 100 | int minimumFractionDigits = options.getInt("minimumFractionDigits"); 101 | if (-1 < minimumFractionDigits && minimumFractionDigits < 21) { 102 | nf.setMinimumFractionDigits(minimumFractionDigits); 103 | } 104 | } 105 | 106 | // maximumFractionDigits 107 | if (options.hasKey("maximumFractionDigits")) { 108 | int maximumFractionDigits = options.getInt("maximumFractionDigits"); 109 | if (-1 < maximumFractionDigits && maximumFractionDigits < 21) { 110 | nf.setMaximumFractionDigits(maximumFractionDigits); 111 | } 112 | } 113 | 114 | // minimumSignificantDigits - not supported 115 | // maximumSignificantDigits - not supported 116 | } 117 | 118 | promise.resolve(nf.format(number)); 119 | } catch(Exception e) { 120 | promise.reject(e.getMessage()); 121 | } 122 | } 123 | 124 | @ReactMethod 125 | public void formatDate(double dateTime, String localeIdentifier, @Nullable ReadableMap options, Promise promise) { 126 | Locale locale; 127 | 128 | try { 129 | locale = Locale.forLanguageTag(localeIdentifier); 130 | } catch (Exception e) { 131 | // fallback 132 | locale = Locale.forLanguageTag(getSystemLocale().replace('-', '_')); 133 | } 134 | 135 | try { 136 | Date date = new Date(Double.valueOf((dateTime)).longValue()); 137 | SimpleDateFormat df = new SimpleDateFormat(); 138 | 139 | if (options != null) { 140 | // TODO: calendar - I can't find how android support various calendars yet 141 | 142 | // timezone 143 | if (options.hasKey("timeZone")) { 144 | // TODO: should I check validation of the option? 145 | TimeZone tz = TimeZone.getTimeZone(options.getString("timeZone")); 146 | df.setTimeZone(tz); 147 | } 148 | 149 | String pattern = DateFormat.getBestDateTimePattern(locale, options.getString("template")); 150 | 151 | // hour12 152 | if (options.hasKey("hour12")) { 153 | if (options.getBoolean("hour12")) { 154 | pattern = pattern.replace('H', 'h'); 155 | } else { 156 | pattern = pattern.replace('h', 'H'); 157 | } 158 | } 159 | 160 | df.applyLocalizedPattern(pattern); 161 | } 162 | 163 | promise.resolve(df.format(date)); 164 | } catch (Exception e) { 165 | promise.reject(e.getMessage()); 166 | } 167 | } 168 | 169 | @ReactMethod 170 | public void loadCatalog(String localeIdentifier, Promise promise) { 171 | try { 172 | Locale locale = Locale.forLanguageTag(localeIdentifier); 173 | Context context = getReactApplicationContext().getApplicationContext(); 174 | InputStream stream = null; 175 | String assetDir = "i18n/"; 176 | String assetName = localeIdentifier.replace('-', '_'); 177 | 178 | try { 179 | stream = context.getAssets().open(assetDir+assetName+".mo"); 180 | } catch(IOException e) { 181 | // fallback - using language only 182 | stream = context.getAssets().open(assetDir+locale.getLanguage()+".mo"); 183 | } 184 | 185 | GettextParser parser = new GettextParser(stream); 186 | Map rawCatalog = parser.getCatalog(); 187 | 188 | WritableMap catalog = Arguments.createMap(); 189 | WritableMap headers = Arguments.createMap(); 190 | WritableMap translations = Arguments.createMap(); 191 | 192 | // headers 193 | if (rawCatalog.containsKey("headers")) { 194 | for (Map.Entry entry : ((Map)rawCatalog.get("headers")).entrySet()) { 195 | headers.putString(entry.getKey(), entry.getValue()); 196 | } 197 | } 198 | 199 | // translations 200 | if (rawCatalog.containsKey("translations")) { 201 | for (Map.Entry entry: ((Map)rawCatalog.get("translations")).entrySet()) { 202 | WritableArray messages = Arguments.createArray(); 203 | for (String msg: entry.getValue()) { 204 | messages.pushString(msg); 205 | } 206 | translations.putArray(entry.getKey(), messages); 207 | } 208 | } 209 | 210 | catalog.putMap("headers", headers); 211 | catalog.putMap("translations", translations); 212 | 213 | promise.resolve(catalog); 214 | } catch(Exception e) { 215 | promise.reject(e.getMessage()); 216 | } 217 | } 218 | 219 | protected String getSystemLocale() { 220 | String localeIdentifier = getReactApplicationContext().getResources().getConfiguration().locale.toString(); 221 | return localeIdentifier.replace('_', '-'); 222 | } 223 | 224 | protected List getAvailableLocales() { 225 | Locale[] locales = Locale.getAvailableLocales(); 226 | List langs = new ArrayList<>(locales.length); 227 | 228 | for (Locale locale: locales) langs.add(locale.toString().replace('_', '-')); 229 | 230 | return langs; 231 | } 232 | } 233 | -------------------------------------------------------------------------------- /android/src/main/java/kim/taegon/rnintl/ReactNativeIntlPackage.java: -------------------------------------------------------------------------------- 1 | package kim.taegon.rnintl; 2 | 3 | import com.facebook.react.ReactPackage; 4 | import com.facebook.react.bridge.JavaScriptModule; 5 | import com.facebook.react.bridge.NativeModule; 6 | import com.facebook.react.bridge.ReactApplicationContext; 7 | import com.facebook.react.uimanager.ViewManager; 8 | 9 | import java.util.ArrayList; 10 | import java.util.Collections; 11 | import java.util.List; 12 | 13 | public class ReactNativeIntlPackage implements ReactPackage { 14 | @Override 15 | public List createNativeModules(ReactApplicationContext reactContext) { 16 | List modules = new ArrayList<>(); 17 | 18 | modules.add(new ReactNativeIntl(reactContext)); 19 | 20 | return modules; 21 | } 22 | 23 | @Override 24 | public List> createJSModules() { 25 | return Collections.emptyList(); 26 | } 27 | 28 | @Override 29 | public List createViewManagers(ReactApplicationContext reactContext) { 30 | return Collections.emptyList(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | Collator: require('./lib/Collator'), 5 | DateTimeFormat: require('./lib/DateTimeFormat'), 6 | NumberFormat: require('./lib/NumberFormat'), 7 | Translation: require('./lib/Translation') 8 | }; 9 | -------------------------------------------------------------------------------- /lib/BaseFormat.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const { RNIntl } = require('react-native').NativeModules; 4 | 5 | class BaseFormat { 6 | constructor(locales, options) { 7 | if (typeof locales === 'undefined') { 8 | locales = RNIntl.systemLocale; 9 | } 10 | this.locales = BaseFormat.supportedLocalesOf(locales); 11 | this.options = options || {}; 12 | } 13 | 14 | static supportedLocalesOf(locales) { 15 | if (typeof locales === 'string') { 16 | locales = [locales]; 17 | } 18 | 19 | var allLocales = RNIntl.availableLocales; 20 | return locales.filter( item => allLocales.indexOf(item.replace(/-u-.+$/, '')) >= 0 ); 21 | } 22 | 23 | resolvedOptions() { 24 | return this.options; 25 | } 26 | } 27 | 28 | module.exports = BaseFormat; 29 | -------------------------------------------------------------------------------- /lib/Collator.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const { RNIntl } = require('react-native').NativeModules; 4 | 5 | class Collator { 6 | constructor() { 7 | throw 'Intl.Collator is not supported yet.'; 8 | } 9 | } 10 | 11 | module.exports = Collator; 12 | -------------------------------------------------------------------------------- /lib/DateTimeFormat.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const { RNIntl } = require('react-native').NativeModules; 4 | const BaseFormat = require('./BaseFormat'); 5 | 6 | const DEFAULTS = { 7 | localeMatcher: 'best fit', 8 | formatMatcher: 'best fit' 9 | }; 10 | 11 | const DATE_FIELDS = { 12 | era: { 'narrow': 'GGG', 'short': 'GGGGG', 'long': 'GGGG' }, 13 | year: { 'numeric': 'y', '2-digit': 'yy', 'undefined': 'y' }, 14 | month: { 'numeric': 'M', '2-digit': 'MM', 'narrow': 'MMM', 'short': 'MMMMM', 'long': 'MMMM', 'undefined': 'M' }, 15 | day: { 'numeric': 'd', '2-digit': 'dd', 'undefined': 'd' }, 16 | weekday: { 'narrow': 'EEE', 'short': 'EEEEE', 'long': 'EEEE' }, 17 | hour: { 'numeric': 'h', '2-digit': 'hh' }, 18 | minute: { 'numeric': 'm', '2-digit': 'mm' }, 19 | second: { 'numeric': 's', '2-digit': 'ss' }, 20 | timeZoneName: { 'short': 'v', 'long': 'vvvv' }, 21 | } 22 | 23 | class DateTimeFormat extends BaseFormat { 24 | constructor(locales, options) { 25 | super(locales, options); 26 | 27 | var parsedLocale = this.parseLocale(this.locales[0]); 28 | 29 | this.locales[0] = parsedLocale.code; 30 | this.calendar = parsedLocale.calendar; 31 | this.options = Object.assign({}, DEFAULTS, options); 32 | this.dateTemplate = this.generateDateTemplate(this.options); 33 | } 34 | 35 | format(date/*: Date*/) { 36 | var options = {calendar:this.calendar, template:this.dateTemplate}; 37 | if ('hour12' in this.options) options.hour12 = this.options.hour12; 38 | return RNIntl.formatDate(+date, this.locales[0], options).then( value => value ); 39 | } 40 | 41 | parseLocale(locale/*: String*/) { 42 | var result = { }; 43 | var components = locale.split(/-u\b/); 44 | 45 | result.code = locale = components[0]; 46 | 47 | if (components[1]) { 48 | let match = components[1].match(/-cu-([a-z0-9A-Z]+)/) 49 | if (match) { 50 | result.calendar = RNIntl.availableCalendars[match[1]] || undefined; 51 | } 52 | 53 | // TODO : numbering system 54 | } 55 | 56 | return result; 57 | } 58 | 59 | generateDateTemplate(options) { 60 | var tpl = ''; 61 | var components = 'era year month weekday day hour minute second timeZoneName'.split(' '); 62 | 63 | for (var i=0; i < components.length; i++) { 64 | tpl += DATE_FIELDS[components[i]][options[components[i]]] || ''; 65 | } 66 | 67 | return tpl; 68 | } 69 | } 70 | 71 | module.exports = DateTimeFormat; 72 | -------------------------------------------------------------------------------- /lib/NumberFormat.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const { RNIntl } = require('react-native').NativeModules; 4 | const BaseFormat = require('./BaseFormat'); 5 | const DEFAULTS = { 6 | localeMatcher: 'best fit', 7 | style: 'decimal', 8 | currencyDisplay: 'symbol', 9 | useGrouping: true 10 | }; 11 | 12 | class NumberFormat extends BaseFormat { 13 | constructor(locales, options) { 14 | super(locales, options); 15 | 16 | this.options = Object.assign({}, DEFAULTS, options); 17 | } 18 | 19 | format(number) { 20 | return RNIntl.formatNumber(number, this.locales[0], this.options).then( value => value ); 21 | } 22 | } 23 | 24 | module.exports = NumberFormat; 25 | -------------------------------------------------------------------------------- /lib/Translation.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const { RNIntl } = require('react-native').NativeModules; 4 | 5 | class Translation { 6 | _locale = null; 7 | _promise = null; 8 | _catalog = null; 9 | 10 | constructor(locale/*: String*/) { 11 | this._locale = locale; 12 | 13 | this._promise = RNIntl.loadCatalog(locale).then( 14 | catalog => { 15 | this._catalog = catalog; 16 | 17 | // creat getPlural function 18 | if (catalog.headers && catalog.headers['Plural-Forms']) { 19 | this.getPlural = new Function('n', `var plural; var ${catalog.headers['Plural-Forms']} ; return plural;`); 20 | } 21 | }, 22 | error => { 23 | this._catalog = {translations:{}}; 24 | } 25 | ); 26 | } 27 | 28 | async getTranslator() { 29 | await this._promise; 30 | return this._getTranslation.bind(this); 31 | } 32 | 33 | getPlural(count/*: Number*/) { 34 | return count === 1 ? 0 : 1; 35 | } 36 | 37 | _getTranslation(msgid, /* plural_messages, ..., count: Number */) { 38 | const count = arguments[arguments.length - 1]; 39 | const plural = this.getPlural(typeof count === 'number' ? count : 1); 40 | const trans = this._catalog.translations; 41 | const messages = Array.from(arguments); 42 | 43 | // remove the counter 44 | if (typeof count === 'number') { 45 | messages.pop(); 46 | } 47 | 48 | if (trans && trans[msgid]) { 49 | return trans[msgid][plural] || trans[msgid][0]; 50 | } else { 51 | return messages[plural] || messages[0]; 52 | } 53 | } 54 | } 55 | 56 | module.exports = Translation; 57 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-intl", 3 | "version": "1.0.0", 4 | "description": "React Native module shipped native Intl implementation and Translation extension", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "readmeFilename": "README.md", 10 | "repository": { 11 | "type": "git", 12 | "url": "git+https://github.com/taggon/react-native-intl.git" 13 | }, 14 | "keywords": [ 15 | "react-native", 16 | "react-component", 17 | "i18n", 18 | "l10n", 19 | "intl", 20 | "ios", 21 | "android" 22 | ], 23 | "author": "Taegon Kim", 24 | "license": "MIT", 25 | "bugs": { 26 | "url": "https://github.com/taggon/react-native-intl/issues" 27 | }, 28 | "homepage": "https://github.com/taggon/react-native-intl#readme" 29 | } 30 | --------------------------------------------------------------------------------