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

Return null instead of undefined from measure on Fabric #3622

Merged
merged 4 commits into from
Sep 29, 2022

Conversation

tomekzaw
Copy link
Member

@tomekzaw tomekzaw commented Sep 28, 2022

Description

This PR removes error Cannot read property 'x' of undefined when using measure function. For details, see changes.

Follow-up of #3598 and #3453.

References:

Changes

  • Changed the return value of native measure function from undefined to null in case of empty layout metrics
  • Fixed type of _measure function in globals.d.ts
  • Added appropriate variant of warning message in case of empty layout metrics
  • Added missing spaces in other warning message in measure function
  • Updated Article Progress Example

Test code and steps to reproduce

Tested on FabricExample app with Article Progress Example.

@tomekzaw tomekzaw requested a review from piaskowyk September 28, 2022 16:07
@tomekzaw tomekzaw marked this pull request as ready for review September 28, 2022 16:07
@piaskowyk piaskowyk merged commit 7ac8152 into main Sep 29, 2022
@piaskowyk piaskowyk deleted the @tomekzaw/fix-fabric-measure-undefined branch September 29, 2022 10:27
piaskowyk pushed a commit that referenced this pull request Oct 6, 2022
This PR removes error `Cannot read property 'x' of undefined` when using
`measure` function. For details, see changes.

Follow-up of #3598 and #3453.

References:
*
https://github.com/facebook/react-native/blob/278dad6438eac8358a6caaf9dc3b192c0b6137e2/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp#L557-L560
– `measure`
*
https://github.com/facebook/react-native/blob/8bd3edec88148d0ab1f225d2119435681fbbba33/ReactCommon/react/renderer/core/LayoutMetrics.h#L63-L69
– `EmptyLayoutMetrics`

* Changed the return value of native measure function from `undefined`
to `null` in case of empty layout metrics
* Fixed type of `_measure` function in `globals.d.ts`
* Added appropriate variant of warning message in case of empty layout
metrics
* Added missing spaces in other warning message in `measure` function
* Updated Article Progress Example

Tested on FabricExample app with Article Progress Example.
fluiddot pushed a commit to wordpress-mobile/react-native-reanimated that referenced this pull request Jun 5, 2023
…re-mansion#3622)

## Description

This PR removes error `Cannot read property 'x' of undefined` when using
`measure` function. For details, see changes.

Follow-up of software-mansion#3598 and software-mansion#3453.

References:
*
https://github.com/facebook/react-native/blob/278dad6438eac8358a6caaf9dc3b192c0b6137e2/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp#L557-L560
– `measure`
*
https://github.com/facebook/react-native/blob/8bd3edec88148d0ab1f225d2119435681fbbba33/ReactCommon/react/renderer/core/LayoutMetrics.h#L63-L69
– `EmptyLayoutMetrics`

## Changes

* Changed the return value of native measure function from `undefined`
to `null` in case of empty layout metrics
* Fixed type of `_measure` function in `globals.d.ts`
* Added appropriate variant of warning message in case of empty layout
metrics
* Added missing spaces in other warning message in `measure` function
* Updated Article Progress Example

## Test code and steps to reproduce

Tested on FabricExample app with Article Progress Example.
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

Successfully merging this pull request may close these issues.

2 participants