Git Product home page Git Product logo

Comments (6)

BATMAH69 avatar BATMAH69 commented on June 30, 2024 3

@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.

from react-native-autogrow-textinput.

BATMAH69 avatar BATMAH69 commented on June 30, 2024

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

from react-native-autogrow-textinput.

huanghaodong avatar huanghaodong commented on June 30, 2024

thank you!so what should i do?

from react-native-autogrow-textinput.

saimemre1 avatar saimemre1 commented on June 30, 2024

Is it fixed or not yet ?

from react-native-autogrow-textinput.

EyalSi avatar EyalSi commented on June 30, 2024

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

from react-native-autogrow-textinput.

artald avatar artald commented on June 30, 2024

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.

from react-native-autogrow-textinput.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.