Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added possibility to hook thumb creation #48

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vaukalak
Copy link

@vaukalak vaukalak commented Aug 4, 2016

Hey, this fix make thumb creation much more flexible, by adding possibility to provide custom views as thums

<Slider
          ....
          createThumbMiddleware={view => (
            <ToolTip
              visible={toolTipVisible}
              text="SOME TEXT"
            >
              {view}
            </ToolTip>
          )}
        />

@vaukalak vaukalak mentioned this pull request Aug 4, 2016
@jariwalabhavesh
Copy link

jariwalabhavesh commented Jan 27, 2017

@vaukalak:
I had used createTumbMiddleware that you provided but i am facing css related issue in andorid.

In IOS it is look like perfect
screen shot 2017-01-27 at 11 40 46 am

But in ANDROID it is look like (bar is covering thumb)
screen shot 2017-01-27 at 11 43 58 am

Here is code and css:

<View style={styles.sliderSectionContainer}>
    <View style={[styles.prepostLabelContainer, styles.prefixLabel]}>
        <Text style={styles.title}>{MIN}</Text>
    </View>
    <View style={styles.sliderContainer}>
        <Slider createThumbMiddleware={view=>(
            <View style={styles.legendContainer}>
                <Text style={styles.title}>{answer}</Text>
                {view}
            </View>
            )} minimumValue={MIN} maximumValue={MAX} step={STEPS} thumbTintColor={ACCENT_BACKGROUND_COLOR} minimumTrackTintColor={FORM_GROUP_BACKGROUND_COLOR} maximumTrackTintColor={FORM_GROUP_BACKGROUND_COLOR} trackStyle={styles.trackStyle} thumbStyle={styles.thumbStyle}
            value={answer} onValueChange={(value) => onValueChange(value)} onSlidingComplete={(value) => onChangeComplete(value, data)} />
    </View>
    <View style={[styles.prepostLabelContainer, styles.postfixLabel]}>
        <Text style={styles.title}>{MAX}</Text>
    </View>
</View>
const styles = StyleSheet.create({
    title: {
        color: TEXT_COLOR,
        fontSize: TITLE_SIZE,
        fontWeight: 'bold',
    },
    trackStyle: {
        height: 7,
        borderRadius: 5,
    },
    thumbStyle: {
        width: 24,
        height: 24,
        borderRadius: 24 / 2
    },
    sliderSectionContainer: {
        flex: 1,
        flexDirection: 'row',
        alignItems: 'center',
        justifyContent: 'center'
    },
    prepostLabelContainer: {
        flex: 0.5
    },
    prefixLabel: {
        alignItems: 'flex-end',
        marginRight: 10
    },
    postfixLabel: {
        marginLeft: 10
    },
    sliderContainer: {
        flex: 4
    },
    legendContainer: {
        alignItems: 'center'
    }
})

Any idea why it is happening in android?

grundmanise pushed a commit to grundmanise/react-native-slider that referenced this pull request Mar 1, 2017
@markwongsoontorn
Copy link

Looks great, Please merge this 👍

@dayvidwhy
Copy link

Hey there 👋

We're interested in this code as well, is there any way it can get merged since it's already approved?

@damikdk
Copy link

damikdk commented Dec 9, 2019

Sorry, any update here, guys?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants