我已经尝试过构建原生的ui组件,它经常受到欢迎.该组件似乎没有以react-native呈现.
虽然,对于这个问题,我特意尝试在反应原生中呈现Android片段,但没有任何东西出现.示例代码:
public class PreferenceViewManager extends SimpleViewManager<FrameLayout> {
public static final String REACT_CLASS = "RCTPreferenceView";
private WeakReference<Activity> activityWeakReference;
public PreferenceViewManager(WeakReference<Activity> activityWeakReference) {
this.activityWeakReference = activityWeakReference;
}
@Override
public String getName() {
return REACT_CLASS;
}
@Override
public FrameLayout createViewInstance(ThemedReactContext context) {
Log.d(REACT_CLASS, "PreferenceView createViewInstance");
final FrameLayout view = new FrameLayout(context);
view.setId(View.generateViewId());
// Testing if the view does get rendered, it should show white even if fragment is not rendered!
view.setBackgroundColor(Color.WHITE);
// not sure where to call fragment beginTransaction properly, the code …Run Code Online (Sandbox Code Playgroud)