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

Implement clientWidth/clientHeight in ReadOnlyElement #39305

Closed
wants to merge 2 commits into from

Conversation

rubennorte
Copy link
Contributor

Summary:
This adds a new method in Fabric to get the inner size for an element (whole size excluding borders, which would be the scrollable size of the element), and uses it to implement the following methods as defined in react-native-community/discussions-and-proposals#607 :
clientWidth: width of the element excluding the size of the left and right border.
clientHeight: height of the element excluding the size of the top and bottom border.

If the element isn't displayed or it has display: inline, it return 0 in both cases.

These APIs provided rounded integers.

Changelog: [internal]

Differential Revision: D49008698

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner labels Sep 6, 2023
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D49008698

@analysis-bot
Copy link

analysis-bot commented Sep 6, 2023

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 8,964,055 +1,529
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 9,555,862 +1,577
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: 2608a37
Branch: main

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D49008698

rubennorte added a commit to rubennorte/react-native that referenced this pull request Sep 6, 2023
Summary:
Pull Request resolved: facebook#39305

This adds a new method in Fabric to get the inner size for an element (whole size excluding borders, which would be the scrollable size of the element), and uses it to implement the following methods as defined in react-native-community/discussions-and-proposals#607 :
`clientWidth`: width of the element excluding the size of the left and right border.
`clientHeight`: height of the element excluding the size of the top and bottom border.

If the element isn't displayed or it has display: inline, it return `0` in both cases.

These APIs provided rounded integers.

Changelog: [internal]

Reviewed By: mdvacca

Differential Revision: D49008698

fbshipit-source-id: ba08978bb19fc3b639fbe0f1bd478b2c9497cb5b
@joe-sam
Copy link

joe-sam commented Sep 6, 2023

This maybe a typo ReactOnlyElement should probably read as ReadOnlyElement for consistency with clientTop/clientLeft api.

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D49008698

rubennorte added a commit to rubennorte/react-native that referenced this pull request Sep 7, 2023
Summary:
Pull Request resolved: facebook#39305

This adds a new method in Fabric to get the inner size for an element (whole size excluding borders, which would be the scrollable size of the element), and uses it to implement the following methods as defined in react-native-community/discussions-and-proposals#607 :
`clientWidth`: width of the element excluding the size of the left and right border.
`clientHeight`: height of the element excluding the size of the top and bottom border.

If the element isn't displayed or it has display: inline, it return `0` in both cases.

These APIs provided rounded integers.

Changelog: [internal]

Differential Revision: D49008698

fbshipit-source-id: a00851c55af21057bea228dee32be5175748b32f
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D49008698

rubennorte added a commit to rubennorte/react-native that referenced this pull request Sep 7, 2023
Summary:
Pull Request resolved: facebook#39305

This adds a new method in Fabric to get the inner size for an element (whole size excluding borders, which would be the scrollable size of the element), and uses it to implement the following methods as defined in react-native-community/discussions-and-proposals#607 :
`clientWidth`: width of the element excluding the size of the left and right border.
`clientHeight`: height of the element excluding the size of the top and bottom border.

If the element isn't displayed or it has display: inline, it return `0` in both cases.

These APIs provided rounded integers.

Changelog: [internal]

Reviewed By: NickGerleman

Differential Revision: D49008698

fbshipit-source-id: 46304d16a70acf1f2e5da7dd74cded0dc41e9710
@rubennorte rubennorte changed the title Implement clientWidth/clientHeight in ReactOnlyElement Implement clientWidth/clientHeight in ReadOnlyElement Sep 7, 2023
rubennorte and others added 2 commits September 7, 2023 09:51
Differential Revision: D48951824

fbshipit-source-id: b94b88af720ac95fc6fe5d5baf2bc2ede5e79ff7
Summary:
Pull Request resolved: facebook#39305

This adds a new method in Fabric to get the inner size for an element (whole size excluding borders, which would be the scrollable size of the element), and uses it to implement the following methods as defined in react-native-community/discussions-and-proposals#607 :
`clientWidth`: width of the element excluding the size of the left and right border.
`clientHeight`: height of the element excluding the size of the top and bottom border.

If the element isn't displayed or it has display: inline, it return `0` in both cases.

These APIs provided rounded integers.

Changelog: [internal]

Reviewed By: NickGerleman

Differential Revision: D49008698

fbshipit-source-id: e9fc54775f162809b026de23397df9cbe59d8d80
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D49008698

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Sep 7, 2023
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in f1e9a30.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants