react-native-true-sheet/ios/TrueSheetHeaderView.h
Jovanni Lo 7d969d29b9
feat: add support for Header (#233)
* feat(android): add immediate state update with screen width on initialization

- Add getScreenWidth() utility method to ScreenUtils for consistent screen calculations
- Update TrueSheetView to immediately update state when stateWrapper is set
- Ensures initial container width is available before controller emits size changes
- Improves initial render performance and prevents layout shift

* fix(ios): move state update to didLayoutSubviews for more accurate size

- Reset _lastStateSize in prepareForRecycle
- Updated example sheets

* fix(android): fix proper container height calculation

* feat: add native header view component

- Add TrueSheetHeaderView native component for iOS and Android
- Add header prop to TrueSheet component
- Subtract header height from container height in state for proper content layout
- Update documentation for header feature

* refactor(android): better content height lifecycle

* fix(android): handle header size changes

* feat(ios): add header height to auto detent calculation

- Add headerHeight property to TrueSheetViewController
- Include header height in totalHeight for auto detent calculation
- Implement containerViewHeaderDidChangeSize delegate in TrueSheetView
- Add headerHeight method to TrueSheetContainerView
- Simplify scroll view pinning by passing header view directly
- Re-apply scroll view pinning when header is added/removed
- Update TrueSheetHeaderView registration in package.json codegenConfig
- Update AGENTS.md with current project structure
- Simplify migration.mdx examples

* fix(ios): always re-apply scroll view pinning on header change

* fix(ios): properly re-pin scroll view when header changes

- Rename pinScrollView to scrollViewPinningEnabled for clarity
- Track scrollViewPinningSet flag to handle header mount/unmount
- Re-apply scroll view pinning when header is mounted/unmounted
- Fix unpinView to remove constraints from parent view
- Call headerDidChangeSize delegate on header mount/unmount

* feat: add all ViewProps to sheet

* docs: move scrolling caution to troubleshooting and add minHeight workaround

* fix(android): fix proper ...rest props

* docs: update migration

* fix(android): reconfigure sheet when header size changes

* fix(android): footer touch events when sheet is fully expanded
2025-11-26 23:24:33 +08:00

30 lines
629 B
Objective-C

//
// Created by Jovanni Lo (@lodev09)
// Copyright (c) 2024-present. All rights reserved.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.
//
#ifdef RCT_NEW_ARCH_ENABLED
#import <React/RCTViewComponentView.h>
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@protocol TrueSheetHeaderViewDelegate <NSObject>
@optional
- (void)headerViewDidChangeSize:(CGSize)size;
@end
@interface TrueSheetHeaderView : RCTViewComponentView
@property (nonatomic, weak, nullable) id<TrueSheetHeaderViewDelegate> delegate;
@end
NS_ASSUME_NONNULL_END
#endif