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

Keyboard focus() not working in Android platform after using RN image picker #26038

Closed
sumudu-dewasurendra opened this issue Aug 13, 2019 · 2 comments
Labels
API: Keyboard Bug Component: Image Platform: Android Android applications. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@sumudu-dewasurendra
Copy link

React Native version:

"react-native": "0.57.8"
"react-native-image-picker": "^0.28.0"

React Native Environment Info:
System:
OS: Windows 10
CPU: (6) x64 Intel(R) Core(TM) i5-8500 CPU @ 3.00GHz
Memory: 1.71 GB / 7.85 GB
Binaries:
Yarn: 1.9.2 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: Version 3.1.0.0 AI-173.4819257

Steps To Reproduce

  1. Type something on text input
  2. While focus on that using image picker to take photo or video
  3. Press select button to choose video or photo
  4. Keyboard is getting hide in android when coming back to the page

Describe what you expected to happen:

Keyboard should open in android platform when coming to the same page after using image picker

Snack, code example, screenshot, or link to a repository:

`renderView() {

    return(
      <View>
        <TouchableOpacity style={{marginLeft:28}} onPress={()=>{this.selectPhotoTapped()}}></TouchableOpacity>
        <TextInput
            style={{ maxHeight: Math.min(this.state.height+20,250),
                            height: Math.min(this.state.height+20,250)}}
            placeholderTextColor="#aaaaaa"
            autoGrow={true}
            autoFocus={false}
            multiline= {true}
            ref={ref => (this.ref = ref)}
            onChangeText={( postText) => this.setState({ postText})}
        />
      </View>                               
    )
    
  }`

`selectPhotoTapped() {

    const options = {
        quality: 1.0,
        maxWidth: 500,
        maxHeight: 500,
        storageOptions: {
            skipBackup: true
        }       
    };
  
    ImagePicker.showImagePicker(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 {
        let mediaType = response.type

        this.setState({
        mediaAttached: true,
        attachedMediaType: 2,
        mediaPath:response.uri,
        uploadMediaType:mediaType,           
        });
        this.UploadSelectedImageForGT()

    }

    });   
  
}`

`UploadSelectedImageForGT (){

      this.setState({ visiblePostsomething:false, mediaUploading: true})
      this.ref.focus(); 
        const uuidv4 = require('uuid/v4');
        if(this.state.mediaPath!= ''){
          try{
            const storage = firebase.storage();
            this.setState({fireBaseMediaPath: 'Appsurvey/Image/user1/'+uuidv4()+'img.jpg'})
              const mRef = storage.ref('portal1').child(this.state.fireBaseMediaPath);
              mRef.putFile(this.state.mediaPath, { contentType: this.state.uploadMediaType })
              .on('state_changed', snapshot => {
                                    }, err => {
                                    }, uploadedFile => {
                                      console.log('uploadedFile.downloadURL: ', uploadedFile.downloadURL);                                
                                      this.setState({PostMediaURL: uploadedFile.downloadURL, uploadSuccess: true, mediaUploading: false}) 
                                  });
            }catch(error){
                Alert.alert(error)
            }
        }      
    }`
@stale
Copy link

stale bot commented Nov 11, 2019

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Nov 11, 2019
@stale
Copy link

stale bot commented Nov 18, 2019

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

@stale stale bot closed this as completed Nov 18, 2019
@facebook facebook locked as resolved and limited conversation to collaborators Nov 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
API: Keyboard Bug Component: Image Platform: Android Android applications. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

2 participants