Skip to content

feat: insets prop for KeyboardToolbar#866

Merged
kirillzyusko merged 1 commit intomainfrom
feat/keyboard-toolbar-insets-prop
Mar 18, 2025
Merged

feat: insets prop for KeyboardToolbar#866
kirillzyusko merged 1 commit intomainfrom
feat/keyboard-toolbar-insets-prop

Conversation

@kirillzyusko
Copy link
Copy Markdown
Owner

@kirillzyusko kirillzyusko commented Mar 17, 2025

📜 Description

Handle safe-area paddings in KeyboardToolbar component (landscape mode).

💡 Motivation and Context

I had a lot of ideas how to fix this problem. Some of them:

  • pass insets as prop;
  • automatically grab insets from useSafeAreaInsets hook;
  • render view wrapper (users can add their own SafeAreaView implementation).

The automatically grab insets from useSafeAreaInsets hook idea has failed, because in my case react-native-safe-area-context was resolving to other packages (maybe it's the problem with package linking in example app). But this is still not a perfect approach, because I'll force users to install additional package.

The render view wrapper (users can add their own SafeAreaView implementation) was perspective, but it would be very complex for end users. Mostly because we have to provide additional props, such as backgroundColor etc., so it would look like:

<KeyboardToolbar
  wrapper={(props) => <SafeAreaView {...props} />}
/>

And there is still a lot of open topics on how to handle many aspects - we would have to write conditional code when wrapper is not provided and render View.

So in the end I decided to add insets property - and it would be up to lib users to provide it or not. Maybe not ideal solution, but definitely better than having an open issues for 9+ months 🙃

Closes #572

📢 Changelog

JS

  • added new insets property.

🤔 How Has This Been Tested?

Tested manually on iPhone 15 (iOS 17.5), Fabric.

📸 Screenshots (if appropriate):

Before After
image image

📝 Checklist

  • CI successfully passed
  • I added new mocks and corresponding unit-tests if library API was changed

@kirillzyusko kirillzyusko added enhancement New feature or request KeyboardToolbar Anything related to KeyboardToolbar component labels Mar 17, 2025
@kirillzyusko kirillzyusko self-assigned this Mar 17, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 17, 2025

📊 Package size report

Current size Target Size Difference
170428 bytes 169970 bytes 458 bytes 📈

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 17, 2025

PR Preview Action v1.6.0
Preview removed because the pull request was closed.
2025-03-18 18:33 UTC

@argos-ci
Copy link
Copy Markdown

argos-ci Bot commented Mar 17, 2025

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) 👍 Changes approved 3 changed Mar 17, 2025, 2:57 PM

@kirillzyusko kirillzyusko force-pushed the feat/keyboard-toolbar-insets-prop branch from 9c22330 to b36a7f2 Compare March 17, 2025 14:54
@kirillzyusko kirillzyusko marked this pull request as ready for review March 18, 2025 18:30
@kirillzyusko kirillzyusko merged commit cb8161c into main Mar 18, 2025
17 checks passed
@kirillzyusko kirillzyusko deleted the feat/keyboard-toolbar-insets-prop branch March 18, 2025 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request KeyboardToolbar Anything related to KeyboardToolbar component

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IOS: KeyboardToolbar does not respect safe area in landscape orientation

1 participant