mirror of
https://github.com/zhigang1992/reactNativeScreenAndroidTouchIssue.git
synced 2026-05-08 18:22:31 +08:00
chore: add react-native-touch-through-view
This commit is contained in:
@@ -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}"
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user