diff --git a/android/app/build.gradle b/android/app/build.gradle index 9e62fae..6e5a4ba 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -138,6 +138,7 @@ android { } dependencies { + implementation project(':react-native-touch-through-view') implementation project(':react-native-screens') implementation fileTree(dir: "libs", include: ["*.jar"]) implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" diff --git a/android/app/src/main/java/com/touchthroughviewissue/MainActivity.java b/android/app/src/main/java/com/touchthroughviewissue/MainActivity.java index aa076dc..244c78a 100644 --- a/android/app/src/main/java/com/touchthroughviewissue/MainActivity.java +++ b/android/app/src/main/java/com/touchthroughviewissue/MainActivity.java @@ -1,9 +1,14 @@ package com.touchthroughviewissue; import com.facebook.react.ReactActivity; +import android.view.MotionEvent; +import com.rome2rio.android.reactnativetouchthroughview.TouchThroughTouchHandlerInterface; +import com.rome2rio.android.reactnativetouchthroughview.TouchThroughTouchHandler; public class MainActivity extends ReactActivity { + private TouchThroughTouchHandler touchThroughTouchHandler = new TouchThroughTouchHandler(); + /** * Returns the name of the main component registered from JavaScript. * This is used to schedule rendering of the component. @@ -12,4 +17,17 @@ public class MainActivity extends ReactActivity { protected String getMainComponentName() { return "touchThroughViewIssue"; } + + + public TouchThroughTouchHandler getTouchThroughTouchHandler() { + return touchThroughTouchHandler; + } + + @Override + public boolean dispatchTouchEvent(MotionEvent ev) { + touchThroughTouchHandler.handleTouchEvent(ev); + + return super.dispatchTouchEvent(ev); + } + } diff --git a/android/app/src/main/java/com/touchthroughviewissue/MainApplication.java b/android/app/src/main/java/com/touchthroughviewissue/MainApplication.java index 75a5e8f..b6a29ca 100644 --- a/android/app/src/main/java/com/touchthroughviewissue/MainApplication.java +++ b/android/app/src/main/java/com/touchthroughviewissue/MainApplication.java @@ -3,6 +3,7 @@ package com.touchthroughviewissue; import android.app.Application; import com.facebook.react.ReactApplication; +import com.rome2rio.android.reactnativetouchthroughview.TouchThroughViewPackage; import com.swmansion.rnscreens.RNScreensPackage; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; @@ -24,6 +25,7 @@ public class MainApplication extends Application implements ReactApplication { protected List getPackages() { return Arrays.asList( new MainReactPackage(), + new TouchThroughViewPackage(), new RNScreensPackage() ); } diff --git a/android/settings.gradle b/android/settings.gradle index 1851840..f29a3d2 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -1,4 +1,6 @@ rootProject.name = 'touchThroughViewIssue' +include ':react-native-touch-through-view' +project(':react-native-touch-through-view').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-touch-through-view/android') include ':react-native-screens' project(':react-native-screens').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-screens/android') diff --git a/ios/touchThroughViewIssue.xcodeproj/project.pbxproj b/ios/touchThroughViewIssue.xcodeproj/project.pbxproj index 461251a..f196b0b 100644 --- a/ios/touchThroughViewIssue.xcodeproj/project.pbxproj +++ b/ios/touchThroughViewIssue.xcodeproj/project.pbxproj @@ -40,6 +40,7 @@ ED297163215061F000B7C4FE /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED297162215061F000B7C4FE /* JavaScriptCore.framework */; }; ED2971652150620600B7C4FE /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2971642150620600B7C4FE /* JavaScriptCore.framework */; }; DD926E073DA74446AF6937F8 /* libRNScreens.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B875DA35B2E04788994795BD /* libRNScreens.a */; }; + 9888DA302DAA485A94AD273D /* libReactNativeTouchThroughView.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BFA1AE8D0C38445D98D7AB3B /* libReactNativeTouchThroughView.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -349,6 +350,8 @@ ED2971642150620600B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.0.sdk/System/Library/Frameworks/JavaScriptCore.framework; sourceTree = DEVELOPER_DIR; }; 602DA6A1F3074A6A9160870B /* RNScreens.xcodeproj */ = {isa = PBXFileReference; name = "RNScreens.xcodeproj"; path = "../node_modules/react-native-screens/ios/RNScreens.xcodeproj"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; }; B875DA35B2E04788994795BD /* libRNScreens.a */ = {isa = PBXFileReference; name = "libRNScreens.a"; path = "libRNScreens.a"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; }; + CD999FC0FC11437CBE20B692 /* ReactNativeTouchThroughView.xcodeproj */ = {isa = PBXFileReference; name = "ReactNativeTouchThroughView.xcodeproj"; path = "../node_modules/react-native-touch-through-view/ios/ReactNativeTouchThroughView.xcodeproj"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; }; + BFA1AE8D0C38445D98D7AB3B /* libReactNativeTouchThroughView.a */ = {isa = PBXFileReference; name = "libReactNativeTouchThroughView.a"; path = "libReactNativeTouchThroughView.a"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -378,6 +381,7 @@ 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */, 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */, DD926E073DA74446AF6937F8 /* libRNScreens.a in Frameworks */, + 9888DA302DAA485A94AD273D /* libReactNativeTouchThroughView.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -568,6 +572,7 @@ 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */, 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */, 602DA6A1F3074A6A9160870B /* RNScreens.xcodeproj */, + CD999FC0FC11437CBE20B692 /* ReactNativeTouchThroughView.xcodeproj */, ); name = Libraries; sourceTree = ""; @@ -1196,10 +1201,12 @@ LIBRARY_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); HEADER_SEARCH_PATHS = ( "$(inherited)", "$(SRCROOT)/../node_modules/react-native-screens/ios", + "$(SRCROOT)/../node_modules/react-native-touch-through-view/ios/**", ); }; name = Debug; @@ -1222,10 +1229,12 @@ LIBRARY_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); HEADER_SEARCH_PATHS = ( "$(inherited)", "$(SRCROOT)/../node_modules/react-native-screens/ios", + "$(SRCROOT)/../node_modules/react-native-touch-through-view/ios/**", ); }; name = Release; @@ -1249,6 +1258,7 @@ HEADER_SEARCH_PATHS = ( "$(inherited)", "$(SRCROOT)/../node_modules/react-native-screens/ios", + "$(SRCROOT)/../node_modules/react-native-touch-through-view/ios/**", ); }; name = Debug; @@ -1271,6 +1281,7 @@ HEADER_SEARCH_PATHS = ( "$(inherited)", "$(SRCROOT)/../node_modules/react-native-screens/ios", + "$(SRCROOT)/../node_modules/react-native-touch-through-view/ios/**", ); }; name = Release; @@ -1301,10 +1312,12 @@ LIBRARY_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); HEADER_SEARCH_PATHS = ( "$(inherited)", "$(SRCROOT)/../node_modules/react-native-screens/ios", + "$(SRCROOT)/../node_modules/react-native-touch-through-view/ios/**", ); }; name = Debug; @@ -1335,10 +1348,12 @@ LIBRARY_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); HEADER_SEARCH_PATHS = ( "$(inherited)", "$(SRCROOT)/../node_modules/react-native-screens/ios", + "$(SRCROOT)/../node_modules/react-native-touch-through-view/ios/**", ); }; name = Release; @@ -1368,10 +1383,12 @@ LIBRARY_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); HEADER_SEARCH_PATHS = ( "$(inherited)", "$(SRCROOT)/../node_modules/react-native-screens/ios", + "$(SRCROOT)/../node_modules/react-native-touch-through-view/ios/**", ); }; name = Debug; @@ -1401,10 +1418,12 @@ LIBRARY_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); HEADER_SEARCH_PATHS = ( "$(inherited)", "$(SRCROOT)/../node_modules/react-native-screens/ios", + "$(SRCROOT)/../node_modules/react-native-touch-through-view/ios/**", ); }; name = Release; diff --git a/package.json b/package.json index bbe11be..5be4e8a 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "dependencies": { "react": "16.8.3", "react-native": "0.59.8", - "react-native-screens": "^1.0.0-alpha.22" + "react-native-screens": "^1.0.0-alpha.22", + "react-native-touch-through-view": "^1.1.1" }, "devDependencies": { "@babel/core": "^7.4.4", diff --git a/yarn.lock b/yarn.lock index d95d2ec..dd6cca9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4851,6 +4851,11 @@ react-native-screens@^1.0.0-alpha.22: resolved "https://registry.yarnpkg.com/react-native-screens/-/react-native-screens-1.0.0-alpha.22.tgz#7a120377b52aa9bbb94d0b8541a014026be9289b" integrity sha512-kSyAt0AeVU6N7ZonfV6dP6iZF8B7Bce+tk3eujXhzBGsLg0VSLnU7uE9VqJF0xdQrHR91ZjGgVMieo/8df9KTA== +react-native-touch-through-view@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/react-native-touch-through-view/-/react-native-touch-through-view-1.1.1.tgz#7d9cc7b69854f36f018c00e30167519ee830c8a7" + integrity sha512-7aR/EJ8nh4rntJ4BYLbX8XyrBcXjUc7VtsTuuja5dNvIuPv2WawZjwB9VckdpVEREq2hEsXaGXhLH9L2l2Q5FA== + react-native@0.59.8: version "0.59.8" resolved "https://registry.yarnpkg.com/react-native/-/react-native-0.59.8.tgz#ade4141c777c60f5ec4889d9811d0f80a9d56547"