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

inactiveSlideScale not working on android #173

Closed
SnowDang opened this issue Oct 5, 2017 · 3 comments
Closed

inactiveSlideScale not working on android #173

SnowDang opened this issue Oct 5, 2017 · 3 comments

Comments

@SnowDang
Copy link

SnowDang commented Oct 5, 2017

I set inactiveSlideScale={0.9}, working well on iOS but not working on android. Please help me!

<Carousel
                                ref={c => { this.carousel = c; } }
                                data={this.state.data}
                                renderItem={this._renderItemWithParallax}
                                sliderWidth={Metrics.screenWidth}
                                sliderHeight={itemHeight}
                                itemWidth={itemWidth}
                                activeSlideAlignment={'center'}
                                firstItem={1}
                                autoplay={true}
                                scrollEndDragDebounceValue={20}
                                containerCustomStyle={Styles.slider}
                                inactiveSlideScale={0.9}
                                contentContainerCustomStyle={[Styles.sliderContentContainer]}
                                removeClippedSubviews={true}
                                hasParallaxImages={true}
                                onSelectItem = { (item) => {}}
                            />
  _renderItemWithParallax ({item, index}, parallaxProps) {
         return (
             <View style={Styles.item}>
                 <TouchableHighlight style={{flex: 1, zIndex: 2}} underlayColor={Colors.clear} 
                     onPress={ () => parallaxProps['carouselRef'].props.onSelectItem(item)} >
                        <Image  source={{ uri: item.thumbnails.medium.url}} style={[Styles.image]} />
                 </TouchableHighlight>
             </View>
         );
     }

Style:

slider: {
        margin: 0,
        backgroundColor: Colors.clear,    
    },

    sliderContentContainer: {
        backgroundColor: Colors.clear,
    },

    item: {
        width: itemWidth,
        height: itemHeight,
    },

    imageContainer: {
        width: itemWidth,
        height: itemHeight,
        backgroundColor: Colors.clear,
        borderRadius: 10,
    },

    image: {
        borderRadius: 5,
        resizeMode: 'contain',
        width: '100%',
        height: '100%'
    }
@bd-arc
Copy link
Contributor

bd-arc commented Oct 5, 2017

Hi @SnowDang,

I don't see any reason why it wouldn't work, unless there is something very specific with how <TouchableHighlight /> is rendered. Have you tried replacing it with a <TouchableOpacity />?

Also, which version of the plugin and which version of React Native are you using?

Finally, can you try the provided example and find out if it works properly for you? If it does, you should build up from here, one prop/feature at a time until you discover which one is responsible for the issue.

@SnowDang
Copy link
Author

SnowDang commented Oct 9, 2017

Version info:
"react": "16.0.0-alpha.6",
"react-native": "0.44.3",
"react-native-snap-carousel": "^3.3.2",

I made an example use the latest version of react & react-native. It works ok. I think it not working with version react & react-native in my app. But have some plugin use in my app not support the latest version of react & react-native, so I can upgrade react & react-native to the latest version.

@bd-arc
Copy link
Contributor

bd-arc commented Oct 12, 2017

@SnowDang In version 3.2.0, a new mechanism for slide animation has been added. It relies on Animated.event and this API might be a bit broken in RN 0.44.x.

At this point, I'm afraid that you only have two options:

  • to upgrade your RN version
  • to use version 3.1.0 of the plugin.

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

No branches or pull requests

2 participants