Skip to content

UIManager.measure dose not work on Android #22443

Closed

Description

@chenyao6134

Environment

 React Native Environment Info:
    System:
      OS: macOS 10.14.1
      CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
      Memory: 25.14 MB / 16.00 GB
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 8.12.0 - /usr/local/bin/node
      Yarn: 1.12.1 - /usr/local/bin/yarn
      npm: 6.4.1 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
      Android SDK:
        API Levels: 19, 23, 25, 26, 27, 28
        Build Tools: 23.0.1, 25.0.0, 25.0.2, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.3
        System Images: android-23 | Google APIs Intel x86 Atom
    IDEs:
      Android Studio: 3.2 AI-181.5540.7.32.5056338
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.4.1 => 16.4.1 
      react-native: 0.56.0 => 0.56.0 
    npmGlobalPackages:
      create-react-native-app: 1.0.0
      react-native-cli: 2.0.1

Description

NativeModules.UIManager.measure(findNodeHandle(ref), (x: number, y: number, width: number, height: number, pageX: number, pageY: number) => { 
    console.log(x,y,pageX,pageY); 
    this.scrollView && this.scrollView.scrollTo({x: 0, y: y, animated: true}) 
});

I use the UIManager.measure like this,and it can scroll to the right place on the iOS.
but on android ,the console.log result is undefined,

Activity

  1. react-native-bot commented on Nov 28, 2018

    @react-native-bot
    Collaborator

    Can you run react-native info and edit your issue to include these results under the Environment section?

    If you believe this information is irrelevant to the reported issue, you may write [skip envinfo] under Environment to let us know.

  2. changed the title [-] UIManager.measure dose not work onandroid ,but it work fine os iOS12 simulator [/-] [+] UIManager.measure dose not work on Android[/+] on Nov 28, 2018
  3. radko93 commented on Nov 28, 2018

    @radko93
    Contributor

    Please reproduce the issue with the latest React Native version.

  4. react-native-bot commented on Nov 29, 2018

    @react-native-bot
    Collaborator

    It looks like you are using an older version of React Native. Please update to the latest release, v0.57 and verify if the issue still exists.

    The "⏪Old Version" label will be removed automatically once you edit your original post with the results of running react-native info on a project using the latest release.

  5. chenyao6134 commented on Nov 29, 2018

    @chenyao6134
    Author

    Can you run react-native info and edit your issue to include these results under the Environment section?

    If you believe this information is irrelevant to the reported issue, you may write [skip envinfo] under Environment to let us know.

    I have paste the react-native info under the Environment tag,and I could not found anything about this issue.

  6. chenyao6134 commented on Nov 29, 2018

    @chenyao6134
    Author

    It looks like you are using an older version of React Native. Please update to the latest release, v0.57 and verify if the issue still exists.

    The "⏪Old Version" label will be removed automatically once you edit your original post with the results of running react-native info on a project using the latest release.

  7. radko93 commented on Nov 29, 2018

    @radko93
    Contributor

    Did you tried with latest RN version?

  8. chenyao6134 commented on Nov 30, 2018

    @chenyao6134
    Author

    Did you tried with latest RN version?

    YES,it worked,thank you very much. And it also work fine on the react-native 0.56 demo,

  9. radko93 commented on Dec 4, 2018

    @radko93
    Contributor

    I'm closing this then.

  10. itxuye commented on Jun 13, 2019

    @itxuye

    UIManager.measure still dose not work on Android with React Native 0.59

  11. kevtran410 commented on Jun 20, 2019

    @kevtran410

    i'm facing this issue, setTimeOut to UIManager.measure make it works but sometimes, it returns wrong values.

  12. sinhpn92 commented on Jul 20, 2019

    @sinhpn92

    I have same issue in react native version 0.59.9 :v

  13. maheshaarkenea commented on Sep 25, 2019

    @maheshaarkenea

    same issue on react native version 0.59.9. any solution would be great. tried using collapsable={false} on the view i am measuring and also tried using onLayout={() => {}) on the same view as per the solutions provided in responses of similar issues. no luck yet. at the same time this works on another react native project. no idea why its not working here.

  14. radko93 commented on Sep 30, 2019

    @radko93
    Contributor

    We won't be able to fix that on 0.59.x, but if you can reproduce that issue on 0.61.x please open another issue and then maybe you will be able to patch it)

  15. locked as resolved and limited conversation to collaborators on Dec 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions