meliorence / meliorence/react-native-snap-carousel

memory leak bug plz

Open
#797 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
10.5k
Forks
2.3k
PR merge metrics
No merged PRs in 30d

Description

Is this a bug report, a feature request, or a question?

bug report!

Have you followed the required steps before opening a bug report?

(Check the step you've followed - put an x character between the square brackets ([]).)

Have you made sure that it wasn't a React Native bug?

(Write your answer here.) yes

Is the bug specific to iOS or Android? Or can it be reproduced on both platforms?

both platforms
android 9.0
ios 14.2

Is the bug reproductible in a production environment (not a debug one)?

no

Environment

hello

memory leak occurs ParallaxImage in both platforms
and It does not occur if you annotate ParallaxImage....

my code

class MainLikeCafe extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            activeSlide: 0,
            likeCafeArr: [],
        };
    }

    onSlideBanner = (index) => {
        this.setState({
            activeSlide: index,
        });
    };
    renderItem = ({ item, index }, parallaxProps) => {
        return (
            <View style={{ flex: 1 }}>
                <View style={{ height: 300 }}>
                    <ParallaxImage
                        source={item.url ? { uri: item.url } : require('@/Assets/Images/Home/banner01.png')}
                        // source={{ uri: item.url }}
                        containerStyle={{ height: 300, borderRadius: 8 }}
                        style={{ resizeMode: 'cover' }}
                        parallaxFactor={0.3}
                        {...parallaxProps}
                    />
                </View>
            </View>
        );
    };
    render() {
        let likeCafeArr = [];
        if (this.props.mainList && this.props.mainList.data.likeCafe) {
            likeCafeArr = this.props.mainList.data.likeCafe;
          
        }
     
        return (
            <View style={{ marginTop: 60, paddingLeft: 20 }}>
               
                <View style={{ marginTop: 20 }}>
                    <View style={{ height: 347 }}>
                        <Carousel
                            ref={(ref) => {
                                this.carouselRef = ref;
                            }}
                            layout={'default'}
                            data={likeCafeArr}
                            renderItem={this.renderItem}
                            sliderWidth={width}
                            sliderHeight={341}
                            itemWidth={width * 0.6}
                            inactiveSlideScale={0.7}
                            activeSlideAlignment={'start'}
                            firstItem={this.state.activeSlide}
                            hasParallaxImages={true}
                            removeClippedSubviews={true}
                            onSnapToItem={(index) => this.onSlideBanner(index)}
                        />
                    </View>
                </View>
            </View>
        );
    }
}

스크린샷 2021-01-06 오후 12 44 44

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting the ParallaxImage entry point used by the supplied Carousel example and reproduce the reported behavior on both Android and iOS with React Native 0.63.4. Compare the supplied usage with the case where ParallaxImage is omitted or annotated; done means the leak is isolated and prevented, or the limitation is clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native
Domain
mobile-dev, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.