24ark / react-native-step-indicator

A simple react-native implementation of step indicator widget compatible with the ViewPager and ListView.
Apache License 2.0
1.43k stars 312 forks source link

Custom renderStepIndicator is not centered on iOS #96

Closed Relax594 closed 4 years ago

Relax594 commented 4 years ago

Since we can't create issues in your fork, i'm doing it here @peterpme A custom renderStepIndicator with a few custom styles lead to uncentered content inside the step indicator steps. But only on iOS, on Android it is fine.

<StepIndicator
        stepCount={stepCount}
        renderStepIndicator={renderStepIndicator}
        customStyles={indicatorStyle}
        currentPosition={currentPage}
        onPress={onStepPress}
        labels={labels}
 />

const indicatorStyle = {
        stepIndicatorSize: 20,
        currentStepIndicatorSize: 25,
        separatorStrokeWidth: 2,
        currentStepStrokeWidth: 3,
};

const renderStepIndicator = (params) => {
        return <MaterialCommunityIcon {...getStepIndicatorIconConfig(params)} />;
};

const getStepIndicatorIconConfig = ({ position, stepStatus }) => {
        const iconConfig = {
            name: icons[position],
            color: stepStatus === 'finished' ? '#ffffff' : activeIconColor,
            size: stepStatus === 'current' ? iconSize : iconSize - (activeStepSize - inactiveStepSize),
        };
        return iconConfig;
};

Android: perfectly centered grafik

iOS: not centered grafik

Relax594 commented 4 years ago

It is an issue with react-native-vector-icons on iOS.

Stophface commented 3 years ago

@Relax594 DId you solve it? Same here...

Relax594 commented 3 years ago

@Relax594 DId you solve it? Same here...

as i've written it is an issue with react-native-vector-icons which is used in this lib. I just solved it by adding padding 1px left and top

AyoubMoustahfid commented 3 years ago

please share me your code, I need see some method create icons