Skip to content

Commit bf0bc82

Browse files
committed
updated test to work on both iOS and Android
1 parent 952aae8 commit bf0bc82

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

ios/RNNReactTitleView.mm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
@implementation RNNReactTitleView {
44
BOOL _fillParent;
5+
CGFloat _expectedHeight;
56
}
67

78
- (NSString *)componentType {
@@ -10,7 +11,7 @@ - (NSString *)componentType {
1011

1112
- (CGSize)intrinsicContentSize {
1213
if (_fillParent) {
13-
return UILayoutFittingExpandedSize;
14+
return CGSizeMake(UILayoutFittingExpandedSize.width, _expectedHeight > 0 ? _expectedHeight : 44);
1415
} else {
1516
return [super intrinsicContentSize];
1617
}
@@ -19,6 +20,7 @@ - (CGSize)intrinsicContentSize {
1920
- (void)setAlignment:(NSString *)alignment inFrame:(CGRect)frame {
2021
if ([alignment isEqualToString:@"fill"]) {
2122
_fillParent = YES;
23+
_expectedHeight = frame.size.height;
2224
self.translatesAutoresizingMaskIntoConstraints = NO;
2325
self.sizeFlexibility = RCTRootViewSizeFlexibilityNone;
2426
} else {

playground/e2e/Options.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ describe('Options', () => {
5555
await expect(elementByLabel('Title Changed')).toBeVisible();
5656
});
5757

58-
it(':android: TopBar custom title with subtitle should be visible', async () => {
58+
it('TopBar custom title with subtitle should be visible', async () => {
5959
await elementById(TestIDs.GOTO_TOPBAR_TITLE_TEST).tap();
6060
await expect(elementById(TestIDs.TOPBAR_TITLE_TEXT)).toBeVisible();
6161
await expect(elementById(TestIDs.TOPBAR_TITLE_AVATAR)).toBeVisible();
6262
});
6363

64-
it(':android: TopBar custom title without subtitle should be visible', async () => {
64+
it('TopBar custom title without subtitle should be visible', async () => {
6565
await elementById(TestIDs.GOTO_TOPBAR_TITLE_TEST).tap();
6666
await elementById(TestIDs.SET_TOPBAR_WITHOUT_SUBTITLE_BTN).tap();
6767
await expect(elementById(TestIDs.TOPBAR_TITLE_TEXT)).toBeVisible();

playground/src/screens/TopBarTitleTestScreen.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ export default class TopBarTitleTestScreen extends NavigationComponent<Props> {
8888
<Button
8989
label="Without Subtitle (Bug Test)"
9090
testID={SET_TOPBAR_WITHOUT_SUBTITLE_BTN}
91-
platform="android"
9291
onPress={this.setTopBarWithoutSubtitle}
9392
/>
9493
</Root>

0 commit comments

Comments
 (0)