使用ViewGroupManager反应本机的make bridge

时间:2018-08-04 18:43:56

标签: java android react-native transferwise

我正在尝试桥接此模块:https://github.com/transferwise/sequence-layout

我设法编写了这段代码,它似乎可以工作,但是在下一行的图形部分似乎存在一些问题。

我应该得到这样的东西:

如您所见,没有看到台阶,也没有看到蓬。

相反,我得到这样的东西:

package com.reactlibrary;

import android.graphics.Color;
import android.view.ViewGroup;
import android.widget.FrameLayout;

import com.facebook.react.uimanager.ThemedReactContext;
import com.facebook.react.uimanager.ViewGroupManager;
import com.transferwise.sequencelayout.SequenceLayout;
import com.transferwise.sequencelayout.SequenceStep;

import java.util.Random;

public class RNMaterialLetterIcon extends ViewGroupManager<ViewGroup> {

    public static final String REACT_CLASS = "RNMaterialLetterIcon";

    @Override
    public String getName() {
        return REACT_CLASS;
    }

    @Override
    protected FrameLayout createViewInstance(final ThemedReactContext reactContext) {
        int randomId;

        //Random rand = new Random();
        //while (reactContext.getCurrentActivity().findViewById(randomId = rand.nextInt(Integer.MAX_VALUE) + 1) != null);
        //final int viewId = randomId;

        SequenceLayout sequenceLayout = new SequenceLayout(reactContext.getCurrentActivity());
        sequenceLayout.setProgressBackgroundColor(Color.parseColor("#1e64e8"));
        sequenceLayout.setProgressForegroundColor(Color.parseColor("#f92f02"));

        SequenceStep sequenceStepFirst = new SequenceStep(reactContext.getCurrentActivity());
        sequenceStepFirst.setAnchor("30 Nov");
        sequenceStepFirst.setTitle("First step");

        SequenceStep sequenceStepSecond = new SequenceStep(reactContext.getCurrentActivity());
        sequenceStepSecond.setTitle("Second step");

        SequenceStep sequenceStepThird = new SequenceStep(reactContext.getCurrentActivity());
        sequenceStepThird.setActive(true);
        sequenceStepThird.setAnchor("Today");
        sequenceStepThird.setSubtitle("Subtitle of this step.");
        sequenceStepThird.setTitle("Third step");

        SequenceStep sequenceStepFourth = new SequenceStep(reactContext.getCurrentActivity());
        sequenceStepFourth.setTitle("Fourth step");

        SequenceStep sequenceStepFifth = new SequenceStep(reactContext.getCurrentActivity());
        sequenceStepFifth.setAnchor("2 Dec");
        sequenceStepFifth.setTitle("Fifth step");

        sequenceLayout.addView(sequenceStepFirst);
        sequenceLayout.addView(sequenceStepSecond);
        sequenceLayout.addView(sequenceStepThird);
        sequenceLayout.addView(sequenceStepFourth);
        sequenceLayout.addView(sequenceStepFifth);

        final FrameLayout frameLayout = new FrameLayout(reactContext.getCurrentActivity());
        //LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        //frameLayout.setLayoutParams(new ActionBar.LayoutParams(ActionBar.LayoutParams.WRAP_CONTENT, 50));
        frameLayout.addView(sequenceLayout);
        return frameLayout;
    }

}

0 个答案:

没有答案