Skip to content

Commit 9080f31

Browse files
authored
fix: allow keyboard toolbar take all available space (#865)
## 📜 Description Apply arrow/done paddings on elements level, not entire container, so that conditional rendering will exclude potentially undesired paddings. ## 💡 Motivation and Context Potentially "padding by default" approach may be not desired when you want your custom element (content) to place that space. So in this PR I re-worked an approach, and if done/arrows are hidden, then `content` will fill entire container. Closes #848 Successor of #851 ## 📢 Changelog <!-- High level overview of important changes --> <!-- For example: fixed status bar manipulation; added new types declarations; --> <!-- If your changes don't affect one of platform/language below - then remove this platform/language --> ### JS - removed `paddingHorizontal` from main container; - added container for arrows and apply padding there; - apply padding (+8px) to Done button (to compensate removed padding from main container); ## 🤔 How Has This Been Tested? Tested manually on iPhone 15 Pro (iOS 17.5 Fabric). ## 📸 Screenshots (if appropriate): |No arrows|No done button|No toolbar elements|All elements| |----------|----------------|--------------------|------------| |![image](https://github.com/user-attachments/assets/7062f6cb-cad4-4189-a9a2-f431f7cc729f)|![image](https://github.com/user-attachments/assets/e6a0602a-2b03-4a8a-af6f-eba9c42822ba)|![image](https://github.com/user-attachments/assets/04f1d1a5-7b29-439c-a01d-f7aea92a94f5)|![image](https://github.com/user-attachments/assets/eb88dc89-20e2-418b-8268-7b3f8d8046a3)| ## 📝 Checklist - [x] CI successfully passed - [x] I added new mocks and corresponding unit-tests if library API was changed
1 parent 5b65344 commit 9080f31

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/components/KeyboardToolbar/index.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ const KeyboardToolbar: React.FC<KeyboardToolbarProps> = ({
156156
<View {...rest} style={toolbarStyle} testID={TEST_ID_KEYBOARD_TOOLBAR}>
157157
{blur}
158158
{showArrows && (
159-
<>
159+
<View style={styles.arrows}>
160160
<ButtonContainer
161161
accessibilityHint="Moves focus to the previous field"
162162
accessibilityLabel="Previous"
@@ -185,7 +185,7 @@ const KeyboardToolbar: React.FC<KeyboardToolbarProps> = ({
185185
type="next"
186186
/>
187187
</ButtonContainer>
188-
</>
188+
</View>
189189
)}
190190

191191
<View style={styles.flex} testID={TEST_ID_KEYBOARD_TOOLBAR_CONTENT}>
@@ -222,14 +222,18 @@ const styles = StyleSheet.create({
222222
width: "100%",
223223
flexDirection: "row",
224224
height: KEYBOARD_TOOLBAR_HEIGHT,
225-
paddingHorizontal: 8,
225+
},
226+
arrows: {
227+
flexDirection: "row",
228+
paddingLeft: 8,
226229
},
227230
doneButton: {
228231
fontWeight: "600",
229232
fontSize: 15,
230233
},
231234
doneButtonContainer: {
232-
marginRight: 8,
235+
marginRight: 16,
236+
marginLeft: 8,
233237
},
234238
});
235239

0 commit comments

Comments
 (0)