-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Expand file tree
/
Copy pathShadowReactView.java
More file actions
45 lines (35 loc) · 1.27 KB
/
ShadowReactView.java
File metadata and controls
45 lines (35 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package com.reactnativenavigation;
import android.content.Context;
import android.widget.FrameLayout;
import com.reactnativenavigation.react.ReactView;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
import org.robolectric.annotation.RealObject;
import org.robolectric.shadow.api.Shadow;
import org.robolectric.util.ReflectionHelpers;
import org.robolectric.util.ReflectionHelpers.ClassParameter;
@Implements(ReactView.class)
public class ShadowReactView extends org.robolectric.shadows.ShadowViewGroup {
@RealObject
private ReactView realObject;
@Implementation
protected void __constructor__(Context context, String componentId, String componentName) {
Shadow.invokeConstructor(FrameLayout.class, realObject,
ClassParameter.from(Context.class, context));
ReflectionHelpers.setField(realObject, "componentId", componentId);
ReflectionHelpers.setField(realObject, "componentName", componentName);
}
@Implementation
protected void onAttachedToWindow() {
}
@Implementation
public void start() {
}
@Implementation
public void destroy() {
}
@Implementation
public boolean isRendered() {
return realObject.getChildCount() >= 1;
}
}