chore: add react-native-touch-through-view

This commit is contained in:
Kyle Fang
2019-05-12 10:03:09 +08:00
parent ec55144e77
commit 5404b766a4
7 changed files with 49 additions and 1 deletions

View File

@@ -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}"

View File

@@ -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);
}
}

View File

@@ -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<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new TouchThroughViewPackage(),
new RNScreensPackage()
);
}

View File

@@ -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')