-
-
Notifications
You must be signed in to change notification settings - Fork 995
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
9 changed files
with
219 additions
and
4 deletions.
There are no files selected for viewing
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
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
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
60 changes: 60 additions & 0 deletions
60
.../src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerDelegate.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,60 @@ | ||
/** | ||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). | ||
* | ||
* Do not edit this file as changes may cause incorrect behavior and will be lost | ||
* once the code is regenerated. | ||
* | ||
* @generated by codegen project: GeneratePropsJavaDelegate.js | ||
*/ | ||
|
||
package com.facebook.react.viewmanagers; | ||
|
||
import android.view.View; | ||
import androidx.annotation.Nullable; | ||
import com.facebook.react.bridge.ColorPropConverter; | ||
import com.facebook.react.uimanager.BaseViewManager; | ||
import com.facebook.react.uimanager.BaseViewManagerDelegate; | ||
import com.facebook.react.uimanager.LayoutShadowNode; | ||
|
||
public class RNGestureHandlerButtonManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & RNGestureHandlerButtonManagerInterface<T>> extends BaseViewManagerDelegate<T, U> { | ||
public RNGestureHandlerButtonManagerDelegate(U viewManager) { | ||
super(viewManager); | ||
} | ||
@Override | ||
public void setProperty(T view, String propName, @Nullable Object value) { | ||
switch (propName) { | ||
case "exclusive": | ||
mViewManager.setExclusive(view, value == null ? true : (boolean) value); | ||
break; | ||
case "foreground": | ||
mViewManager.setForeground(view, value == null ? false : (boolean) value); | ||
break; | ||
case "borderless": | ||
mViewManager.setBorderless(view, value == null ? false : (boolean) value); | ||
break; | ||
case "enabled": | ||
mViewManager.setEnabled(view, value == null ? true : (boolean) value); | ||
break; | ||
case "rippleColor": | ||
mViewManager.setRippleColor(view, ColorPropConverter.getColor(value, view.getContext())); | ||
break; | ||
case "rippleRadius": | ||
mViewManager.setRippleRadius(view, value == null ? 0 : ((Double) value).intValue()); | ||
break; | ||
case "touchSoundDisabled": | ||
mViewManager.setTouchSoundDisabled(view, value == null ? false : (boolean) value); | ||
break; | ||
case "borderWidth": | ||
mViewManager.setBorderWidth(view, value == null ? 0f : ((Double) value).floatValue()); | ||
break; | ||
case "borderColor": | ||
mViewManager.setBorderColor(view, ColorPropConverter.getColor(value, view.getContext())); | ||
break; | ||
case "borderStyle": | ||
mViewManager.setBorderStyle(view, value == null ? "solid" : (String) value); | ||
break; | ||
default: | ||
super.setProperty(view, propName, value); | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerInterface.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,26 @@ | ||
/** | ||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). | ||
* | ||
* Do not edit this file as changes may cause incorrect behavior and will be lost | ||
* once the code is regenerated. | ||
* | ||
* @generated by codegen project: GeneratePropsJavaInterface.js | ||
*/ | ||
|
||
package com.facebook.react.viewmanagers; | ||
|
||
import android.view.View; | ||
import androidx.annotation.Nullable; | ||
|
||
public interface RNGestureHandlerButtonManagerInterface<T extends View> { | ||
void setExclusive(T view, boolean value); | ||
void setForeground(T view, boolean value); | ||
void setBorderless(T view, boolean value); | ||
void setEnabled(T view, boolean value); | ||
void setRippleColor(T view, @Nullable Integer value); | ||
void setRippleRadius(T view, int value); | ||
void setTouchSoundDisabled(T view, boolean value); | ||
void setBorderWidth(T view, float value); | ||
void setBorderColor(T view, @Nullable Integer value); | ||
void setBorderStyle(T view, @Nullable String value); | ||
} |
26 changes: 26 additions & 0 deletions
26
...rc/main/java/com/facebook/react/viewmanagers/RNGestureHandlerRootViewManagerDelegate.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,26 @@ | ||
/** | ||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). | ||
* | ||
* Do not edit this file as changes may cause incorrect behavior and will be lost | ||
* once the code is regenerated. | ||
* | ||
* @generated by codegen project: GeneratePropsJavaDelegate.js | ||
*/ | ||
|
||
package com.facebook.react.viewmanagers; | ||
|
||
import android.view.View; | ||
import androidx.annotation.Nullable; | ||
import com.facebook.react.uimanager.BaseViewManager; | ||
import com.facebook.react.uimanager.BaseViewManagerDelegate; | ||
import com.facebook.react.uimanager.LayoutShadowNode; | ||
|
||
public class RNGestureHandlerRootViewManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & RNGestureHandlerRootViewManagerInterface<T>> extends BaseViewManagerDelegate<T, U> { | ||
public RNGestureHandlerRootViewManagerDelegate(U viewManager) { | ||
super(viewManager); | ||
} | ||
@Override | ||
public void setProperty(T view, String propName, @Nullable Object value) { | ||
super.setProperty(view, propName, value); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...c/main/java/com/facebook/react/viewmanagers/RNGestureHandlerRootViewManagerInterface.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 @@ | ||
/** | ||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). | ||
* | ||
* Do not edit this file as changes may cause incorrect behavior and will be lost | ||
* once the code is regenerated. | ||
* | ||
* @generated by codegen project: GeneratePropsJavaInterface.js | ||
*/ | ||
|
||
package com.facebook.react.viewmanagers; | ||
|
||
import android.view.View; | ||
|
||
public interface RNGestureHandlerRootViewManagerInterface<T extends View> { | ||
// No props | ||
} |
67 changes: 67 additions & 0 deletions
67
.../paper77/src/main/java/com/swmansion/gesturehandler/NativeRNGestureHandlerModuleSpec.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,67 @@ | ||
|
||
/** | ||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). | ||
* | ||
* Do not edit this file as changes may cause incorrect behavior and will be lost | ||
* once the code is regenerated. | ||
* | ||
* @generated by codegen project: GenerateModuleJavaSpec.js | ||
* | ||
* @nolint | ||
*/ | ||
|
||
package com.swmansion.gesturehandler; | ||
|
||
import com.facebook.proguard.annotations.DoNotStrip; | ||
import com.facebook.react.bridge.ReactApplicationContext; | ||
import com.facebook.react.bridge.ReactContextBaseJavaModule; | ||
import com.facebook.react.bridge.ReactMethod; | ||
import com.facebook.react.bridge.ReactModuleWithSpec; | ||
import com.facebook.react.bridge.ReadableMap; | ||
import com.facebook.react.turbomodule.core.interfaces.TurboModule; | ||
import javax.annotation.Nonnull; | ||
|
||
public abstract class NativeRNGestureHandlerModuleSpec extends ReactContextBaseJavaModule implements ReactModuleWithSpec, TurboModule { | ||
public static final String NAME = "RNGestureHandlerModule"; | ||
|
||
public NativeRNGestureHandlerModuleSpec(ReactApplicationContext reactContext) { | ||
super(reactContext); | ||
} | ||
|
||
@Override | ||
public @Nonnull String getName() { | ||
return NAME; | ||
} | ||
|
||
@ReactMethod | ||
@DoNotStrip | ||
public abstract void handleSetJSResponder(double tag, boolean blockNativeResponder); | ||
|
||
@ReactMethod | ||
@DoNotStrip | ||
public abstract void handleClearJSResponder(); | ||
|
||
@ReactMethod | ||
@DoNotStrip | ||
public abstract void createGestureHandler(String handlerName, double handlerTag, ReadableMap config); | ||
|
||
@ReactMethod | ||
@DoNotStrip | ||
public abstract void attachGestureHandler(double handlerTag, double newView, double actionType); | ||
|
||
@ReactMethod | ||
@DoNotStrip | ||
public abstract void updateGestureHandler(double handlerTag, ReadableMap newConfig); | ||
|
||
@ReactMethod | ||
@DoNotStrip | ||
public abstract void dropGestureHandler(double handlerTag); | ||
|
||
@ReactMethod(isBlockingSynchronousMethod = true) | ||
@DoNotStrip | ||
public abstract boolean install(); | ||
|
||
@ReactMethod | ||
@DoNotStrip | ||
public abstract void flushOperations(); | ||
} |
13 changes: 13 additions & 0 deletions
13
android/paper77/src/main/java/com/swmansion/gesturehandler/ReactContextExtensions.kt
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,13 @@ | ||
package com.swmansion.gesturehandler | ||
|
||
import com.facebook.react.bridge.ReactContext | ||
import com.facebook.react.uimanager.UIManagerModule | ||
import com.facebook.react.uimanager.events.Event | ||
|
||
fun ReactContext.dispatchEvent(event: Event<*>) { | ||
try { | ||
this.getNativeModule(UIManagerModule::class.java)!!.eventDispatcher.dispatchEvent(event) | ||
} catch (e: NullPointerException) { | ||
throw Exception("Couldn't get an instance of UIManagerModule. Gesture Handler is unable to send an event.", e) | ||
} | ||
} |