question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android version not work on Samsung S6

See original GitHub issue

Hi, i have this component:

import React, {
  PropTypes,
  Component,
} from 'react';
import {
  Platform,
  StyleSheet,
  View,
  Text,
  Image,
  TouchableOpacity,
} from 'react-native';
import Colors from '../Styles/Colors';
import Fonts from '../Styles/Fonts';
import ImagePicker from 'react-native-image-picker';

const styles = StyleSheet.create({
  container: {
    margin: 16,
    alignItems: 'center',
  },
  circle: {
    width: 95,
    height: 95,
    borderRadius: 95 / 2,
    backgroundColor: Colors.colorBgTwo,
    borderWidth: 13,
    borderColor: 'white',
    alignItems: 'center',
    justifyContent: 'center',
  },
  avatar: {
    width: 82,
    height: 82,
    borderRadius: 82 / 2,
  },
});

const propTypes = {
  options: PropTypes.object,
};

const defaultProps = {
  options: {
    title: 'Select Avatar', // specify null or empty string to remove the title
    cancelButtonTitle: 'Cancel',
    takePhotoButtonTitle: 'Take Photo...', // specify null or empty string to remove this button
    chooseFromLibraryButtonTitle: 'Choose from Library...', // specify null or empty string to remove this button
    cameraType: 'front', // 'front' or 'back'
    mediaType: 'photo', // 'photo' or 'video'
    quality: 0.5, // 0 to 1, photos only
    angle: 0, // android only, photos only
    allowsEditing: false, // Built in functionality to resize/reposition the image after selection
    noData: false, // photos only - disables the base64 `data` field from being generated (greatly improves performance on large photos)
    storageOptions: { // if this key is provided, the image will get saved in the documents directory on ios, and the pictures directory on android (rather than a temporary directory)
      skipBackup: true, // ios only - image will NOT be backed up to icloud
      path: 'images', // ios only - will save image at /Documents/images rather than the root
    },
  },
};

class ImageUpload extends Component {

  constructor(props) {
    super(props);

    this.state = {
      avatarSource: null,
    };
    this.selectPhotoTapped = this.selectPhotoTapped.bind(this);
  }

  selectPhotoTapped() {
    ImagePicker.showImagePicker(this.props.options, (response) => {
      console.log('Response = ', response);

      if (response.didCancel) {
        console.log('User cancelled photo picker');
      } else if (response.error) {
        console.log('ImagePicker Error: ', response.error);
      } else if (response.customButton) {
        console.log('User tapped custom button: ', response.customButton);
      } else {
        var source;

        // You can display the image using either:
        // source = { uri: `data:image/jpeg;base64, ${response.data}`, isStatic: true };
        if (Platform.OS === 'android') {
          source = { uri: response.uri, isStatic: true };
        } else {
          source = { uri: response.uri.replace('file://', ''), isStatic: true };
        }

        this.setState({
          avatarSource: source,
        });
      }
    });
  }

  render() {
    return (
      <View style={styles.container}>
        <TouchableOpacity onPress={() => { this.selectPhotoTapped(); }} >
          <View style={styles.circle}>
            {this.state.avatarSource === null ? <Text style={Fonts.h7ButtonPrimary}>Photo</Text> :
              <Image style={styles.avatar} source={this.state.avatarSource} />
            }
          </View>
        </TouchableOpacity>
      </View>
    );
  }
}

ImageUpload.propTypes = propTypes;
ImageUpload.defaultProps = defaultProps;

export default ImageUpload;

On IOS it works, on Android i have this:

img_2016-06-13 13 33 32

Can you help me?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
marcshillingcommented, Jun 19, 2016

Should be fixed in 0.19.5. Let me know.

0reactions
theLallanTopcommented, Feb 9, 2017

Hi,

android { compileSdkVersion 23 buildToolsVersion “23.0.2” defaultConfig { applicationId “com.XXX” minSdkVersion 16 targetSdkVersion 22 versionCode 1 versionName “1.0” ndk { abiFilters “armeabi-v7a”, “x86” } }

“react-native-image-picker”: “^0.22.1”

, it’s work fine other device but not with Samsung galaxy tab, s3

Read more comments on GitHub >

github_iconTop Results From Across the Web

Galaxy S6 “com.android.phone has stopped working” error ...
There's no amount of software troubleshooting that can fix it. As a workaround to charge the phone, you can try using a wireless...
Read more >
Android Update has broken my Galaxy S6
Now when I restart the Galaxy S6 comes up the the blue screen with the Android Man , saying Installing Update, then nothing...
Read more >
How to Fix App Issues on Samsung Galaxy S6 - TheCellGuide -
Go to Settings > Applications > Application manager. · Scroll to the right until you get to the All tab and select the...
Read more >
25 annoying Samsung Galaxy S6 problems, and how to fix them
If that doesn't work it's time to wipe the cache partition. Press and hold Power and then choose Power off. Now press and...
Read more >
10 Common Galaxy S6 Problems & How to Fix Them
If that doesn't work, you'll want to try rebooting the local router if that hasn't been done in awhile. We recommend unplugging the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found