Skip to content

[ui][iOS] - Section docs and improvements#41722

Merged
intergalacticspacehighway merged 10 commits intomainfrom
section-changes
Jan 8, 2026
Merged

[ui][iOS] - Section docs and improvements#41722
intergalacticspacehighway merged 10 commits intomainfrom
section-changes

Conversation

@intergalacticspacehighway
Copy link
Copy Markdown
Contributor

@intergalacticspacehighway intergalacticspacehighway commented Dec 17, 2025

Why

  • Section docs need examples.
  • Section is currently using Text(title).textCase(nil) for rendering title prop. We can use the constructor provided by Section instead, bringing it closer to SwiftUI's API.

How

  • Add examples to Section docs and make it consistent with other component docs.
  • Use title constructor in Section component instead of using custom Text in header.
  • Replaced collapsible prop with isExpanded prop to match with SwiftUI's API.

Test Plan

Checklist

@github-actions
Copy link
Copy Markdown
Contributor

Subscribed to pull request

File Patterns Mentions
docs/** @amandeepmittal
packages/expo-ui/** @aleqsio, @behenate, @douglowder

Generated by CodeMention

@expo-bot expo-bot added the bot: suggestions ExpoBot has some suggestions label Dec 17, 2025
@expo-bot
Copy link
Copy Markdown
Collaborator

expo-bot commented Dec 17, 2025

The Pull Request introduced fingerprint changes against the base commit: d9bc5c5

Fingerprint diff
[
  {
    "op": "changed",
    "beforeSource": {
      "type": "dir",
      "filePath": "../../packages/expo-ui/ios",
      "reasons": [
        "expoAutolinkingIos"
      ],
      "hash": "db024236203c8e6177ee6ef1f4582a1c344259db"
    },
    "afterSource": {
      "type": "dir",
      "filePath": "../../packages/expo-ui/ios",
      "reasons": [
        "expoAutolinkingIos"
      ],
      "hash": "1df337bca8cac4e5694ffc733fc1bcbdef6f0bee"
    }
  }
]

Generated by PR labeler 🤖

@intergalacticspacehighway intergalacticspacehighway marked this pull request as draft December 17, 2025 23:44
@intergalacticspacehighway intergalacticspacehighway marked this pull request as ready for review December 17, 2025 23:45
@expo-bot expo-bot added bot: passed checks ExpoBot has nothing to complain about and removed bot: suggestions ExpoBot has some suggestions labels Dec 17, 2025
Comment on lines +57 to +68
header={
<HStack>
<Image systemName="location.fill" color="blue" size={16} />
<Text>Location Services</Text>
</HStack>
}
footer={
<Text>
Enabling location services allows the app to provide personalized recommendations.
</Text>
}>
<Toggle
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i am personally in favor of compound components (or composite components) style than render props. i'll try it first on jetpack compose. we can figure out different style. that said, it's like

<Section>
  <Section.Header>
    <HStack />
  </Section.Header>
  <Section.Footer>
    <HStack />
  </Section.Footer>
  ...
</Section>

Copy link
Copy Markdown
Contributor Author

@intergalacticspacehighway intergalacticspacehighway Jan 8, 2026

Choose a reason for hiding this comment

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

yeah, i thought about this. One nice thing i noticed with prop approach is supporting below pattern i.e. passing content as children.

<Section header={<Text>Title</Text>}>
  <Text>Hello world 1</Text>
  <Text>Hello world 2</Text>
</Section>

Alternative with composite pattern would be this:

<Section>
  <Section.Header><Text>Title</Text></Section.Header>
  <Section.Content>
    <Text>Hello world 1</Text>
    <Text>Hello world 2</Text>
  </Section.Content>
</Section>

I felt former to be more close to SwiftUI than latter (SwiftUI supports trailing closure for content) and requires less typing 🤔. But we can re-consider it. I also like the explicit nature of composite pattern.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

let's taste the difference upon our swift-ui and jetpack-compose code. we can decide later.
on jetpack-compose, it's heavily uses the render props style, e.g. the placeholder, leadingIcon, trailingIcon, ...etc in TextField. sometimes i feel passing multiple render props in jsx is not quite beautiful, so i would try composite components first.

@Composable
fun TextField(
    state: TextFieldState,
    modifier: Modifier = Modifier,
    enabled: Boolean = true,
    readOnly: Boolean = false,
    textStyle: TextStyle = LocalTextStyle.current,
    labelPosition: TextFieldLabelPosition = TextFieldLabelPosition.Attached(),
    label: @Composable (TextFieldLabelScope.() -> Unit)? = null,
    placeholder: @Composable (() -> Unit)? = null,
    leadingIcon: @Composable (() -> Unit)? = null,
    trailingIcon: @Composable (() -> Unit)? = null,
    prefix: @Composable (() -> Unit)? = null,
    suffix: @Composable (() -> Unit)? = null,
    supportingText: @Composable (() -> Unit)? = null,
    isError: Boolean = false,
    inputTransformation: InputTransformation? = null,
    outputTransformation: OutputTransformation? = null,
    keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
    onKeyboardAction: KeyboardActionHandler? = null,
    lineLimits: TextFieldLineLimits = TextFieldLineLimits.Default,
    onTextLayout: (Density.(getResult: () -> TextLayoutResult?) -> Unit)? = null,
    scrollState: ScrollState = rememberScrollState(),
    shape: Shape = TextFieldDefaults.shape,
    colors: TextFieldColors = TextFieldDefaults.colors(),
    contentPadding: PaddingValues =
        if (label == null || labelPosition is TextFieldLabelPosition.Above) {
            TextFieldDefaults.contentPaddingWithoutLabel()
        } else {
            TextFieldDefaults.contentPaddingWithLabel()
        },
    interactionSource: MutableInteractionSource? = null,
)

@intergalacticspacehighway intergalacticspacehighway merged commit 30e7b6c into main Jan 8, 2026
14 checks passed
@intergalacticspacehighway intergalacticspacehighway deleted the section-changes branch January 8, 2026 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot: fingerprint changed bot: passed checks ExpoBot has nothing to complain about

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants