-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
plugins/ern_v0.34.0+/react-native-gesture-handler_v1.4.1+/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
## [React Native Gesture Handler](https://github.com/kmagiera/react-native-gesture-handler) plugin. | ||
|
||
### Prerequisites | ||
[Electrode Native](https://github.com/electrode-io/electrode-native) >= 0.38.0 | ||
|
||
### To add this plugion to your miniapp | ||
|
||
`ern add react-native-gesture-handler` | ||
|
||
## For Android | ||
|
||
Create a custom delegate(`ReactNativeGestureDelegate.java`) by extending `ElectrodeReactFragmentActivityDelegate.java` and override the following method. | ||
|
||
```java | ||
@Override | ||
protected ReactRootView createRootView() { | ||
return new RNGestureHandlerEnabledRootView(getContext()); | ||
} | ||
``` | ||
|
||
Then use this delegate in your activity. If your activity is extending `ElectrodeBaseActivity.java` then override the following method as below. | ||
|
||
```java | ||
@NonNull | ||
protected ElectrodeReactFragmentActivityDelegate createElectrodeDelegate() { | ||
return new ReactNativeGestureDelegate(this); | ||
} | ||
``` |
16 changes: 16 additions & 0 deletions
16
plugins/ern_v0.34.0+/react-native-gesture-handler_v1.4.1+/RNGestureHandlerPackagePlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.walmartlabs.ern.container.plugins; | ||
|
||
import android.app.Application; | ||
import android.support.annotation.NonNull; | ||
import android.support.annotation.Nullable; | ||
|
||
import com.facebook.react.ReactInstanceManagerBuilder; | ||
import com.facebook.react.ReactPackage; | ||
import com.swmansion.gesturehandler.react.RNGestureHandlerPackage; | ||
|
||
public class RNGestureHandlerPackagePlugin implements ReactPlugin { | ||
public ReactPackage hook(@NonNull Application application, | ||
@Nullable ReactPluginConfig config) { | ||
return new RNGestureHandlerPackage(); | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
plugins/ern_v0.34.0+/react-native-gesture-handler_v1.4.1+/config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{ | ||
"android": { | ||
"root": "android", | ||
"dependencies": [], | ||
"copy": [ | ||
{ | ||
"dest": "lib/src/main/java/com/swmansion/gesturehandler", | ||
"source": "android/lib/*" | ||
} | ||
], | ||
"replaceInFile": [ | ||
{ | ||
"path": "lib/src/main/java/com/walmartlabs/ern/container/ElectrodeReactActivityDelegate.java", | ||
"string": "import com.facebook.react.ReactRootView;", | ||
"replaceWith": "import com.facebook.react.ReactRootView;\nimport com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;" | ||
}, | ||
{ | ||
"path": "lib/src/main/java/com/walmartlabs/ern/container/ElectrodeReactActivityDelegate.java", | ||
"string": " }\n}", | ||
"replaceWith": " }\n\n @Override\n protected ReactRootView createRootView() {\n return new RNGestureHandlerEnabledRootView(getContext());\n }\n}" | ||
} | ||
] | ||
}, | ||
"ios": { | ||
"copy": [ | ||
{ | ||
"dest": "{{{projectName}}}/Libraries/RNGestureHandler", | ||
"source": "ios/**" | ||
} | ||
], | ||
"pbxproj": { | ||
"addHeaderSearchPath": [ | ||
"\"$(SRCROOT)/{{{projectName}}}/Libraries/RNGestureHandler/**\"" | ||
], | ||
"addProject": [ | ||
{ | ||
"group": "Libraries", | ||
"path": "RNGestureHandler/RNGestureHandler.xcodeproj", | ||
"staticLibs": [ | ||
{ | ||
"name": "libRNGestureHandler.a", | ||
"target": "RNGestureHandler" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} |