diff --git a/index.android.js b/SafariViewManager.android.js similarity index 100% rename from index.android.js rename to SafariViewManager.android.js diff --git a/index.ios.js b/SafariViewManager.ios.js similarity index 100% rename from index.ios.js rename to SafariViewManager.ios.js diff --git a/SafariViewManager.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/SafariViewManager.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/SafariViewManager.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/examples/SafariViewExample/.flowconfig b/examples/SafariViewExample/.flowconfig index 466bb11..f565799 100644 --- a/examples/SafariViewExample/.flowconfig +++ b/examples/SafariViewExample/.flowconfig @@ -1,71 +1,28 @@ [ignore] # We fork some components by platform. -.*/*.web.js -.*/*.android.js +.*/*[.]android.js -# Some modules have their own node_modules with overlap -.*/node_modules/node-haste/.* - -# Ugh -.*/node_modules/babel.* -.*/node_modules/babylon.* -.*/node_modules/invariant.* - -# Ignore react and fbjs where there are overlaps, but don't ignore -# anything that react-native relies on -.*/node_modules/fbjs/lib/Map.js -.*/node_modules/fbjs/lib/ErrorUtils.js - -# Flow has a built-in definition for the 'react' module which we prefer to use -# over the currently-untyped source -.*/node_modules/react/react.js -.*/node_modules/react/lib/React.js -.*/node_modules/react/lib/ReactDOM.js - -.*/__mocks__/.* -.*/__tests__/.* - -.*/commoner/test/source/widget/share.js - -# Ignore commoner tests -.*/node_modules/commoner/test/.* - -# See https://github.com/facebook/flow/issues/442 -.*/react-tools/node_modules/commoner/lib/reader.js - -# Ignore jest -.*/node_modules/jest-cli/.* - -# Ignore Website -.*/website/.* - -# Ignore generators +# Ignore templates with `@flow` in header .*/local-cli/generator.* -# Ignore BUCK generated folders -.*\.buckd/ - -# Ignore RNPM -.*/local-cli/rnpm/.* - -.*/node_modules/is-my-json-valid/test/.*\.json -.*/node_modules/iconv-lite/encodings/tables/.*\.json +# Ignore malformed json .*/node_modules/y18n/test/.*\.json -.*/node_modules/spdx-license-ids/spdx-license-ids.json -.*/node_modules/spdx-exceptions/index.json -.*/node_modules/resolve/test/subdirs/node_modules/a/b/c/x.json -.*/node_modules/resolve/lib/core.json -.*/node_modules/jsonparse/samplejson/.*\.json -.*/node_modules/json5/test/.*\.json -.*/node_modules/ua-parser-js/test/.*\.json -.*/node_modules/builtin-modules/builtin-modules.json -.*/node_modules/binary-extensions/binary-extensions.json -.*/node_modules/url-regex/tlds.json -.*/node_modules/joi/.*\.json -.*/node_modules/isemail/.*\.json -.*/node_modules/tr46/.*\.json +# Ignore the website subdir +/website/.* + +# Ignore BUCK generated dirs +/\.buckd/ + +# Ignore unexpected extra @providesModule +.*/node_modules/commoner/test/source/widget/share.js + +# Ignore duplicate module providers +# For RN Apps installed via npm, "Libraries" folder is inside node_modules/react-native but in the source repo it is in the root +.*/Libraries/react-native/React.js +.*/Libraries/react-native/ReactNative.js +.*/node_modules/jest-runtime/build/__tests__/.* [include] @@ -91,9 +48,11 @@ suppress_type=$FlowIssue suppress_type=$FlowFixMe suppress_type=$FixMe -suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-6]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) -suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-6]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ +suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-2]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) +suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-2]\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy +unsafe.enable_getters_and_setters=true + [version] -^0.26.0 +^0.32.0 diff --git a/examples/SafariViewExample/android/app/BUCK b/examples/SafariViewExample/android/app/BUCK index 5965a05..7dea2fa 100644 --- a/examples/SafariViewExample/android/app/BUCK +++ b/examples/SafariViewExample/android/app/BUCK @@ -5,7 +5,7 @@ import re # - install Buck # - `npm start` - to start the packager # - `cd android` -# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US` +# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck # - `buck install -r android/app` - compile, install and run application # diff --git a/examples/SafariViewExample/android/app/src/main/java/com/safariviewexample/MainActivity.java b/examples/SafariViewExample/android/app/src/main/java/com/safariviewexample/MainActivity.java index ab31f55..208933c 100644 --- a/examples/SafariViewExample/android/app/src/main/java/com/safariviewexample/MainActivity.java +++ b/examples/SafariViewExample/android/app/src/main/java/com/safariviewexample/MainActivity.java @@ -1,11 +1,6 @@ package com.safariviewexample; import com.facebook.react.ReactActivity; -import com.facebook.react.ReactPackage; -import com.facebook.react.shell.MainReactPackage; - -import java.util.Arrays; -import java.util.List; public class MainActivity extends ReactActivity { @@ -17,24 +12,4 @@ public class MainActivity extends ReactActivity { protected String getMainComponentName() { return "SafariViewExample"; } - - /** - * Returns whether dev mode should be enabled. - * This enables e.g. the dev menu. - */ - @Override - protected boolean getUseDeveloperSupport() { - return BuildConfig.DEBUG; - } - - /** - * A list of packages used by the app. If the app uses additional views - * or modules besides the default ones, add more packages here. - */ - @Override - protected List getPackages() { - return Arrays.asList( - new MainReactPackage() - ); - } } diff --git a/examples/SafariViewExample/android/app/src/main/java/com/safariviewexample/MainApplication.java b/examples/SafariViewExample/android/app/src/main/java/com/safariviewexample/MainApplication.java new file mode 100644 index 0000000..a357937 --- /dev/null +++ b/examples/SafariViewExample/android/app/src/main/java/com/safariviewexample/MainApplication.java @@ -0,0 +1,35 @@ +package com.safariviewexample; + +import android.app.Application; +import android.util.Log; + +import com.facebook.react.ReactApplication; +import com.facebook.react.ReactInstanceManager; +import com.facebook.react.ReactNativeHost; +import com.facebook.react.ReactPackage; +import com.facebook.react.shell.MainReactPackage; + +import java.util.Arrays; +import java.util.List; + +public class MainApplication extends Application implements ReactApplication { + + private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { + @Override + protected boolean getUseDeveloperSupport() { + return BuildConfig.DEBUG; + } + + @Override + protected List getPackages() { + return Arrays.asList( + new MainReactPackage() + ); + } + }; + + @Override + public ReactNativeHost getReactNativeHost() { + return mReactNativeHost; + } +} diff --git a/examples/SafariViewExample/index.ios.js b/examples/SafariViewExample/index.ios.js index e61e5d3..4f6ec5b 100644 --- a/examples/SafariViewExample/index.ios.js +++ b/examples/SafariViewExample/index.ios.js @@ -14,8 +14,6 @@ import { import SafariView from 'react-native-safari-view'; -console.log(SafariView) - class SafariViewExample extends Component { componentDidMount() { this.showSubscription= () => { diff --git a/examples/SafariViewExample/ios/SafariViewExample.xcodeproj/project.pbxproj b/examples/SafariViewExample/ios/SafariViewExample.xcodeproj/project.pbxproj index 7daeaab..0a85cf9 100644 --- a/examples/SafariViewExample/ios/SafariViewExample.xcodeproj/project.pbxproj +++ b/examples/SafariViewExample/ios/SafariViewExample.xcodeproj/project.pbxproj @@ -23,7 +23,7 @@ 140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; 146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; }; - AD58524C1D1A06D6002FE125 /* libSafariViewManager.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AD58524B1D1A06C9002FE125 /* libSafariViewManager.a */; }; + D5482FC1FF6B4767A9B1FC3A /* libSafariViewManager.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B0913C5170A847F1B7E502CB /* libSafariViewManager.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -104,9 +104,9 @@ remoteGlobalIDString = 58B5119B1A9E6C1200147676; remoteInfo = RCTText; }; - AD58524A1D1A06C9002FE125 /* PBXContainerItemProxy */ = { + AD7A72A11DAC033E0009560E /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = AD58523C1D1A06C9002FE125 /* SafariViewManager.xcodeproj */; + containerPortal = 9BE776C6C86B4737882885E4 /* SafariViewManager.xcodeproj */; proxyType = 2; remoteGlobalIDString = 134814201AA4EA6300B7C361; remoteInfo = SafariViewManager; @@ -135,7 +135,8 @@ 146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.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 = ""; }; - AD58523C1D1A06C9002FE125 /* SafariViewManager.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SafariViewManager.xcodeproj; path = "../node_modules/react-native-safari-view/SafariViewManager.xcodeproj"; sourceTree = ""; }; + 9BE776C6C86B4737882885E4 /* SafariViewManager.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = SafariViewManager.xcodeproj; path = "../node_modules/react-native-safari-view/SafariViewManager.xcodeproj"; sourceTree = ""; }; + B0913C5170A847F1B7E502CB /* libSafariViewManager.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libSafariViewManager.a; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -151,7 +152,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - AD58524C1D1A06D6002FE125 /* libSafariViewManager.a in Frameworks */, 146834051AC3E58100842450 /* libReact.a in Frameworks */, 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */, 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */, @@ -162,6 +162,7 @@ 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */, 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */, 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */, + D5482FC1FF6B4767A9B1FC3A /* libSafariViewManager.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -274,7 +275,6 @@ 832341AE1AAA6A7D00B99B32 /* Libraries */ = { isa = PBXGroup; children = ( - AD58523C1D1A06C9002FE125 /* SafariViewManager.xcodeproj */, 146833FF1AC3E56700842450 /* React.xcodeproj */, 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */, 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */, @@ -285,6 +285,7 @@ 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */, 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */, 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */, + 9BE776C6C86B4737882885E4 /* SafariViewManager.xcodeproj */, ); name = Libraries; sourceTree = ""; @@ -318,10 +319,10 @@ name = Products; sourceTree = ""; }; - AD58523D1D1A06C9002FE125 /* Products */ = { + AD7A72941DAC033E0009560E /* Products */ = { isa = PBXGroup; children = ( - AD58524B1D1A06C9002FE125 /* libSafariViewManager.a */, + AD7A72A21DAC033E0009560E /* libSafariViewManager.a */, ); name = Products; sourceTree = ""; @@ -371,7 +372,7 @@ 83CBB9F71A601CBA00E9B192 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0610; + LastUpgradeCheck = 610; ORGANIZATIONNAME = Facebook; TargetAttributes = { 00E356ED1AD99517003FC87E = { @@ -433,8 +434,8 @@ ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */; }, { - ProductGroup = AD58523D1D1A06C9002FE125 /* Products */; - ProjectRef = AD58523C1D1A06C9002FE125 /* SafariViewManager.xcodeproj */; + ProductGroup = AD7A72941DAC033E0009560E /* Products */; + ProjectRef = 9BE776C6C86B4737882885E4 /* SafariViewManager.xcodeproj */; }, ); projectRoot = ""; @@ -516,11 +517,11 @@ remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - AD58524B1D1A06C9002FE125 /* libSafariViewManager.a */ = { + AD7A72A21DAC033E0009560E /* libSafariViewManager.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; path = libSafariViewManager.a; - remoteRef = AD58524A1D1A06C9002FE125 /* PBXContainerItemProxy */; + remoteRef = AD7A72A11DAC033E0009560E /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXReferenceProxy section */ @@ -611,8 +612,12 @@ "$(inherited)", ); INFOPLIST_FILE = SafariViewExampleTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.2; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + ); PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SafariViewExample.app/SafariViewExample"; }; @@ -624,8 +629,12 @@ BUNDLE_LOADER = "$(TEST_HOST)"; COPY_PHASE_STRIP = NO; INFOPLIST_FILE = SafariViewExampleTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.2; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + ); PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SafariViewExample.app/SafariViewExample"; }; @@ -635,19 +644,23 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CURRENT_PROJECT_VERSION = 1; DEAD_CODE_STRIPPING = NO; HEADER_SEARCH_PATHS = ( "$(inherited)", /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, "$(SRCROOT)/../node_modules/react-native/React/**", + "$(SRCROOT)/../node_modules/react-native-safari-view", ); INFOPLIST_FILE = SafariViewExample/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; OTHER_LDFLAGS = ( + "$(inherited)", "-ObjC", "-lc++", ); PRODUCT_NAME = SafariViewExample; + VERSIONING_SYSTEM = "apple-generic"; }; name = Debug; }; @@ -655,18 +668,22 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CURRENT_PROJECT_VERSION = 1; HEADER_SEARCH_PATHS = ( "$(inherited)", /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, "$(SRCROOT)/../node_modules/react-native/React/**", + "$(SRCROOT)/../node_modules/react-native-safari-view", ); INFOPLIST_FILE = SafariViewExample/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; OTHER_LDFLAGS = ( + "$(inherited)", "-ObjC", "-lc++", ); PRODUCT_NAME = SafariViewExample; + VERSIONING_SYSTEM = "apple-generic"; }; name = Release; }; @@ -708,8 +725,9 @@ "$(inherited)", /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, "$(SRCROOT)/../node_modules/react-native/React/**", + "$(SRCROOT)/../node_modules/react-native-safari-view", ); - IPHONEOS_DEPLOYMENT_TARGET = 7.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -748,8 +766,9 @@ "$(inherited)", /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, "$(SRCROOT)/../node_modules/react-native/React/**", + "$(SRCROOT)/../node_modules/react-native-safari-view", ); - IPHONEOS_DEPLOYMENT_TARGET = 7.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; diff --git a/examples/SafariViewExample/ios/SafariViewExample/AppDelegate.m b/examples/SafariViewExample/ios/SafariViewExample/AppDelegate.m index 9a59503..8448607 100644 --- a/examples/SafariViewExample/ios/SafariViewExample/AppDelegate.m +++ b/examples/SafariViewExample/ios/SafariViewExample/AppDelegate.m @@ -9,6 +9,7 @@ #import "AppDelegate.h" +#import "RCTBundleURLProvider.h" #import "RCTRootView.h" @implementation AppDelegate @@ -17,31 +18,7 @@ { NSURL *jsCodeLocation; - /** - * Loading JavaScript code - uncomment the one you want. - * - * OPTION 1 - * Load from development server. Start the server from the repository root: - * - * $ npm start - * - * To run on device, change `localhost` to the IP address of your computer - * (you can get this by typing `ifconfig` into the terminal and selecting the - * `inet` value under `en0:`) and make sure your computer and iOS device are - * on the same Wi-Fi network. - */ - - jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"]; - - /** - * OPTION 2 - * Load from pre-bundled file on disk. The static bundle is automatically - * generated by the "Bundle React Native code and images" build step when - * running the project on an actual device or running the project on the - * simulator in the "Release" build configuration. - */ - -// jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; + jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil]; RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation moduleName:@"SafariViewExample" diff --git a/examples/SafariViewExample/package.json b/examples/SafariViewExample/package.json index 100d6c3..b753245 100644 --- a/examples/SafariViewExample/package.json +++ b/examples/SafariViewExample/package.json @@ -7,7 +7,7 @@ }, "dependencies": { "react": "^15.1.0", - "react-native": "0.28.0", + "react-native": "0.34.0", "react-native-safari-view": "../.." } } diff --git a/index.js b/index.js index eca91fb..4312068 100644 --- a/index.js +++ b/index.js @@ -1,3 +1,3 @@ -const SafariView = require('./index'); +import SafariViewManager from './SafariViewManager'; -module.exports = SafariView; +export default SafariViewManager;