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

QUESTION: wrap the measure function with promise works perfect on debug but crashes on release build #16584

Closed
azgron opened this issue Oct 29, 2017 · 1 comment
Labels
Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@azgron
Copy link

azgron commented Oct 29, 2017

Is this a bug report?

NO

Have you read the Contributing Guidelines?

YES

Environment

Environment:
OS: macOS High Sierra 10.13
Node: 6.6.0
Yarn: 0.19.1
npm: 3.10.3
Watchman: 4.3.0
Xcode: Xcode 9.0.1 Build version 9A1004
Android Studio: 2.3 AI-162.4069837

Packages: (wanted => installed)
react: 16.0.0-alpha.6 => 16.0.0-alpha.12
react-native: ^0.49.0 => 0.49.3

Steps to Reproduce

Add this function:

export async function measureView(measureFunc: (callback: MeasureOnSuccessCallback) => void): Promise<MeasureView | null> {
    return new Promise<MeasureView | null>((resolve, reject) => {
        try {
            measureFunc((x: number,
                         y: number,
                         width: number,
                         height: number,
                         pageX: number,
                         pageY: number) => {
                resolve({x, y, width, height, pageX, pageY});
            });
        } catch (err) {
            reject(err);
        }
    })
}

Add the call:
let res = await measureView(this.refs[``].measure.bind(this));

-- ON DEBUG --

  1. react-native run-android or ios => WORKS AS EXPECTED.
    -- ON RELEASE --
  2. Create release build:
  • cd android && ./gradlew assembleRelease => install on a android device (on emulator just drag the apk).
  • For ios, create release, Upload to testFlight.
  1. The app crashes:
    :47:41.651 4219-4256/? E/UncaughtException: com.facebook.react.bridge.NativeArgumentsParseException: TypeError: expected dynamic typedouble', but had type null' (constructing arguments for UIManager.measure at argument index 0) at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:357) at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:162) at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31) at android.os.Looper.loop(Looper.java:154) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:194) at java.lang.Thread.run(Thread.java:761) Caused by: com.facebook.react.bridge.UnexpectedNativeTypeException: TypeError: expected dynamic type double', but had type null' at com.facebook.react.bridge.ReadableNativeArray.getDouble(Native Method) at com.facebook.react.bridge.JavaMethodWrapper$4.extractArgument(JavaMethodWrapper.java:66) at com.facebook.react.bridge.JavaMethodWrapper$4.extractArgument(JavaMethodWrapper.java:62) at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:350) at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:162)  at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)  at android.os.Handler.handleCallback(Handler.java:751)  at android.os.Handler.dispatchMessage(Handler.java:95)  at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)  at android.os.Looper.loop(Looper.java:154)  at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:194)  at java.lang.Thread.run(Thread.java:761) 

Expected Behavior

To behave as running on debug.

Actual Behavior

Crashes.

@stale
Copy link

stale bot commented Dec 29, 2017

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. 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 Dec 29, 2017
@stale stale bot closed this as completed Jan 5, 2018
@facebook facebook locked and limited conversation to collaborators May 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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

1 participant