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

not work at [email protected] Android #28

Open
huanghaodong opened this issue Aug 30, 2017 · 6 comments
Open

not work at [email protected] Android #28

huanghaodong opened this issue Aug 30, 2017 · 6 comments

Comments

@huanghaodong
Copy link

No description provided.

@BATMAH69
Copy link

Problem with enent in "_handleNativeEvent(event)", event dosn't have contentSize property.
image
Next in "_onContentSizeChangeAndroid(event)", we have contentSize property with correnc height
image

@huanghaodong
Copy link
Author

thank you!so what should i do?

@BATMAH69
Copy link

@huanghaodong I make dummy wrapper:

import React, {Component} from 'react'
import {Platform} from 'react-native'
import {AutoGrowingTextInput} from 'react-native-autogrow-textinput'

export class AutoGrowingTextInputFixed extends Component {
  constructor(props) {
    super(props)
    this.state = {
      height: 0,
    }
    this.forceResize = this.forceResize.bind(this)
  }

  forceResize(event) {
    const {nativeEvent} = event
    if (
      Platform.OS !== 'ios' &&
      nativeEvent &&
      nativeEvent.contentSize &&
      nativeEvent.contentSize.height !== this.height
    ) {
      this.height = event.nativeEvent.height
      this.input._handleNativeEvent(nativeEvent)
    }
  }

  render() {
    return (
      <AutoGrowingTextInput
        {...this.props}
        onContentSizeChange={this.forceResize}
        ref={ref => (this.input = ref)}
      />
    )
  }
}

I hope developers will fix it.

@saimemre1
Copy link

Is it fixed or not yet ?

@EyalSi
Copy link

EyalSi commented Jan 15, 2018

It's not fixed yet :(. moreover, @BATMAH69 fix is not valid in version 5.0.0 as the function _handleNativeEvent doesn't exist...

@artald
Copy link
Collaborator

artald commented Jan 15, 2018

The latest published version (5.0.0) is now compatible with modern RN versions (>= 51).

RN now comes out of the box with auto-growing multiline input on both platforms so there is no need of handling the height in JS. If you don’t need any of the other features of this package, regular input should be enough.

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

5 participants