|
9 | 9 | import com.facebook.react.uimanager.annotations.ReactProp; |
10 | 10 | import com.facebook.react.views.view.ReactViewGroup; |
11 | 11 | import com.facebook.react.views.view.ReactViewManager; |
12 | | -import com.facebook.react.module.annotations.ReactModule; |
13 | 12 |
|
14 | | -@ReactModule(name = FastShadowViewManagerImpl.NAME) |
15 | 13 | public class FastShadowViewManager extends ReactViewManager { |
16 | 14 |
|
| 15 | + public static final String NAME = "FastShadowView"; |
| 16 | + |
17 | 17 | @Override |
18 | 18 | @NonNull |
19 | 19 | public String getName() { |
20 | | - return FastShadowViewManagerImpl.NAME; |
| 20 | + return FastShadowViewManager.NAME; |
21 | 21 | } |
22 | 22 |
|
23 | 23 | @Override |
24 | 24 | public FastShadowView createViewInstance(ThemedReactContext context) { |
25 | | - return FastShadowViewManagerImpl.createViewInstance(context); |
| 25 | + return new FastShadowView(context); |
26 | 26 | } |
27 | 27 |
|
28 | 28 | @Override |
29 | 29 | public void onDropViewInstance(@NonNull ReactViewGroup view) { |
30 | 30 | super.onDropViewInstance(view); |
31 | | - FastShadowViewManagerImpl.onDropViewInstance(view); |
| 31 | + ((FastShadowView) view).releaseShadow(); |
32 | 32 | } |
33 | 33 |
|
34 | 34 | @ReactProp(name = "shadowColor", customType = "Color", defaultInt = Color.BLACK) |
35 | 35 | public void setShadowColor(FastShadowView view, int color) { |
36 | | - FastShadowViewManagerImpl.setShadowColor(view, color); |
| 36 | + view.setColor(color); |
37 | 37 | } |
38 | 38 |
|
39 | 39 | @ReactProp(name = "shadowOpacity", defaultFloat = 0) |
40 | 40 | public void setShadowOpacity(FastShadowView view, float opacity) { |
41 | | - FastShadowViewManagerImpl.setShadowOpacity(view, opacity); |
| 41 | + view.setOpacity(opacity); |
42 | 42 | } |
43 | 43 |
|
44 | 44 | @ReactProp(name = "shadowRadius", defaultFloat = 3) |
45 | 45 | public void setShadowRadius(FastShadowView view, float radius) { |
46 | | - FastShadowViewManagerImpl.setShadowRadius(view, radius); |
| 46 | + view.setRadius(radius); |
47 | 47 | } |
48 | 48 |
|
49 | 49 | @ReactProp(name = "shadowOffset") |
50 | 50 | public void setShadowOffset(FastShadowView view, ReadableMap offset) { |
51 | | - FastShadowViewManagerImpl.setShadowOffset(view, offset); |
| 51 | + if (offset == null) { |
| 52 | + view.resetOffset(); |
| 53 | + } else { |
| 54 | + view.setOffset( |
| 55 | + (float) offset.getDouble("width"), |
| 56 | + (float) offset.getDouble("height") |
| 57 | + ); |
| 58 | + } |
52 | 59 | } |
53 | 60 |
|
54 | 61 | @ReactProp(name = "cornerRadii") |
55 | 62 | public void setCornerRadii(FastShadowView view, ReadableMap borderRadius) { |
56 | | - FastShadowViewManagerImpl.setCornerRadii(view, borderRadius); |
| 63 | + view.setCornerRadii(new float[]{ |
| 64 | + (float) borderRadius.getDouble("topLeft"), |
| 65 | + (float) borderRadius.getDouble("topRight"), |
| 66 | + (float) borderRadius.getDouble("bottomRight"), |
| 67 | + (float) borderRadius.getDouble("bottomLeft") |
| 68 | + }); |
57 | 69 | } |
58 | 70 | } |
0 commit comments