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

Update TS docs for contentInsetAdjustmentBehavior #50069

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

steinalex
Copy link

@steinalex steinalex commented Mar 17, 2025

Summary:

Update the TS docs to reflect the default value for contentInsetAdjustmentBehavior. The TS docs suggest it will be automatic however it's actually never.

The default behaviour is correctly specified in the JS docs:

It's also documented as the default in the native module: https://github.com/facebook/react-native/blob/main/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm#L34

Changelog:

[General] [Fixed] - Fix TS docs for contentInsetAdjustmentBehavior

@facebook-github-bot
Copy link
Contributor

Hi @steinalex!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@react-native-bot
Copy link
Collaborator

react-native-bot commented Mar 17, 2025

Warnings
⚠️ 📋 Missing Test Plan - Can you add a Test Plan? To do so, add a "## Test Plan" section to your PR description. A Test Plan lets us know how these changes were tested.

Generated by 🚫 dangerJS against 2305173

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@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. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Mar 17, 2025
@steinalex steinalex changed the title chore: update ts docs for contentInsetAdjustmentBehavior Update TS docs for contentInsetAdjustmentBehavior Mar 17, 2025
@lunaleaps
Copy link
Contributor

Thanks @steinalex for this PR -- just wondering why never is the default when https://developer.apple.com/documentation/uikit/uiscrollview/contentinsetadjustmentbehavior-swift.property mentions it is automatic. I'm not familiar with why there is conflicting information. Could you expand?

@steinalex
Copy link
Author

Hey @lunaleaps! I was a bit confused by the iOS docs too, but I assumed it must be never by default after fixing a navigation bug.

Take a look at this Expo snack and run it on iOS. If you go to the ScrollView and remove contentInsetAdjustmentBehavior or set it to contentInsetAdjustmentBehavior="never" it has the same effect (the first few elements are hidden behind the large title). Only once it's set to automatic does the bug resolve, which made me assume it's default is never.

Sorry I don't have anything more comprehensive than that, at the moment.

@steinalex
Copy link
Author

It was defaulted to never in this PR, if that helps: 9b059b6

@lunaleaps
Copy link
Contributor

Ah I see, so maybe its a react-native specific default. Gotcha, thanks for answering!

@facebook-github-bot
Copy link
Contributor

@lunaleaps has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@@ -405,7 +405,7 @@ export interface ScrollViewPropsIOS {

/**
* This property specifies how the safe area insets are used to modify the content area of the scroll view.
* The default value of this property must be 'automatic'. But the default value is 'never' until RN@0.51.
* The default value of this property is "never". Available on iOS 11 and later.
Copy link
Contributor

@NickGerleman NickGerleman Mar 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current versions of RN don't support anything before 13.4, or maybe even 15, so this could just be removed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback @NickGerleman! I've updated both the JS and TS documentation to remove the iOS specific version part

@facebook-github-bot
Copy link
Contributor

@lunaleaps has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

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. Needs: Author Feedback Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants