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

(Android) Images loading causes that app crashes #15956

Closed
Borisboky opened this issue Sep 15, 2017 · 6 comments
Closed

(Android) Images loading causes that app crashes #15956

Borisboky opened this issue Sep 15, 2017 · 6 comments
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.

Comments

@Borisboky
Copy link

I'm using:

react-native: 0.39.0
npm: 4.0.2
node: 6.9.1

The problem is when I try to take a few pictures in a row, after fifth taken image the app crashes. I'm not getting any errors of warnings.

It crashes also if the camera is opened and if I wait for about 15-20 seconds with camera opened, without taking photo.

On newer, better phone (s8 galaxy) and newer android versions (7) it works as expected, but on this one it isn't working. Thus, I suppose that it has something to do with memory issues. But I'm not sure.

I've added largeMemoryHeap to the manifest file.

In android studio I get log file as follows:
screen shot 2017-09-14 at 11 11 58

Thus, no errors, nothing. But the app doesn't work.

The stuck of code where those photos are rendered is as follows:

<ScrollView removeClippedSubviews={true}>
      <StatusBar backgroundColor="blue" barStyle="light-content"/>
      <Zoom visible={this.state.zoomVisible} close={() => this.setState({zoomVisible: false})} image={this.state.zoomImage} imageIndex={this.state.zoomIndex} pictures={this.state.zoomPictures} remove={this.onRemoveImage.bind(this)} />
      <View style={{width: width, height: 1, backgroundColor: '#ddd'}} />
           <View style={styles.container}>
               {cards}
           </View>
 </ScrollView>

And one card is as follows, and I have a stuck of 10:

<TouchableHighlight onPress={this.props.onPress} style={styles.card} underlayColor={s.color}>
       <View style={styles.innerCard}>
             <View style={styles.innerImageContainer}>
                  <Image contain='contain' style={styles.innerImage} source={this.props.image}/>
              </View>
              <View style={[styles.innerTitle, {borderBottomWidth: 4, borderBottomColor: this.props.mandatory ? this.props.noImage ? s.paletteMandatory : s.success : '#fff'}]}>
                   <Text style={styles.textTitle} allowFontScaling={false} numberOfLines={1} ellipsizeMode={'tail'}>{this.props.title}</Text>
              </View>
        </View>
</TouchableHighlight>

I found here that I need to add removeClippedSubviews={true} to ScrollView, but it does not help.

On IOS it works just fine.

It looks something like:

simulator screen shot 15 sep 2017 09 27 34

When they click on one of the cards the camera is opened and after they take the photo, the get something like:
simulator screen shot 15 sep 2017 09 27 52

Thus, on IOS and on Android phones with more memory (Samsung S8) it works as expected.

@flynnch
Copy link

flynnch commented Sep 17, 2017

  1. resizeMethod={'resize'} http://facebook.github.io/react-native/docs/image.html
    2.use Flatlist

@Borisboky
Copy link
Author

resizeMerhod doesn't help, the same problem.
FlatList aren't available on 0.39 RN versio.

@radko93
Copy link
Contributor

radko93 commented Sep 18, 2017

We don't support older versions of RN (at least not 8 versions old). Please reproduce with a new version and open a new issue (using a template).

@radko93
Copy link
Contributor

radko93 commented Sep 18, 2017

@facebook-github-bot close

@facebook-github-bot
Copy link
Contributor

@radko93 has closed this issue. If you think it should remain open, let us know why. See "What to Expect from Maintainers".

@facebook-github-bot facebook-github-bot added the Ran Commands One of our bots successfully processed a command. label Sep 18, 2017
@deehuey
Copy link

deehuey commented Apr 13, 2018

@flynnch You are a god amongst men. Thank you, we were displaying shop logos in a ScrollView and getting crashes the further you scrolled down. Now I can quintuple the list length without a single performance hit, all with adding resizeMethod="resize".

Dumb, but glad to have found the issue :)

@facebook facebook locked as resolved and limited conversation to collaborators Sep 18, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Sep 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

6 participants