diff --git a/Example/.babelrc b/Example/.babelrc index 8df53fe..a9ce136 100644 --- a/Example/.babelrc +++ b/Example/.babelrc @@ -1,3 +1,3 @@ { -"presets": ["react-native"] -} \ No newline at end of file + "presets": ["react-native"] +} diff --git a/Example/.flowconfig b/Example/.flowconfig index 5912f47..a76425e 100644 --- a/Example/.flowconfig +++ b/Example/.flowconfig @@ -22,24 +22,26 @@ node_modules/react-native/flow flow/ [options] +emoji=true + module.system=haste experimental.strict_type_args=true munge_underscores=true -module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub' 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' suppress_type=$FlowIssue suppress_type=$FlowFixMe suppress_type=$FixMe -suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-5]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) -suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-5]\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ +suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(4[0-2]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) +suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(4[0-2]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy +suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError unsafe.enable_getters_and_setters=true [version] -^0.35.0 +^0.42.0 diff --git a/Example/.gitignore b/Example/.gitignore index 93fd764..10be197 100644 --- a/Example/.gitignore +++ b/Example/.gitignore @@ -34,9 +34,20 @@ local.properties # node_modules/ npm-debug.log +yarn-error.log # BUCK buck-out/ \.buckd/ -android/app/libs *.keystore + +# fastlane +# +# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the +# screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md + +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots diff --git a/Example/.watchmanconfig b/Example/.watchmanconfig index f10d2dd..9e26dfe 100644 --- a/Example/.watchmanconfig +++ b/Example/.watchmanconfig @@ -1,3 +1 @@ -{ - fsevents_latency: 1 -} +{} \ No newline at end of file diff --git a/Example/android/app/BUCK b/Example/android/app/BUCK index 2ebdb98..c8f5603 100644 --- a/Example/android/app/BUCK +++ b/Example/android/app/BUCK @@ -1,5 +1,3 @@ -import re - # To learn about Buck see [Docs](https://buckbuild.com/). # To run your application with Buck: # - install Buck @@ -11,8 +9,9 @@ import re # lib_deps = [] + for jarfile in glob(['libs/*.jar']): - name = 'jars__' + re.sub(r'^.*/([^/]+)\.jar$', r'\1', jarfile) + name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')] lib_deps.append(':' + name) prebuilt_jar( name = name, @@ -20,7 +19,7 @@ for jarfile in glob(['libs/*.jar']): ) for aarfile in glob(['libs/*.aar']): - name = 'aars__' + re.sub(r'^.*/([^/]+)\.aar$', r'\1', aarfile) + name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')] lib_deps.append(':' + name) android_prebuilt_aar( name = name, @@ -28,39 +27,39 @@ for aarfile in glob(['libs/*.aar']): ) android_library( - name = 'all-libs', - exported_deps = lib_deps + name = "all-libs", + exported_deps = lib_deps, ) android_library( - name = 'app-code', - srcs = glob([ - 'src/main/java/**/*.java', - ]), - deps = [ - ':all-libs', - ':build_config', - ':res', - ], + name = "app-code", + srcs = glob([ + "src/main/java/**/*.java", + ]), + deps = [ + ":all-libs", + ":build_config", + ":res", + ], ) android_build_config( - name = 'build_config', - package = 'com.example', + name = "build_config", + package = "com.example", ) android_resource( - name = 'res', - res = 'src/main/res', - package = 'com.example', + name = "res", + package = "com.example", + res = "src/main/res", ) android_binary( - name = 'app', - package_type = 'debug', - manifest = 'src/main/AndroidManifest.xml', - keystore = '//android/keystores:debug', - deps = [ - ':app-code', - ], + name = "app", + keystore = "//android/keystores:debug", + manifest = "src/main/AndroidManifest.xml", + package_type = "debug", + deps = [ + ":app-code", + ], ) diff --git a/Example/android/app/build.gradle b/Example/android/app/build.gradle index 63faa5a..b89df76 100644 --- a/Example/android/app/build.gradle +++ b/Example/android/app/build.gradle @@ -58,7 +58,7 @@ import com.android.build.OutputFile * inputExcludes: ["android/**", "ios/**"], * * // override which node gets called and with what additional arguments - * nodeExecutableAndArgs: ["node"] + * nodeExecutableAndArgs: ["node"], * * // supply additional arguments to the packager * extraPackagerArgs: [] @@ -126,7 +126,6 @@ android { } dependencies { - compile project(':react-native-svg') compile fileTree(dir: "libs", include: ["*.jar"]) compile "com.android.support:appcompat-v7:23.0.1" compile "com.facebook.react:react-native:+" // From node_modules diff --git a/Example/android/app/proguard-rules.pro b/Example/android/app/proguard-rules.pro index 48361a9..6e8516c 100644 --- a/Example/android/app/proguard-rules.pro +++ b/Example/android/app/proguard-rules.pro @@ -50,6 +50,10 @@ -dontwarn com.facebook.react.** +# TextLayoutBuilder uses a non-public Android constructor within StaticLayout. +# See libs/proxy/src/main/java/com/facebook/fbui/textlayoutbuilder/proxy for details. +-dontwarn android.text.StaticLayout + # okhttp -keepattributes Signature diff --git a/Example/android/app/src/main/AndroidManifest.xml b/Example/android/app/src/main/AndroidManifest.xml index 677f075..8275835 100644 --- a/Example/android/app/src/main/AndroidManifest.xml +++ b/Example/android/app/src/main/AndroidManifest.xml @@ -19,7 +19,8 @@ + android:configChanges="keyboard|keyboardHidden|orientation|screenSize" + android:windowSoftInputMode="adjustResize"> diff --git a/Example/android/app/src/main/java/com/example/MainApplication.java b/Example/android/app/src/main/java/com/example/MainApplication.java index 6796943..f51721b 100644 --- a/Example/android/app/src/main/java/com/example/MainApplication.java +++ b/Example/android/app/src/main/java/com/example/MainApplication.java @@ -1,11 +1,8 @@ package com.example; import android.app.Application; -import android.util.Log; import com.facebook.react.ReactApplication; -import com.horcrux.svg.RNSvgPackage; -import com.facebook.react.ReactInstanceManager; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.react.shell.MainReactPackage; @@ -18,15 +15,14 @@ public class MainApplication extends Application implements ReactApplication { private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { @Override - protected boolean getUseDeveloperSupport() { + public boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; } @Override protected List getPackages() { return Arrays.asList( - new MainReactPackage(), - new RNSvgPackage() + new MainReactPackage() ); } }; diff --git a/Example/android/build.gradle b/Example/android/build.gradle index fcba4c5..eed9972 100644 --- a/Example/android/build.gradle +++ b/Example/android/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:1.3.1' + classpath 'com.android.tools.build:gradle:2.2.3' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/Example/android/gradle/wrapper/gradle-wrapper.properties b/Example/android/gradle/wrapper/gradle-wrapper.properties index b9fbfab..dbdc05d 100644 --- a/Example/android/gradle/wrapper/gradle-wrapper.properties +++ b/Example/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip diff --git a/Example/android/keystores/BUCK b/Example/android/keystores/BUCK index 15da20e..88e4c31 100644 --- a/Example/android/keystores/BUCK +++ b/Example/android/keystores/BUCK @@ -1,8 +1,8 @@ keystore( - name = 'debug', - store = 'debug.keystore', - properties = 'debug.keystore.properties', - visibility = [ - 'PUBLIC', - ], + name = "debug", + properties = "debug.keystore.properties", + store = "debug.keystore", + visibility = [ + "PUBLIC", + ], ) diff --git a/Example/android/settings.gradle b/Example/android/settings.gradle index 0aad2d5..54b22e1 100644 --- a/Example/android/settings.gradle +++ b/Example/android/settings.gradle @@ -1,5 +1,3 @@ rootProject.name = 'Example' -include ':react-native-svg' -project(':react-native-svg').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-svg/android') include ':app' diff --git a/Example/app.json b/Example/app.json new file mode 100644 index 0000000..e933d06 --- /dev/null +++ b/Example/app.json @@ -0,0 +1,4 @@ +{ + "name": "Example", + "displayName": "Example" +} \ No newline at end of file diff --git a/Example/index.ios.js b/Example/index.ios.js index 575a59a..468e03b 100644 --- a/Example/index.ios.js +++ b/Example/index.ios.js @@ -19,7 +19,7 @@ export default class Example extends Component { return ( - Welcome to React Native! + React Native Barcode Builder diff --git a/Example/ios/Example-tvOS/Info.plist b/Example/ios/Example-tvOS/Info.plist new file mode 100644 index 0000000..2fb6a11 --- /dev/null +++ b/Example/ios/Example-tvOS/Info.plist @@ -0,0 +1,54 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIViewControllerBasedStatusBarAppearance + + NSLocationWhenInUseUsageDescription + + NSAppTransportSecurity + + + NSExceptionDomains + + localhost + + NSExceptionAllowsInsecureHTTPLoads + + + + + + diff --git a/Example/ios/Example-tvOSTests/Info.plist b/Example/ios/Example-tvOSTests/Info.plist new file mode 100644 index 0000000..886825c --- /dev/null +++ b/Example/ios/Example-tvOSTests/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/Example/ios/Example.xcodeproj/project.pbxproj b/Example/ios/Example.xcodeproj/project.pbxproj index 9c7ee6c..57fc793 100644 --- a/Example/ios/Example.xcodeproj/project.pbxproj +++ b/Example/ios/Example.xcodeproj/project.pbxproj @@ -22,8 +22,20 @@ 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; 146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; + 2D02E4BC1E0B4A80006451C7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; + 2D02E4BD1E0B4A84006451C7 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; + 2D02E4BF1E0B4AB3006451C7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; + 2D02E4C21E0B4AEC006451C7 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation.a */; }; + 2D02E4C31E0B4AEC006451C7 /* libRCTImage-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E841DF850E9000B6D8A /* libRCTImage-tvOS.a */; }; + 2D02E4C41E0B4AEC006451C7 /* libRCTLinking-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E881DF850E9000B6D8A /* libRCTLinking-tvOS.a */; }; + 2D02E4C51E0B4AEC006451C7 /* libRCTNetwork-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E8C1DF850E9000B6D8A /* libRCTNetwork-tvOS.a */; }; + 2D02E4C61E0B4AEC006451C7 /* libRCTSettings-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E901DF850E9000B6D8A /* libRCTSettings-tvOS.a */; }; + 2D02E4C71E0B4AEC006451C7 /* libRCTText-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E941DF850E9000B6D8A /* libRCTText-tvOS.a */; }; + 2D02E4C81E0B4AEC006451C7 /* libRCTWebSocket-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E991DF850E9000B6D8A /* libRCTWebSocket-tvOS.a */; }; + 2D02E4C91E0B4AEC006451C7 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3EA31DF850E9000B6D8A /* libReact.a */; }; + 2DCD954D1E0B4F2C00145EB5 /* ExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* ExampleTests.m */; }; 5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; }; - 74D448797F75450289FF6091 /* libRNSVG.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8C096A64C03D4F75A0DCAE13 /* libRNSVG.a */; }; + 5EFAC5E81EDC8AC2004B239F /* libART.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5EFAC5CE1EDC8ABB004B239F /* libART.a */; }; 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; }; /* End PBXBuildFile section */ @@ -91,61 +103,103 @@ remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192; remoteInfo = React; }; - 14ADC4D91E0A68E1009D91E1 /* PBXContainerItemProxy */ = { + 2D02E4911E0B4A5D006451C7 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 2D02E47A1E0B4A5D006451C7; + remoteInfo = "Example-tvOS"; + }; + 3DAD3E831DF850E9000B6D8A /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; proxyType = 2; remoteGlobalIDString = 2D2A283A1D9B042B00D4039D; remoteInfo = "RCTImage-tvOS"; }; - 14ADC4DD1E0A68E1009D91E1 /* PBXContainerItemProxy */ = { + 3DAD3E871DF850E9000B6D8A /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; proxyType = 2; remoteGlobalIDString = 2D2A28471D9B043800D4039D; remoteInfo = "RCTLinking-tvOS"; }; - 14ADC4E11E0A68E1009D91E1 /* PBXContainerItemProxy */ = { + 3DAD3E8B1DF850E9000B6D8A /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; proxyType = 2; remoteGlobalIDString = 2D2A28541D9B044C00D4039D; remoteInfo = "RCTNetwork-tvOS"; }; - 14ADC4E51E0A68E1009D91E1 /* PBXContainerItemProxy */ = { + 3DAD3E8F1DF850E9000B6D8A /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; proxyType = 2; remoteGlobalIDString = 2D2A28611D9B046600D4039D; remoteInfo = "RCTSettings-tvOS"; }; - 14ADC4E91E0A68E1009D91E1 /* PBXContainerItemProxy */ = { + 3DAD3E931DF850E9000B6D8A /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; proxyType = 2; remoteGlobalIDString = 2D2A287B1D9B048500D4039D; remoteInfo = "RCTText-tvOS"; }; - 14ADC4EE1E0A68E1009D91E1 /* PBXContainerItemProxy */ = { + 3DAD3E981DF850E9000B6D8A /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; proxyType = 2; remoteGlobalIDString = 2D2A28881D9B049200D4039D; remoteInfo = "RCTWebSocket-tvOS"; }; - 14ADC4F21E0A68E1009D91E1 /* PBXContainerItemProxy */ = { + 3DAD3EA21DF850E9000B6D8A /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; proxyType = 2; remoteGlobalIDString = 2D2A28131D9B038B00D4039D; remoteInfo = "React-tvOS"; }; - 14ADC4F51E0A68E1009D91E1 /* PBXContainerItemProxy */ = { + 3DAD3EA41DF850E9000B6D8A /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = 1C3B12080F224062AE08DAEC /* RNSVG.xcodeproj */; + containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; proxyType = 2; - remoteGlobalIDString = 0CF68AC11AF0540F00FF9E5C; - remoteInfo = RNSVG; + remoteGlobalIDString = 3D3C059A1DE3340900C268FA; + remoteInfo = yoga; + }; + 3DAD3EA61DF850E9000B6D8A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 3D3C06751DE3340C00C268FA; + remoteInfo = "yoga-tvOS"; + }; + 3DAD3EA81DF850E9000B6D8A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 3D3CD9251DE5FBEC00167DC4; + remoteInfo = cxxreact; + }; + 3DAD3EAA1DF850E9000B6D8A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 3D3CD9321DE5FBEE00167DC4; + remoteInfo = "cxxreact-tvOS"; + }; + 3DAD3EAC1DF850E9000B6D8A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 3D3CD90B1DE5FBD600167DC4; + remoteInfo = jschelpers; + }; + 3DAD3EAE1DF850E9000B6D8A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 3D3CD9181DE5FBD800167DC4; + remoteInfo = "jschelpers-tvOS"; }; 5E9157321DD0AC6500FF2AA8 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; @@ -161,6 +215,13 @@ remoteGlobalIDString = 2D2A28201D9B03D100D4039D; remoteInfo = "RCTAnimation-tvOS"; }; + 5EFAC5CD1EDC8ABB004B239F /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 5EFAC5C91EDC8ABB004B239F /* ART.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 0CF68AC11AF0540F00FF9E5C; + remoteInfo = ART; + }; 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; @@ -197,11 +258,12 @@ 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Example/Info.plist; sourceTree = ""; }; 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Example/main.m; sourceTree = ""; }; 146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = ""; }; - 1C3B12080F224062AE08DAEC /* RNSVG.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNSVG.xcodeproj; path = "../node_modules/react-native-svg/ios/RNSVG.xcodeproj"; sourceTree = ""; }; + 2D02E47B1E0B4A5D006451C7 /* Example-tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Example-tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 2D02E4901E0B4A5D006451C7 /* Example-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Example-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = ""; }; + 5EFAC5C91EDC8ABB004B239F /* ART.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ART.xcodeproj; path = "../../../Example/node_modules/react-native/Libraries/ART/ART.xcodeproj"; sourceTree = ""; }; 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = ""; }; 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = ""; }; - 8C096A64C03D4F75A0DCAE13 /* libRNSVG.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNSVG.a; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -217,8 +279,9 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */, + 5EFAC5E81EDC8AC2004B239F /* libART.a in Frameworks */, 146834051AC3E58100842450 /* libReact.a in Frameworks */, + 5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */, 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */, 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */, 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */, @@ -228,7 +291,28 @@ 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */, 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */, 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */, - 74D448797F75450289FF6091 /* libRNSVG.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2D02E4781E0B4A5D006451C7 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 2D02E4C91E0B4AEC006451C7 /* libReact.a in Frameworks */, + 2D02E4C21E0B4AEC006451C7 /* libRCTAnimation.a in Frameworks */, + 2D02E4C31E0B4AEC006451C7 /* libRCTImage-tvOS.a in Frameworks */, + 2D02E4C41E0B4AEC006451C7 /* libRCTLinking-tvOS.a in Frameworks */, + 2D02E4C51E0B4AEC006451C7 /* libRCTNetwork-tvOS.a in Frameworks */, + 2D02E4C61E0B4AEC006451C7 /* libRCTSettings-tvOS.a in Frameworks */, + 2D02E4C71E0B4AEC006451C7 /* libRCTText-tvOS.a in Frameworks */, + 2D02E4C81E0B4AEC006451C7 /* libRCTWebSocket-tvOS.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2D02E48D1E0B4A5D006451C7 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( ); runOnlyForDeploymentPostprocessing = 0; }; @@ -255,7 +339,7 @@ isa = PBXGroup; children = ( 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */, - 14ADC4DA1E0A68E1009D91E1 /* libRCTImage-tvOS.a */, + 3DAD3E841DF850E9000B6D8A /* libRCTImage-tvOS.a */, ); name = Products; sourceTree = ""; @@ -264,7 +348,7 @@ isa = PBXGroup; children = ( 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */, - 14ADC4E21E0A68E1009D91E1 /* libRCTNetwork-tvOS.a */, + 3DAD3E8C1DF850E9000B6D8A /* libRCTNetwork-tvOS.a */, ); name = Products; sourceTree = ""; @@ -298,7 +382,7 @@ isa = PBXGroup; children = ( 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */, - 14ADC4E61E0A68E1009D91E1 /* libRCTSettings-tvOS.a */, + 3DAD3E901DF850E9000B6D8A /* libRCTSettings-tvOS.a */, ); name = Products; sourceTree = ""; @@ -307,7 +391,7 @@ isa = PBXGroup; children = ( 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */, - 14ADC4EF1E0A68E1009D91E1 /* libRCTWebSocket-tvOS.a */, + 3DAD3E991DF850E9000B6D8A /* libRCTWebSocket-tvOS.a */, ); name = Products; sourceTree = ""; @@ -330,24 +414,30 @@ isa = PBXGroup; children = ( 146834041AC3E56700842450 /* libReact.a */, - 14ADC4F31E0A68E1009D91E1 /* libReact-tvOS.a */, + 3DAD3EA31DF850E9000B6D8A /* libReact.a */, + 3DAD3EA51DF850E9000B6D8A /* libyoga.a */, + 3DAD3EA71DF850E9000B6D8A /* libyoga.a */, + 3DAD3EA91DF850E9000B6D8A /* libcxxreact.a */, + 3DAD3EAB1DF850E9000B6D8A /* libcxxreact.a */, + 3DAD3EAD1DF850E9000B6D8A /* libjschelpers.a */, + 3DAD3EAF1DF850E9000B6D8A /* libjschelpers.a */, ); name = Products; sourceTree = ""; }; - 14ADC4D11E0A68E1009D91E1 /* Products */ = { + 5E91572E1DD0AC6500FF2AA8 /* Products */ = { isa = PBXGroup; children = ( - 14ADC4F61E0A68E1009D91E1 /* libRNSVG.a */, + 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */, + 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation.a */, ); name = Products; sourceTree = ""; }; - 5E91572E1DD0AC6500FF2AA8 /* Products */ = { + 5EFAC5CA1EDC8ABB004B239F /* Products */ = { isa = PBXGroup; children = ( - 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */, - 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation-tvOS.a */, + 5EFAC5CE1EDC8ABB004B239F /* libART.a */, ); name = Products; sourceTree = ""; @@ -356,7 +446,7 @@ isa = PBXGroup; children = ( 78C398B91ACF4ADC00677621 /* libRCTLinking.a */, - 14ADC4DE1E0A68E1009D91E1 /* libRCTLinking-tvOS.a */, + 3DAD3E881DF850E9000B6D8A /* libRCTLinking-tvOS.a */, ); name = Products; sourceTree = ""; @@ -364,6 +454,7 @@ 832341AE1AAA6A7D00B99B32 /* Libraries */ = { isa = PBXGroup; children = ( + 5EFAC5C91EDC8ABB004B239F /* ART.xcodeproj */, 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */, 146833FF1AC3E56700842450 /* React.xcodeproj */, 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */, @@ -375,7 +466,6 @@ 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */, 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */, 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */, - 1C3B12080F224062AE08DAEC /* RNSVG.xcodeproj */, ); name = Libraries; sourceTree = ""; @@ -384,7 +474,7 @@ isa = PBXGroup; children = ( 832341B51AAA6A8300B99B32 /* libRCTText.a */, - 14ADC4EA1E0A68E1009D91E1 /* libRCTText-tvOS.a */, + 3DAD3E941DF850E9000B6D8A /* libRCTText-tvOS.a */, ); name = Products; sourceTree = ""; @@ -406,6 +496,8 @@ children = ( 13B07F961A680F5B00A75B9A /* Example.app */, 00E356EE1AD99517003FC87E /* ExampleTests.xctest */, + 2D02E47B1E0B4A5D006451C7 /* Example-tvOS.app */, + 2D02E4901E0B4A5D006451C7 /* Example-tvOSTests.xctest */, ); name = Products; sourceTree = ""; @@ -449,19 +541,64 @@ productReference = 13B07F961A680F5B00A75B9A /* Example.app */; productType = "com.apple.product-type.application"; }; + 2D02E47A1E0B4A5D006451C7 /* Example-tvOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2D02E4BA1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "Example-tvOS" */; + buildPhases = ( + 2D02E4771E0B4A5D006451C7 /* Sources */, + 2D02E4781E0B4A5D006451C7 /* Frameworks */, + 2D02E4791E0B4A5D006451C7 /* Resources */, + 2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "Example-tvOS"; + productName = "Example-tvOS"; + productReference = 2D02E47B1E0B4A5D006451C7 /* Example-tvOS.app */; + productType = "com.apple.product-type.application"; + }; + 2D02E48F1E0B4A5D006451C7 /* Example-tvOSTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2D02E4BB1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "Example-tvOSTests" */; + buildPhases = ( + 2D02E48C1E0B4A5D006451C7 /* Sources */, + 2D02E48D1E0B4A5D006451C7 /* Frameworks */, + 2D02E48E1E0B4A5D006451C7 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 2D02E4921E0B4A5D006451C7 /* PBXTargetDependency */, + ); + name = "Example-tvOSTests"; + productName = "Example-tvOSTests"; + productReference = 2D02E4901E0B4A5D006451C7 /* Example-tvOSTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 83CBB9F71A601CBA00E9B192 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 610; + LastUpgradeCheck = 0610; ORGANIZATIONNAME = Facebook; TargetAttributes = { 00E356ED1AD99517003FC87E = { CreatedOnToolsVersion = 6.2; TestTargetID = 13B07F861A680F5B00A75B9A; }; + 2D02E47A1E0B4A5D006451C7 = { + CreatedOnToolsVersion = 8.2.1; + ProvisioningStyle = Automatic; + }; + 2D02E48F1E0B4A5D006451C7 = { + CreatedOnToolsVersion = 8.2.1; + ProvisioningStyle = Automatic; + TestTargetID = 2D02E47A1E0B4A5D006451C7; + }; }; }; buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "Example" */; @@ -476,6 +613,10 @@ productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; projectDirPath = ""; projectReferences = ( + { + ProductGroup = 5EFAC5CA1EDC8ABB004B239F /* Products */; + ProjectRef = 5EFAC5C91EDC8ABB004B239F /* ART.xcodeproj */; + }, { ProductGroup = 00C302A81ABCB8CE00DB3ED1 /* Products */; ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; @@ -520,15 +661,13 @@ ProductGroup = 146834001AC3E56700842450 /* Products */; ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */; }, - { - ProductGroup = 14ADC4D11E0A68E1009D91E1 /* Products */; - ProjectRef = 1C3B12080F224062AE08DAEC /* RNSVG.xcodeproj */; - }, ); projectRoot = ""; targets = ( 13B07F861A680F5B00A75B9A /* Example */, 00E356ED1AD99517003FC87E /* ExampleTests */, + 2D02E47A1E0B4A5D006451C7 /* Example-tvOS */, + 2D02E48F1E0B4A5D006451C7 /* Example-tvOSTests */, ); }; /* End PBXProject section */ @@ -590,60 +729,95 @@ remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 14ADC4DA1E0A68E1009D91E1 /* libRCTImage-tvOS.a */ = { + 3DAD3E841DF850E9000B6D8A /* libRCTImage-tvOS.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; path = "libRCTImage-tvOS.a"; - remoteRef = 14ADC4D91E0A68E1009D91E1 /* PBXContainerItemProxy */; + remoteRef = 3DAD3E831DF850E9000B6D8A /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 14ADC4DE1E0A68E1009D91E1 /* libRCTLinking-tvOS.a */ = { + 3DAD3E881DF850E9000B6D8A /* libRCTLinking-tvOS.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; path = "libRCTLinking-tvOS.a"; - remoteRef = 14ADC4DD1E0A68E1009D91E1 /* PBXContainerItemProxy */; + remoteRef = 3DAD3E871DF850E9000B6D8A /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 14ADC4E21E0A68E1009D91E1 /* libRCTNetwork-tvOS.a */ = { + 3DAD3E8C1DF850E9000B6D8A /* libRCTNetwork-tvOS.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; path = "libRCTNetwork-tvOS.a"; - remoteRef = 14ADC4E11E0A68E1009D91E1 /* PBXContainerItemProxy */; + remoteRef = 3DAD3E8B1DF850E9000B6D8A /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 14ADC4E61E0A68E1009D91E1 /* libRCTSettings-tvOS.a */ = { + 3DAD3E901DF850E9000B6D8A /* libRCTSettings-tvOS.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; path = "libRCTSettings-tvOS.a"; - remoteRef = 14ADC4E51E0A68E1009D91E1 /* PBXContainerItemProxy */; + remoteRef = 3DAD3E8F1DF850E9000B6D8A /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 14ADC4EA1E0A68E1009D91E1 /* libRCTText-tvOS.a */ = { + 3DAD3E941DF850E9000B6D8A /* libRCTText-tvOS.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; path = "libRCTText-tvOS.a"; - remoteRef = 14ADC4E91E0A68E1009D91E1 /* PBXContainerItemProxy */; + remoteRef = 3DAD3E931DF850E9000B6D8A /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 14ADC4EF1E0A68E1009D91E1 /* libRCTWebSocket-tvOS.a */ = { + 3DAD3E991DF850E9000B6D8A /* libRCTWebSocket-tvOS.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; path = "libRCTWebSocket-tvOS.a"; - remoteRef = 14ADC4EE1E0A68E1009D91E1 /* PBXContainerItemProxy */; + remoteRef = 3DAD3E981DF850E9000B6D8A /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 3DAD3EA31DF850E9000B6D8A /* libReact.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libReact.a; + remoteRef = 3DAD3EA21DF850E9000B6D8A /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 14ADC4F31E0A68E1009D91E1 /* libReact-tvOS.a */ = { + 3DAD3EA51DF850E9000B6D8A /* libyoga.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; - path = "libReact-tvOS.a"; - remoteRef = 14ADC4F21E0A68E1009D91E1 /* PBXContainerItemProxy */; + path = libyoga.a; + remoteRef = 3DAD3EA41DF850E9000B6D8A /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 14ADC4F61E0A68E1009D91E1 /* libRNSVG.a */ = { + 3DAD3EA71DF850E9000B6D8A /* libyoga.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; - path = libRNSVG.a; - remoteRef = 14ADC4F51E0A68E1009D91E1 /* PBXContainerItemProxy */; + path = libyoga.a; + remoteRef = 3DAD3EA61DF850E9000B6D8A /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 3DAD3EA91DF850E9000B6D8A /* libcxxreact.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libcxxreact.a; + remoteRef = 3DAD3EA81DF850E9000B6D8A /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 3DAD3EAB1DF850E9000B6D8A /* libcxxreact.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libcxxreact.a; + remoteRef = 3DAD3EAA1DF850E9000B6D8A /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 3DAD3EAD1DF850E9000B6D8A /* libjschelpers.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libjschelpers.a; + remoteRef = 3DAD3EAC1DF850E9000B6D8A /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 3DAD3EAF1DF850E9000B6D8A /* libjschelpers.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libjschelpers.a; + remoteRef = 3DAD3EAE1DF850E9000B6D8A /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */ = { @@ -653,13 +827,20 @@ remoteRef = 5E9157321DD0AC6500FF2AA8 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation-tvOS.a */ = { + 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; - path = "libRCTAnimation-tvOS.a"; + path = libRCTAnimation.a; remoteRef = 5E9157341DD0AC6500FF2AA8 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + 5EFAC5CE1EDC8ABB004B239F /* libART.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libART.a; + remoteRef = 5EFAC5CD1EDC8ABB004B239F /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; 78C398B91ACF4ADC00677621 /* libRCTLinking.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; @@ -693,6 +874,21 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 2D02E4791E0B4A5D006451C7 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2D02E4BD1E0B4A84006451C7 /* Images.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2D02E48E1E0B4A5D006451C7 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ @@ -710,6 +906,20 @@ shellPath = /bin/sh; shellScript = "export NODE_BINARY=node\n../node_modules/react-native/packager/react-native-xcode.sh"; }; + 2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Bundle React Native Code And Images"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "export NODE_BINARY=node\n../node_modules/react-native/packager/react-native-xcode.sh"; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -730,6 +940,23 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 2D02E4771E0B4A5D006451C7 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2D02E4BF1E0B4AB3006451C7 /* main.m in Sources */, + 2D02E4BC1E0B4A80006451C7 /* AppDelegate.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2D02E48C1E0B4A5D006451C7 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2DCD954D1E0B4F2C00145EB5 /* ExampleTests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ @@ -738,6 +965,11 @@ target = 13B07F861A680F5B00A75B9A /* Example */; targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */; }; + 2D02E4921E0B4A5D006451C7 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 2D02E47A1E0B4A5D006451C7 /* Example-tvOS */; + targetProxy = 2D02E4911E0B4A5D006451C7 /* PBXContainerItemProxy */; + }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ @@ -764,9 +996,9 @@ INFOPLIST_FILE = ExampleTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)/$(TARGET_NAME)\"", + OTHER_LDFLAGS = ( + "-ObjC", + "-lc++", ); PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example"; @@ -781,9 +1013,9 @@ INFOPLIST_FILE = ExampleTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)/$(TARGET_NAME)\"", + OTHER_LDFLAGS = ( + "-ObjC", + "-lc++", ); PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example"; @@ -825,6 +1057,100 @@ }; name = Release; }; + 2D02E4971E0B4A5E006451C7 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; + ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + CLANG_ANALYZER_NONNULL = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_TESTABILITY = YES; + GCC_NO_COMMON_BLOCKS = YES; + INFOPLIST_FILE = "Example-tvOS/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + OTHER_LDFLAGS = ( + "-ObjC", + "-lc++", + ); + PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.Example-tvOS"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.2; + }; + name = Debug; + }; + 2D02E4981E0B4A5E006451C7 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; + ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + CLANG_ANALYZER_NONNULL = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_NO_COMMON_BLOCKS = YES; + INFOPLIST_FILE = "Example-tvOS/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + OTHER_LDFLAGS = ( + "-ObjC", + "-lc++", + ); + PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.Example-tvOS"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.2; + }; + name = Release; + }; + 2D02E4991E0B4A5E006451C7 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_ANALYZER_NONNULL = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_TESTABILITY = YES; + GCC_NO_COMMON_BLOCKS = YES; + INFOPLIST_FILE = "Example-tvOSTests/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.Example-tvOSTests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example-tvOS.app/Example-tvOS"; + TVOS_DEPLOYMENT_TARGET = 10.1; + }; + name = Debug; + }; + 2D02E49A1E0B4A5E006451C7 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_ANALYZER_NONNULL = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_NO_COMMON_BLOCKS = YES; + INFOPLIST_FILE = "Example-tvOSTests/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.Example-tvOSTests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example-tvOS.app/Example-tvOS"; + TVOS_DEPLOYMENT_TARGET = 10.1; + }; + name = Release; + }; 83CBBA201A601CBA00E9B192 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -859,12 +1185,6 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "$(SRCROOT)/../node_modules/react-native/React/**", - "$(SRCROOT)/../node_modules/react-native/ReactCommon/**", - "$(SRCROOT)/../node_modules/react-native-svg/ios/**", - ); IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; @@ -900,12 +1220,6 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "$(SRCROOT)/../node_modules/react-native/React/**", - "$(SRCROOT)/../node_modules/react-native/ReactCommon/**", - "$(SRCROOT)/../node_modules/react-native-svg/ios/**", - ); IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; @@ -934,6 +1248,24 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 2D02E4BA1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "Example-tvOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2D02E4971E0B4A5E006451C7 /* Debug */, + 2D02E4981E0B4A5E006451C7 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 2D02E4BB1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "Example-tvOSTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2D02E4991E0B4A5E006451C7 /* Debug */, + 2D02E49A1E0B4A5E006451C7 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "Example" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/Example/ios/Example.xcodeproj/xcshareddata/xcschemes/Example-tvOS.xcscheme b/Example/ios/Example.xcodeproj/xcshareddata/xcschemes/Example-tvOS.xcscheme new file mode 100644 index 0000000..e2da6ac --- /dev/null +++ b/Example/ios/Example.xcodeproj/xcshareddata/xcschemes/Example-tvOS.xcscheme @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example/ios/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme b/Example/ios/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme index abcf8a6..273f724 100644 --- a/Example/ios/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme +++ b/Example/ios/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme @@ -3,9 +3,23 @@ LastUpgradeVersion = "0620" version = "1.3"> + + + + + shouldUseLaunchSchemeArgsEnv = "YES"> @@ -62,15 +76,18 @@ ReferencedContainer = "container:Example.xcodeproj"> + + @@ -86,10 +103,10 @@ diff --git a/Example/ios/Example/AppDelegate.m b/Example/ios/Example/AppDelegate.m index 9e648fd..80a9d62 100644 --- a/Example/ios/Example/AppDelegate.m +++ b/Example/ios/Example/AppDelegate.m @@ -9,8 +9,8 @@ #import "AppDelegate.h" -#import "RCTBundleURLProvider.h" -#import "RCTRootView.h" +#import +#import @implementation AppDelegate diff --git a/Example/ios/Example/Info.plist b/Example/ios/Example/Info.plist index 2835b13..0bf27a6 100644 --- a/Example/ios/Example/Info.plist +++ b/Example/ios/Example/Info.plist @@ -4,6 +4,8 @@ CFBundleDevelopmentRegion en + CFBundleDisplayName + Example CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier @@ -39,9 +41,8 @@ NSLocationWhenInUseUsageDescription NSAppTransportSecurity + - NSAllowsArbitraryLoads - NSExceptionDomains localhost diff --git a/Example/ios/ExampleTests/ExampleTests.m b/Example/ios/ExampleTests/ExampleTests.m index 4130f61..22ba225 100644 --- a/Example/ios/ExampleTests/ExampleTests.m +++ b/Example/ios/ExampleTests/ExampleTests.m @@ -10,8 +10,8 @@ #import #import -#import "RCTLog.h" -#import "RCTRootView.h" +#import +#import #define TIMEOUT_SECONDS 600 #define TEXT_TO_LOOK_FOR @"Welcome to React Native!" @@ -37,7 +37,7 @@ - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test - (void)testRendersWelcomeScreen { - UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController]; + UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController]; NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; BOOL foundElement = NO; diff --git a/Example/package.json b/Example/package.json index 262728c..638b24e 100644 --- a/Example/package.json +++ b/Example/package.json @@ -3,20 +3,19 @@ "version": "0.0.1", "private": true, "scripts": { - "start": "node node_modules/react-native/local-cli/cli.js start", + "start": "node node_modules/react-native/local-cli/cli.js start --config=rn-cli.config.js", "test": "jest" }, "dependencies": { - "react": "15.4.1", - "react-native": "0.39.2", - "react-native-barcode-builder": "0.0.5", - "react-native-svg": "4.4.1" + "react": "16.0.0-alpha.6", + "react-native": "0.44.2", + "react-native-barcode-builder": "file:../" }, "devDependencies": { - "babel-jest": "18.0.0", - "babel-preset-react-native": "1.9.1", - "jest": "18.0.0", - "react-test-renderer": "15.4.1" + "babel-jest": "20.0.3", + "babel-preset-react-native": "1.9.2", + "jest": "20.0.4", + "react-test-renderer": "16.0.0-alpha.6" }, "jest": { "preset": "react-native" diff --git a/Example/rn-cli.config.js b/Example/rn-cli.config.js new file mode 100644 index 0000000..ab79e45 --- /dev/null +++ b/Example/rn-cli.config.js @@ -0,0 +1,13 @@ +/** + * React Native CLI configuration file. + * Make it possible to run example by starting the packager. + */ + +const blacklist = require('react-native/packager/blacklist'); +const config = require('react-native/packager/rn-cli.config'); + +config.getBlacklistRE = () => blacklist([ + new RegExp('node_modules/react-native-barcode-builder/Example/node_modules/(.*)'), +]); + +module.exports = config; diff --git a/README.md b/README.md index 9234daa..f3ac537 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,24 @@ # react-native-barcode-builder -A component for react native to generate barcode. Inspired by [JsBarcode](https://github.com/lindell/JsBarcode), depend on [react-native-svg](https://github.com/react-native-community/react-native-svg)。 +A component for react native to generate barcode. Inspired by [JsBarcode](https://github.com/lindell/JsBarcode). ## Getting started #### Step 1 -Install react-native-svg - -`npm install react-native-svg --save && react-native link react-native-svg` +Link React ART; open the Xcode project, and drag `ART.xcodeproj` from `node_modules/react-native/Libraries/ART/` into the `Libraries` group in Xcode. +Then select the root project and select "Build Phases" from the center view. There will be a section called "Link Binary With Libraries", expand it, press the + and select `libART.a`. #### Step 2 + Install react-native-barcode-builder `npm install react-native-barcode-builder --save` #### Step 3 + Start using the component ```javascript @@ -50,38 +51,38 @@ format: PropTypes.oneOf([ - + - + - + - + - + - + - + - + - +
PropertyDescriptionDescription
valueWhat the barcode stands for (required).What the barcode stands for (required).
formatWhich barcode type to use (default: CODE128).Which barcode type to use (default: CODE128).
textOverride text that is displayed.Override text that is displayed.
widthWidth of a single bar (default: 2)Width of a single bar (default: 2)
heightHeight of the barcode (default: 100)Height of the barcode (default: 100)
lineColorColor of the bars and text (default: #000000)Color of the bars and text (default: #000000)
backgroundBackground color of the barcode (default: #ffffff)Background color of the barcode (default: #ffffff)
onErrorHandler for invalid barcode of selected formatHandler for invalid barcode of selected format
diff --git a/barcodes/Barcode.js b/barcodes/Barcode.js deleted file mode 100755 index 89a55e0..0000000 --- a/barcodes/Barcode.js +++ /dev/null @@ -1,9 +0,0 @@ -class Barcode{ - constructor(data, options){ - this.data = data; - this.text = options.text || data; - this.options = options; - } -} - -export default Barcode; diff --git a/barcodes/CODE128/CODE128.js b/barcodes/CODE128/CODE128.js deleted file mode 100755 index 7e53b9f..0000000 --- a/barcodes/CODE128/CODE128.js +++ /dev/null @@ -1,230 +0,0 @@ -// This is the master class, it does require the start code to be -// included in the string - -import Barcode from "../Barcode.js"; - -class CODE128 extends Barcode{ - constructor(data, options){ - super(data.substring(1), options); - - // Fill the bytes variable with the ascii codes of string - this.bytes = []; - for (var i = 0; i < data.length; ++i) { - this.bytes.push(data.charCodeAt(i)); - } - - // Data for each character, the last characters will not be encoded but are used for error correction - // Numbers encode to (n + 1000) -> binary; 740 -> (740 + 1000).toString(2) -> "11011001100" - this.encodings = [ // + 1000 - 740, 644, 638, 176, 164, 100, 224, 220, 124, 608, 604, - 572, 436, 244, 230, 484, 260, 254, 650, 628, 614, 764, - 652, 902, 868, 836, 830, 892, 844, 842, 752, 734, 590, - 304, 112, 94, 416, 128, 122, 672, 576, 570, 464, 422, - 134, 496, 478, 142, 910, 678, 582, 768, 762, 774, 880, - 862, 814, 896, 890, 818, 914, 602, 930, 328, 292, 200, - 158, 68, 62, 424, 412, 232, 218, 76, 74, 554, 616, - 978, 556, 146, 340, 212, 182, 508, 268, 266, 956, 940, - 938, 758, 782, 974, 400, 310, 118, 512, 506, 960, 954, - 502, 518, 886, 966, /* Start codes */ 668, 680, 692, - 5379 - ]; - } - - // The public encoding function - encode() { - var encodingResult; - var bytes = this.bytes; - // Remove the startcode from the bytes and set its index - var startIndex = bytes.shift() - 105; - - // Start encode with the right type - if(startIndex === 103){ - encodingResult = this.nextA(bytes, 1); - } - else if(startIndex === 104){ - encodingResult = this.nextB(bytes, 1); - } - else if(startIndex === 105){ - encodingResult = this.nextC(bytes, 1); - } - else{ - throw new InvalidStartCharacterException(); - } - - return { - text: this.text == this.data ? this.text.replace(/[^\x20-\x7E]/g, "") : this.text, - data: - // Add the start bits - this.getEncoding(startIndex) + - // Add the encoded bits - encodingResult.result + - // Add the checksum - this.getEncoding((encodingResult.checksum + startIndex) % 103) + - // Add the end bits - this.getEncoding(106) - }; - } - - getEncoding(n) { - return (this.encodings[n] ? (this.encodings[n] + 1000).toString(2) : ''); - } - - // Use the regexp variable for validation - valid() { - // ASCII value ranges 0-127, 200-211 - return this.data.search(/^[\x00-\x7F\xC8-\xD3]+$/) !== -1; - } - - nextA(bytes, depth){ - if(bytes.length <= 0){ - return {"result": "", "checksum": 0}; - } - - var next, index; - - // Special characters - if(bytes[0] >= 200){ - index = bytes[0] - 105; - - // Remove first element - bytes.shift(); - - // Swap to CODE128C - if(index === 99){ - next = this.nextC(bytes, depth + 1); - } - // Swap to CODE128B - else if(index === 100){ - next = this.nextB(bytes, depth + 1); - } - // Shift - else if(index === 98){ - // Convert the next character so that is encoded correctly - bytes[0] = bytes[0] > 95 ? bytes[0] - 96 : bytes[0]; - next = this.nextA(bytes, depth + 1); - } - // Continue on CODE128A but encode a special character - else{ - next = this.nextA(bytes, depth + 1); - } - } - // Continue encoding of CODE128A - else{ - var charCode = bytes[0]; - index = charCode < 32 ? charCode + 64 : charCode - 32; - - // Remove first element - bytes.shift(); - - next = this.nextA(bytes, depth + 1); - } - - // Get the correct binary encoding and calculate the weight - var enc = this.getEncoding(index); - var weight = index * depth; - - return { - "result": enc + next.result, - "checksum": weight + next.checksum - }; - } - - nextB(bytes, depth){ - if(bytes.length <= 0){ - return {"result": "", "checksum": 0}; - } - - var next, index; - - // Special characters - if(bytes[0] >= 200){ - index = bytes[0] - 105; - - // Remove first element - bytes.shift(); - - // Swap to CODE128C - if(index === 99){ - next = this.nextC(bytes, depth + 1); - } - // Swap to CODE128A - else if(index === 101){ - next = this.nextA(bytes, depth + 1); - } - // Shift - else if(index === 98){ - // Convert the next character so that is encoded correctly - bytes[0] = bytes[0] < 32 ? bytes[0] + 96 : bytes[0]; - next = this.nextB(bytes, depth + 1); - } - // Continue on CODE128B but encode a special character - else{ - next = this.nextB(bytes, depth + 1); - } - } - // Continue encoding of CODE128B - else { - index = bytes[0] - 32; - bytes.shift(); - next = this.nextB(bytes, depth + 1); - } - - // Get the correct binary encoding and calculate the weight - var enc = this.getEncoding(index); - var weight = index * depth; - - return {"result": enc + next.result, "checksum": weight + next.checksum}; - } - - nextC(bytes, depth){ - if(bytes.length <= 0){ - return {"result": "", "checksum": 0}; - } - - var next, index; - - // Special characters - if(bytes[0] >= 200){ - index = bytes[0] - 105; - - // Remove first element - bytes.shift(); - - // Swap to CODE128B - if(index === 100){ - next = this.nextB(bytes, depth + 1); - } - // Swap to CODE128A - else if(index === 101){ - next = this.nextA(bytes, depth + 1); - } - // Continue on CODE128C but encode a special character - else{ - next = this.nextC(bytes, depth + 1); - } - } - // Continue encoding of CODE128C - else{ - index = (bytes[0] - 48) * 10 + bytes[1] - 48; - bytes.shift(); - bytes.shift(); - next = this.nextC(bytes, depth + 1); - } - - // Get the correct binary encoding and calculate the weight - var enc = this.getEncoding(index); - var weight = index * depth; - - return {"result": enc + next.result, "checksum": weight + next.checksum}; - } -} - -class InvalidStartCharacterException extends Error{ - constructor() { - super(); - this.name = "InvalidStartCharacterException"; - this.message = "The encoding does not start with a start character."; - } -} - -export default CODE128; diff --git a/barcodes/CODE128/CODE128A.js b/barcodes/CODE128/CODE128A.js deleted file mode 100755 index c1ebc7e..0000000 --- a/barcodes/CODE128/CODE128A.js +++ /dev/null @@ -1,13 +0,0 @@ -import CODE128 from './CODE128.js'; - -class CODE128A extends CODE128{ - constructor(string, options){ - super(String.fromCharCode(208) + string, options); - } - - valid(){ - return this.data.search(/^[\x00-\x5F\xC8-\xCF]+$/) !== -1; - } -} - -export default CODE128A; diff --git a/barcodes/CODE128/CODE128B.js b/barcodes/CODE128/CODE128B.js deleted file mode 100755 index 58d3422..0000000 --- a/barcodes/CODE128/CODE128B.js +++ /dev/null @@ -1,13 +0,0 @@ -import CODE128 from './CODE128.js'; - -class CODE128B extends CODE128{ - constructor(string, options){ - super(String.fromCharCode(209) + string, options); - } - - valid(){ - return this.data.search(/^[\x20-\x7F\xC8-\xCF]+$/) !== -1; - } -} - -export default CODE128B; diff --git a/barcodes/CODE128/CODE128C.js b/barcodes/CODE128/CODE128C.js deleted file mode 100755 index 7b3a3c2..0000000 --- a/barcodes/CODE128/CODE128C.js +++ /dev/null @@ -1,13 +0,0 @@ -import CODE128 from './CODE128.js'; - -class CODE128C extends CODE128{ - constructor(string, options){ - super(String.fromCharCode(210) + string, options); - } - - valid(){ - return this.data.search(/^(\xCF*[0-9]{2}\xCF*)+$/) !== -1; - } -} - -export default CODE128C; diff --git a/barcodes/CODE128/CODE128_AUTO.js b/barcodes/CODE128/CODE128_AUTO.js deleted file mode 100755 index c86ef48..0000000 --- a/barcodes/CODE128/CODE128_AUTO.js +++ /dev/null @@ -1,95 +0,0 @@ -import CODE128 from './CODE128.js'; - -class CODE128AUTO extends CODE128{ - constructor(data, options){ - // ASCII value ranges 0-127, 200-211 - if(data.search(/^[\x00-\x7F\xC8-\xD3]+$/) !== -1){ - super(autoSelectModes(data), options); - } - else{ - super(data, options); - } - } -} - -function autoSelectModes(string){ - // ASCII ranges 0-98 and 200-207 (FUNCs and SHIFTs) - var aLength = string.match(/^[\x00-\x5F\xC8-\xCF]*/)[0].length; - // ASCII ranges 32-127 and 200-207 (FUNCs and SHIFTs) - var bLength = string.match(/^[\x20-\x7F\xC8-\xCF]*/)[0].length; - // Number pairs or [FNC1] - var cLength = string.match(/^(\xCF*[0-9]{2}\xCF*)*/)[0].length; - - var newString; - // Select CODE128C if the string start with enough digits - if(cLength >= 2){ - newString = String.fromCharCode(210) + autoSelectFromC(string); - } - // Select A/C depending on the longest match - else if(aLength > bLength){ - newString = String.fromCharCode(208) + autoSelectFromA(string); - } - else{ - newString = String.fromCharCode(209) + autoSelectFromB(string); - } - - newString = newString.replace(/[\xCD\xCE]([^])[\xCD\xCE]/, function(match, char){ - return String.fromCharCode(203) + char; - }); - - return newString; -} - -function autoSelectFromA(string){ - var untilC = string.match(/^([\x00-\x5F\xC8-\xCF]+?)(([0-9]{2}){2,})([^0-9]|$)/); - - if(untilC){ - return untilC[1] + String.fromCharCode(204) + autoSelectFromC(string.substring(untilC[1].length)); - } - - var aChars = string.match(/^[\x00-\x5F\xC8-\xCF]+/); - if(aChars[0].length === string.length){ - return string; - } - - return aChars[0] + String.fromCharCode(205) + autoSelectFromB(string.substring(aChars[0].length)); -} - -function autoSelectFromB(string){ - var untilC = string.match(/^([\x20-\x7F\xC8-\xCF]+?)(([0-9]{2}){2,})([^0-9]|$)/); - - if(untilC){ - return untilC[1] + String.fromCharCode(204) + autoSelectFromC(string.substring(untilC[1].length)); - } - - var bChars = string.match(/^[\x20-\x7F\xC8-\xCF]+/); - if(bChars[0].length === string.length){ - return string; - } - - return bChars[0] + String.fromCharCode(206) + autoSelectFromA(string.substring(bChars[0].length)); -} - - -function autoSelectFromC(string){ - var cMatch = string.match(/^(\xCF*[0-9]{2}\xCF*)+/)[0]; - var length = cMatch.length; - - if(length === string.length){ - return string; - } - - string = string.substring(length); - - // Select A/B depending on the longest match - var aLength = string.match(/^[\x00-\x5F\xC8-\xCF]*/)[0].length; - var bLength = string.match(/^[\x20-\x7F\xC8-\xCF]*/)[0].length; - if(aLength >= bLength){ - return cMatch + String.fromCharCode(206) + autoSelectFromA(string); - } - else{ - return cMatch + String.fromCharCode(205) + autoSelectFromB(string); - } -} - -export default CODE128AUTO; diff --git a/barcodes/CODE128/index.js b/barcodes/CODE128/index.js deleted file mode 100755 index e45411d..0000000 --- a/barcodes/CODE128/index.js +++ /dev/null @@ -1,6 +0,0 @@ -import CODE128 from './CODE128_AUTO.js'; -import CODE128A from './CODE128A.js'; -import CODE128B from './CODE128B.js'; -import CODE128C from './CODE128C.js'; - -export {CODE128, CODE128A, CODE128B, CODE128C}; diff --git a/barcodes/CODE39/index.js b/barcodes/CODE39/index.js deleted file mode 100755 index e793a6a..0000000 --- a/barcodes/CODE39/index.js +++ /dev/null @@ -1,105 +0,0 @@ -// Encoding documentation: -// https://en.wikipedia.org/wiki/Code_39#Encoding - -import Barcode from "../Barcode.js"; - -class CODE39 extends Barcode { - constructor(data, options){ - data = data.toUpperCase(); - - // Calculate mod43 checksum if enabled - if(options.mod43){ - data += getCharacter(mod43checksum(data)); - } - - super(data, options); - } - - encode(){ - // First character is always a * - var result = getEncoding("*"); - - // Take every character and add the binary representation to the result - for(let i = 0; i < this.data.length; i++){ - result += getEncoding(this.data[i]) + "0"; - } - - // Last character is always a * - result += getEncoding("*"); - - return { - data: result, - text: this.text - }; - } - - valid(){ - return this.data.search(/^[0-9A-Z\-\.\ \$\/\+\%]+$/) !== -1; - } -} - - - - - - -// All characters. The position in the array is the (checksum) value -var characters = [ - "0", "1", "2", "3", - "4", "5", "6", "7", - "8", "9", "A", "B", - "C", "D", "E", "F", - "G", "H", "I", "J", - "K", "L", "M", "N", - "O", "P", "Q", "R", - "S", "T", "U", "V", - "W", "X", "Y", "Z", - "-", ".", " ", "$", - "/", "+", "%", "*" -]; - -// The decimal representation of the characters, is converted to the -// corresponding binary with the getEncoding function -var encodings = [ - 20957, 29783, 23639, 30485, - 20951, 29813, 23669, 20855, - 29789, 23645, 29975, 23831, - 30533, 22295, 30149, 24005, - 21623, 29981, 23837, 22301, - 30023, 23879, 30545, 22343, - 30161, 24017, 21959, 30065, - 23921, 22385, 29015, 18263, - 29141, 17879, 29045, 18293, - 17783, 29021, 18269, 17477, - 17489, 17681, 20753, 35770 -]; - -// Get the binary representation of a character by converting the encodings -// from decimal to binary -function getEncoding(character){ - return getBinary(characterValue(character)); -} - -function getBinary(characterValue){ - return encodings[characterValue].toString(2); -} - -function getCharacter(characterValue){ - return characters[characterValue]; -} - -function characterValue(character){ - return characters.indexOf(character); -} - -function mod43checksum(data){ - var checksum = 0; - for(let i = 0; i < data.length; i++){ - checksum += characterValue(data[i]); - } - - checksum = checksum % 43; - return checksum; -} - -export {CODE39}; diff --git a/barcodes/EAN_UPC/EAN13.js b/barcodes/EAN_UPC/EAN13.js deleted file mode 100755 index aa126a9..0000000 --- a/barcodes/EAN_UPC/EAN13.js +++ /dev/null @@ -1,162 +0,0 @@ -// Encoding documentation: -// https://en.wikipedia.org/wiki/International_Article_Number_(EAN)#Binary_encoding_of_data_digits_into_EAN-13_barcode - -import EANencoder from './ean_encoder.js'; -import Barcode from "../Barcode.js"; - -class EAN13 extends Barcode{ - constructor(data, options){ - // Add checksum if it does not exist - if(data.search(/^[0-9]{12}$/) !== -1){ - data += checksum(data); - } - - super(data, options); - - // Make sure the font is not bigger than the space between the guard bars - if(!options.flat && options.fontSize > options.width * 10){ - this.fontSize = options.width * 10; - } - else{ - this.fontSize = options.fontSize; - } - - // Make the guard bars go down half the way of the text - this.guardHeight = options.height + this.fontSize / 2 + options.textMargin; - - // Adds a last character to the end of the barcode - this.lastChar = options.lastChar; - } - - valid(){ - return this.data.search(/^[0-9]{13}$/) !== -1 && - this.data[12] == checksum(this.data); - } - - encode(){ - if(this.options.flat){ - return this.flatEncoding(); - } - else{ - return this.guardedEncoding(); - } - } - - // Define the EAN-13 structure - getStructure(){ - return [ - "LLLLLL", - "LLGLGG", - "LLGGLG", - "LLGGGL", - "LGLLGG", - "LGGLLG", - "LGGGLL", - "LGLGLG", - "LGLGGL", - "LGGLGL" - ]; - } - - // The "standard" way of printing EAN13 barcodes with guard bars - guardedEncoding(){ - var encoder = new EANencoder(); - var result = []; - - var structure = this.getStructure()[this.data[0]]; - - // Get the string to be encoded on the left side of the EAN code - var leftSide = this.data.substr(1, 6); - - // Get the string to be encoded on the right side of the EAN code - var rightSide = this.data.substr(7, 6); - - // Add the first digigt - if(this.options.displayValue){ - result.push({ - data: "000000000000", - text: this.text.substr(0, 1), - options: {textAlign: "left", fontSize: this.fontSize} - }); - } - - // Add the guard bars - result.push({ - data: "101", - options: {height: this.guardHeight} - }); - - // Add the left side - result.push({ - data: encoder.encode(leftSide, structure), - text: this.text.substr(1, 6), - options: {fontSize: this.fontSize} - }); - - // Add the middle bits - result.push({ - data: "01010", - options: {height: this.guardHeight} - }); - - // Add the right side - result.push({ - data: encoder.encode(rightSide, "RRRRRR"), - text: this.text.substr(7, 6), - options: {fontSize: this.fontSize} - }); - - // Add the end bits - result.push({ - data: "101", - options: {height: this.guardHeight} - }); - - if(this.options.lastChar && this.options.displayValue){ - result.push({data: "00"}); - - result.push({ - data: "00000", - text: this.options.lastChar, - options: {fontSize: this.fontSize} - }); - } - return result; - } - - flatEncoding(){ - var encoder = new EANencoder(); - var result = ""; - - var structure = this.getStructure()[this.data[0]]; - - result += "101"; - result += encoder.encode(this.data.substr(1, 6), structure); - result += "01010"; - result += encoder.encode(this.data.substr(7, 6), "RRRRRR"); - result += "101"; - - return { - data: result, - text: this.text - }; - } -} - -// Calulate the checksum digit -// https://en.wikipedia.org/wiki/International_Article_Number_(EAN)#Calculation_of_checksum_digit -function checksum(number){ - var result = 0; - - var i; - for(i = 0; i < 12; i += 2){ - result += parseInt(number[i]); - } - for(i = 1; i < 12; i += 2){ - result += parseInt(number[i]) * 3; - } - - return (10 - (result % 10)) % 10; -} - -export default EAN13; diff --git a/barcodes/EAN_UPC/EAN2.js b/barcodes/EAN_UPC/EAN2.js deleted file mode 100755 index 65035a1..0000000 --- a/barcodes/EAN_UPC/EAN2.js +++ /dev/null @@ -1,37 +0,0 @@ -// Encoding documentation: -// https://en.wikipedia.org/wiki/EAN_2#Encoding - -import EANencoder from './ean_encoder.js'; -import Barcode from "../Barcode.js"; - -class EAN2 extends Barcode{ - constructor(data, options){ - super(data, options); - - this.structure = ["LL", "LG", "GL", "GG"]; - } - - valid(){ - return this.data.search(/^[0-9]{2}$/) !== -1; - } - - encode(){ - var encoder = new EANencoder(); - - // Choose the structure based on the number mod 4 - var structure = this.structure[parseInt(this.data) % 4]; - - // Start bits - var result = "1011"; - - // Encode the two digits with 01 in between - result += encoder.encode(this.data, structure, "01"); - - return { - data: result, - text: this.text - }; - } -} - -export default EAN2; diff --git a/barcodes/EAN_UPC/EAN5.js b/barcodes/EAN_UPC/EAN5.js deleted file mode 100755 index a86ce0d..0000000 --- a/barcodes/EAN_UPC/EAN5.js +++ /dev/null @@ -1,59 +0,0 @@ -// Encoding documentation: -// https://en.wikipedia.org/wiki/EAN_5#Encoding - -import EANencoder from './ean_encoder.js'; -import Barcode from "../Barcode.js"; - -class EAN5 extends Barcode{ - constructor(data, options){ - super(data, options); - - // Define the EAN-13 structure - this.structure = [ - "GGLLL", - "GLGLL", - "GLLGL", - "GLLLG", - "LGGLL", - "LLGGL", - "LLLGG", - "LGLGL", - "LGLLG", - "LLGLG" - ]; - } - - valid(){ - return this.data.search(/^[0-9]{5}$/) !== -1; - } - - encode(){ - var encoder = new EANencoder(); - var checksum = this.checksum(); - - // Start bits - var result = "1011"; - - // Use normal ean encoding with 01 in between all digits - result += encoder.encode(this.data, this.structure[checksum], "01"); - - return { - data: result, - text: this.text - }; - } - - checksum(){ - var result = 0; - - result += parseInt(this.data[0]) * 3; - result += parseInt(this.data[1]) * 9; - result += parseInt(this.data[2]) * 3; - result += parseInt(this.data[3]) * 9; - result += parseInt(this.data[4]) * 3; - - return result % 10; - } -} - -export default EAN5; diff --git a/barcodes/EAN_UPC/EAN8.js b/barcodes/EAN_UPC/EAN8.js deleted file mode 100755 index 5d7f730..0000000 --- a/barcodes/EAN_UPC/EAN8.js +++ /dev/null @@ -1,72 +0,0 @@ -// Encoding documentation: -// http://www.barcodeisland.com/ean8.phtml - -import EANencoder from './ean_encoder.js'; -import Barcode from "../Barcode.js"; - -class EAN8 extends Barcode{ - constructor(data, options){ - // Add checksum if it does not exist - if(data.search(/^[0-9]{7}$/) !== -1){ - data += checksum(data); - } - - super(data, options); - } - - valid(){ - return this.data.search(/^[0-9]{8}$/) !== -1 && - this.data[7] == checksum(this.data); - } - - encode(){ - var encoder = new EANencoder(); - - // Create the return variable - var result = ""; - - // Get the number to be encoded on the left side of the EAN code - var leftSide = this.data.substr(0, 4); - - // Get the number to be encoded on the right side of the EAN code - var rightSide = this.data.substr(4, 4); - - // Add the start bits - result += encoder.startBin; - - // Add the left side - result += encoder.encode(leftSide, "LLLL"); - - // Add the middle bits - result += encoder.middleBin; - - // Add the right side - result += encoder.encode(rightSide, "RRRR"); - - // Add the end bits - result += encoder.endBin; - - return { - data: result, - text: this.text - }; - } -} - -// Calulate the checksum digit -function checksum(number){ - var result = 0; - - var i; - for(i = 0; i < 7; i += 2){ - result += parseInt(number[i]) * 3; - } - - for(i = 1; i < 7; i += 2){ - result += parseInt(number[i]); - } - - return (10 - (result % 10)) % 10; -} - -export default EAN8; diff --git a/barcodes/EAN_UPC/UPC.js b/barcodes/EAN_UPC/UPC.js deleted file mode 100755 index a09f085..0000000 --- a/barcodes/EAN_UPC/UPC.js +++ /dev/null @@ -1,134 +0,0 @@ -// Encoding documentation: -// https://en.wikipedia.org/wiki/Universal_Product_Code#Encoding - -import EANencoder from './ean_encoder.js'; -import Barcode from "../Barcode.js"; - -class UPC extends Barcode{ - constructor(data, options){ - // Add checksum if it does not exist - if(data.search(/^[0-9]{11}$/) !== -1){ - data += checksum(data); - } - - super(data, options); - - this.displayValue = options.displayValue; - - // Make sure the font is not bigger than the space between the guard bars - if(options.fontSize > options.width * 10){ - this.fontSize = options.width * 10; - } - else{ - this.fontSize = options.fontSize; - } - - // Make the guard bars go down half the way of the text - this.guardHeight = options.height + this.fontSize / 2 + options.textMargin; - } - - valid(){ - return this.data.search(/^[0-9]{12}$/) !== -1 && - this.data[11] == checksum(this.data); - } - - encode(){ - if(this.options.flat){ - return this.flatEncoding(); - } - else{ - return this.guardedEncoding(); - } - } - - flatEncoding(){ - var encoder = new EANencoder(); - var result = ""; - - result += "101"; - result += encoder.encode(this.data.substr(0, 6), "LLLLLL"); - result += "01010"; - result += encoder.encode(this.data.substr(6, 6), "RRRRRR"); - result += "101"; - - return { - data: result, - text: this.text - }; - } - - guardedEncoding(){ - var encoder = new EANencoder(); - var result = []; - - // Add the first digigt - if(this.displayValue){ - result.push({ - data: "00000000", - text: this.text.substr(0, 1), - options: {textAlign: "left", fontSize: this.fontSize} - }); - } - - // Add the guard bars - result.push({ - data: "101" + encoder.encode(this.data[0], "L"), - options: {height: this.guardHeight} - }); - - // Add the left side - result.push({ - data: encoder.encode(this.data.substr(1, 5), "LLLLL"), - text: this.text.substr(1, 5), - options: {fontSize: this.fontSize} - }); - - // Add the middle bits - result.push({ - data: "01010", - options: {height: this.guardHeight} - }); - - // Add the right side - result.push({ - data: encoder.encode(this.data.substr(6, 5), "RRRRR"), - text: this.text.substr(6, 5), - options: {fontSize: this.fontSize} - }); - - // Add the end bits - result.push({ - data: encoder.encode(this.data[11], "R") + "101", - options: {height: this.guardHeight} - }); - - // Add the last digit - if(this.displayValue){ - result.push({ - data: "00000000", - text: this.text.substr(11, 1), - options: {textAlign: "right", fontSize: this.fontSize} - }); - } - - return result; - } -} - -// Calulate the checksum digit -// https://en.wikipedia.org/wiki/International_Article_Number_(EAN)#Calculation_of_checksum_digit -function checksum(number){ - var result = 0; - - var i; - for(i = 1; i < 11; i += 2){ - result += parseInt(number[i]); - } - for(i = 0; i < 11; i += 2){ - result += parseInt(number[i]) * 3; - } - - return (10 - (result % 10)) % 10; -} - -export default UPC; diff --git a/barcodes/EAN_UPC/ean_encoder.js b/barcodes/EAN_UPC/ean_encoder.js deleted file mode 100755 index ccdbbd1..0000000 --- a/barcodes/EAN_UPC/ean_encoder.js +++ /dev/null @@ -1,81 +0,0 @@ -class EANencoder{ - constructor(){ - // Standard start end and middle bits - this.startBin = "101"; - this.endBin = "101"; - this.middleBin = "01010"; - - // The L (left) type of encoding - this.Lbinary = [ - "0001101", - "0011001", - "0010011", - "0111101", - "0100011", - "0110001", - "0101111", - "0111011", - "0110111", - "0001011" - ]; - - // The G type of encoding - this.Gbinary = [ - "0100111", - "0110011", - "0011011", - "0100001", - "0011101", - "0111001", - "0000101", - "0010001", - "0001001", - "0010111" - ]; - - // The R (right) type of encoding - this.Rbinary = [ - "1110010", - "1100110", - "1101100", - "1000010", - "1011100", - "1001110", - "1010000", - "1000100", - "1001000", - "1110100" - ]; - } - - // Convert a numberarray to the representing - encode(number, structure, separator){ - // Create the variable that should be returned at the end of the function - var result = ""; - - // Make sure that the separator is set - separator = separator || ""; - - // Loop all the numbers - for(var i = 0; i < number.length; i++){ - // Using the L, G or R encoding and add it to the returning variable - if(structure[i] == "L"){ - result += this.Lbinary[number[i]]; - } - else if(structure[i] == "G"){ - result += this.Gbinary[number[i]]; - } - else if(structure[i] == "R"){ - result += this.Rbinary[number[i]]; - } - - // Add separator in between encodings - if(i < number.length - 1){ - result += separator; - } - } - return result; - } -} - -export default EANencoder; diff --git a/barcodes/EAN_UPC/index.js b/barcodes/EAN_UPC/index.js deleted file mode 100755 index bee5c9a..0000000 --- a/barcodes/EAN_UPC/index.js +++ /dev/null @@ -1,7 +0,0 @@ -import EAN13 from './EAN13.js'; -import EAN8 from './EAN8.js'; -import EAN5 from './EAN5.js'; -import EAN2 from './EAN2.js'; -import UPC from './UPC.js'; - -export {EAN13, EAN8, EAN5, EAN2, UPC}; diff --git a/barcodes/GenericBarcode/index.js b/barcodes/GenericBarcode/index.js deleted file mode 100755 index c9c1f0e..0000000 --- a/barcodes/GenericBarcode/index.js +++ /dev/null @@ -1,22 +0,0 @@ -import Barcode from "../Barcode.js"; - -class GenericBarcode extends Barcode{ - constructor(data, options){ - super(data, options); // Sets this.data and this.text - } - - // Return the corresponding binary numbers for the data provided - encode(){ - return { - data: "10101010101010101010101010101010101010101", - text: this.text - }; - } - - // Resturn true/false if the string provided is valid for this encoder - valid(){ - return true; - } -} - -export {GenericBarcode}; diff --git a/barcodes/ITF/index.js b/barcodes/ITF/index.js deleted file mode 100755 index af0268e..0000000 --- a/barcodes/ITF/index.js +++ /dev/null @@ -1,60 +0,0 @@ -import Barcode from "../Barcode.js"; - -class ITF extends Barcode{ - constructor(data, options){ - super(data, options); - - this.binaryRepresentation = { - "0":"00110", - "1":"10001", - "2":"01001", - "3":"11000", - "4":"00101", - "5":"10100", - "6":"01100", - "7":"00011", - "8":"10010", - "9":"01010" - }; - } - - valid(){ - return this.data.search(/^([0-9]{2})+$/) !== -1; - } - - encode(){ - // Always add the same start bits - var result = "1010"; - - // Calculate all the digit pairs - for(var i = 0; i < this.data.length; i += 2){ - result += this.calculatePair(this.data.substr(i, 2)); - } - - // Always add the same end bits - result += "11101"; - - return { - data: result, - text: this.text - }; - } - - // Calculate the data of a number pair - calculatePair(numberPair){ - var result = ""; - - var number1Struct = this.binaryRepresentation[numberPair[0]]; - var number2Struct = this.binaryRepresentation[numberPair[1]]; - - // Take every second bit and add to the result - for(var i = 0; i < 5; i++){ - result += (number1Struct[i] == "1") ? "111" : "1"; - result += (number2Struct[i] == "1") ? "000" : "0"; - } - - return result; - } -} - -export {ITF}; diff --git a/barcodes/ITF14/index.js b/barcodes/ITF14/index.js deleted file mode 100755 index 70edd97..0000000 --- a/barcodes/ITF14/index.js +++ /dev/null @@ -1,76 +0,0 @@ -import Barcode from "../Barcode.js"; - -class ITF14 extends Barcode{ - constructor(data, options){ - // Add checksum if it does not exist - if(data.search(/^[0-9]{13}$/) !== -1){ - data += checksum(data); - } - - super(data, options); - - this.binaryRepresentation = { - "0":"00110", - "1":"10001", - "2":"01001", - "3":"11000", - "4":"00101", - "5":"10100", - "6":"01100", - "7":"00011", - "8":"10010", - "9":"01010" - }; - } - - valid(){ - return this.data.search(/^[0-9]{14}$/) !== -1 && - this.data[13] == checksum(this.data); - } - - encode(){ - var result = "1010"; - - // Calculate all the digit pairs - for(var i = 0; i < 14; i += 2){ - result += this.calculatePair(this.data.substr(i, 2)); - } - - // Always add the same end bits - result += "11101"; - - return { - data: result, - text: this.text - }; - } - - // Calculate the data of a number pair - calculatePair(numberPair){ - var result = ""; - - var number1Struct = this.binaryRepresentation[numberPair[0]]; - var number2Struct = this.binaryRepresentation[numberPair[1]]; - - // Take every second bit and add to the result - for(var i = 0; i < 5; i++){ - result += (number1Struct[i] == "1") ? "111" : "1"; - result += (number2Struct[i] == "1") ? "000" : "0"; - } - - return result; - } -} - -// Calulate the checksum digit -function checksum(data){ - var result = 0; - - for(var i = 0; i < 13; i++){ - result += parseInt(data[i]) * (3 - (i % 2) * 2); - } - - return Math.ceil(result / 10) * 10 - result; -} - -export {ITF14}; diff --git a/barcodes/MSI/MSI.js b/barcodes/MSI/MSI.js deleted file mode 100755 index ba16909..0000000 --- a/barcodes/MSI/MSI.js +++ /dev/null @@ -1,48 +0,0 @@ -// Encoding documentation -// https://en.wikipedia.org/wiki/MSI_Barcode#Character_set_and_binary_lookup - -import Barcode from "../Barcode.js"; - -class MSI extends Barcode{ - constructor(data, options){ - super(data, options); - } - - encode(){ - // Start bits - var ret = "110"; - - for(var i = 0; i < this.data.length; i++){ - // Convert the character to binary (always 4 binary digits) - var digit = parseInt(this.data[i]); - var bin = digit.toString(2); - bin = addZeroes(bin, 4 - bin.length); - - // Add 100 for every zero and 110 for every 1 - for(var b = 0; b < bin.length; b++){ - ret += bin[b] == "0" ? "100" : "110"; - } - } - - // End bits - ret += "1001"; - - return { - data: ret, - text: this.text - }; - } - - valid(){ - return this.data.search(/^[0-9]+$/) !== -1; - } -} - -function addZeroes(number, n){ - for(var i = 0; i < n; i++){ - number = "0" + number; - } - return number; -} - -export default MSI; diff --git a/barcodes/MSI/MSI10.js b/barcodes/MSI/MSI10.js deleted file mode 100755 index a89bae8..0000000 --- a/barcodes/MSI/MSI10.js +++ /dev/null @@ -1,10 +0,0 @@ -import MSI from './MSI.js'; -import {mod10} from './checksums.js'; - -class MSI10 extends MSI{ - constructor(data, options){ - super(data + mod10(data), options); - } -} - -export default MSI10; diff --git a/barcodes/MSI/MSI1010.js b/barcodes/MSI/MSI1010.js deleted file mode 100755 index 0337ec3..0000000 --- a/barcodes/MSI/MSI1010.js +++ /dev/null @@ -1,12 +0,0 @@ -import MSI from './MSI.js'; -import {mod10} from './checksums.js'; - -class MSI1010 extends MSI{ - constructor(data, options){ - data += mod10(data); - data += mod10(data); - super(data, options); - } -} - -export default MSI1010; diff --git a/barcodes/MSI/MSI11.js b/barcodes/MSI/MSI11.js deleted file mode 100755 index 9038061..0000000 --- a/barcodes/MSI/MSI11.js +++ /dev/null @@ -1,10 +0,0 @@ -import MSI from './MSI.js'; -import {mod11} from './checksums.js'; - -class MSI11 extends MSI{ - constructor(data, options){ - super(data + mod11(data), options); - } -} - -export default MSI11; diff --git a/barcodes/MSI/MSI1110.js b/barcodes/MSI/MSI1110.js deleted file mode 100755 index 6dac155..0000000 --- a/barcodes/MSI/MSI1110.js +++ /dev/null @@ -1,12 +0,0 @@ -import MSI from './MSI.js'; -import {mod10, mod11} from './checksums.js'; - -class MSI1110 extends MSI{ - constructor(data, options){ - data += mod11(data); - data += mod10(data); - super(data, options); - } -} - -export default MSI1110; diff --git a/barcodes/MSI/checksums.js b/barcodes/MSI/checksums.js deleted file mode 100755 index 8a02721..0000000 --- a/barcodes/MSI/checksums.js +++ /dev/null @@ -1,23 +0,0 @@ -export function mod10(number){ - var sum = 0; - for(var i = 0; i < number.length; i++){ - var n = parseInt(number[i]); - if((i + number.length) % 2 === 0){ - sum += n; - } - else{ - sum += (n * 2) % 10 + Math.floor((n * 2) / 10); - } - } - return (10 - (sum % 10)) % 10; -} - -export function mod11(number){ - var sum = 0; - var weights = [2, 3, 4, 5, 6, 7]; - for(var i = 0; i < number.length; i++){ - var n = parseInt(number[number.length - 1 - i]); - sum += weights[i % weights.length] * n; - } - return (11 - (sum % 11)) % 11; -} diff --git a/barcodes/MSI/index.js b/barcodes/MSI/index.js deleted file mode 100755 index 2c20baf..0000000 --- a/barcodes/MSI/index.js +++ /dev/null @@ -1,7 +0,0 @@ -import MSI from './MSI.js'; -import MSI10 from './MSI10.js'; -import MSI11 from './MSI11.js'; -import MSI1010 from './MSI1010.js'; -import MSI1110 from './MSI1110.js'; - -export {MSI, MSI10, MSI11, MSI1010, MSI1110}; diff --git a/barcodes/codabar/index.js b/barcodes/codabar/index.js deleted file mode 100755 index 1e6a4d2..0000000 --- a/barcodes/codabar/index.js +++ /dev/null @@ -1,63 +0,0 @@ -// Encoding specification: -// http://www.barcodeisland.com/codabar.phtml - -import Barcode from "../Barcode.js"; - -class codabar extends Barcode{ - constructor(data, options){ - if (data.search(/^[0-9\-\$\:\.\+\/]+$/) === 0) { - data = "A" + data + "A"; - } - - super(data.toUpperCase(), options); - - this.text = this.options.text || this.text.replace(/[A-D]/g, ''); - } - - valid(){ - return this.data.search(/^[A-D][0-9\-\$\:\.\+\/]+[A-D]$/) !== -1; - } - - encode(){ - var result = []; - var encodings = this.getEncodings(); - for(var i = 0; i < this.data.length; i++){ - result.push(encodings[this.data.charAt(i)]); - // for all characters except the last, append a narrow-space ("0") - if (i !== this.data.length - 1) { - result.push("0"); - } - } - return { - text: this.text, - data: result.join('') - }; - } - - getEncodings(){ - return { - "0": "101010011", - "1": "101011001", - "2": "101001011", - "3": "110010101", - "4": "101101001", - "5": "110101001", - "6": "100101011", - "7": "100101101", - "8": "100110101", - "9": "110100101", - "-": "101001101", - "$": "101100101", - ":": "1101011011", - "/": "1101101011", - ".": "1101101101", - "+": "101100110011", - "A": "1011001001", - "B": "1010010011", - "C": "1001001011", - "D": "1010011001" - }; - } -} - -export {codabar}; diff --git a/barcodes/index.js b/barcodes/index.js deleted file mode 100755 index 28a1e95..0000000 --- a/barcodes/index.js +++ /dev/null @@ -1,21 +0,0 @@ -import {CODE39} from './CODE39/'; -import {CODE128, CODE128A, CODE128B, CODE128C} from './CODE128/'; -import {EAN13, EAN8, EAN5, EAN2, UPC} from './EAN_UPC/'; -import {ITF14} from './ITF14/'; -import {ITF} from './ITF/'; -import {MSI, MSI10, MSI11, MSI1010, MSI1110} from './MSI/'; -import {pharmacode} from './pharmacode/'; -import {codabar} from './codabar'; -import {GenericBarcode} from './GenericBarcode/'; - -export default { - CODE39, - CODE128, CODE128A, CODE128B, CODE128C, - EAN13, EAN8, EAN5, EAN2, UPC, - ITF14, - ITF, - MSI, MSI10, MSI11, MSI1010, MSI1110, - pharmacode, - codabar, - GenericBarcode -}; diff --git a/barcodes/pharmacode/index.js b/barcodes/pharmacode/index.js deleted file mode 100755 index 2cde723..0000000 --- a/barcodes/pharmacode/index.js +++ /dev/null @@ -1,43 +0,0 @@ -// Encoding documentation -// http://www.gomaro.ch/ftproot/Laetus_PHARMA-CODE.pdf - -import Barcode from "../Barcode.js"; - -class pharmacode extends Barcode{ - constructor(data, options){ - super(data, options); - this.number = parseInt(data, 10); - } - - encode(){ - var z = this.number; - var result = ""; - - // http://i.imgur.com/RMm4UDJ.png - // (source: http://www.gomaro.ch/ftproot/Laetus_PHARMA-CODE.pdf, page: 34) - while(!isNaN(z) && z != 0){ - if(z % 2 === 0){ // Even - result = "11100" + result; - z = (z - 2) / 2; - } - else{ // Odd - result = "100" + result; - z = (z - 1) / 2; - } - } - - // Remove the two last zeroes - result = result.slice(0, -2); - - return { - data: result, - text: this.text - }; - } - - valid(){ - return this.number >= 3 && this.number <= 131070; - } -} - -export {pharmacode}; diff --git a/index.js b/index.js index 6d95e52..ca7d902 100644 --- a/index.js +++ b/index.js @@ -1,25 +1,19 @@ import React, {PropTypes, PureComponent} from 'react'; -import {View, StyleSheet} from 'react-native'; +import {View, StyleSheet, ART} from 'react-native'; -import Svg, {Rect} from 'react-native-svg'; -import barcodes from './barcodes/'; +import barcodes from 'jsbarcode/src/barcodes'; + +const { + Surface, + Shape, +} = ART; export default class Barcode extends PureComponent { static propTypes = { /* what the barCode stands for */ value: PropTypes.string, /* Select which barcode type to use */ - format: PropTypes.oneOf([ - 'codabar', - 'CODE39', - 'CODE128', 'CODE128A', 'CODE128B', 'CODE128C', // Note: Using 'CODE128' will automatically detect which subtype you need and use it. - 'EAN2', 'EAN5', 'EAN8', 'EAN13', - 'UPC', - 'GenericBarcode', - 'ITF', 'ITF14', - 'MSI', 'MSI10', 'MSI11', 'MSI1010', 'MSI1110', // Note: Using 'MSI' will automatically detect which subtype you need and use it. - 'pharmacode' - ]), + format: PropTypes.oneOf(Object.keys(barcodes)), /* Overide the text that is diplayed */ text: PropTypes.string, /* The width option is the width of a single bar. */ @@ -106,7 +100,7 @@ export default class Barcode extends PureComponent { } drawRect(x, y, width, height) { - return (); + return `M${x},${y}h${width}v${height}h-${width}z`; } getTotalWidthOfEncodings(encodings) { @@ -132,7 +126,7 @@ export default class Barcode extends PureComponent { return } else { throw new Error('Invalid barcode for selected format.') - } + } } @@ -150,9 +144,9 @@ export default class Barcode extends PureComponent { this.update(); return ( - - {this.state.bars} - + + + ); } diff --git a/package.json b/package.json index 4c04f68..c7c021c 100644 --- a/package.json +++ b/package.json @@ -16,12 +16,12 @@ "barcode" ], "author": "WonSikin ", - "peerDependencies": { - "react-native-svg": "^4.4.1" - }, "devDependencies": { "babel-eslint": "^6.1.2", "eslint": "^2.13.1", "eslint-plugin-react": "^6.8.0" + }, + "dependencies": { + "jsbarcode": "^3.8.0" } }