Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign up[InputAccessoryView] Does not support device orientation change #27887
Comments
This comment has been minimized.
This comment has been minimized.
I looked into T27974328, which is a reference to a task in our (Facebook's) internal task tracker, but that task refers to a different issue with InputAccessoryView. From what I could see in a related task, it looks like we're aware that InputAccessoryView doesn't work that great in landscape, and any PR that helps here would be appreciated. |
This comment has been minimized.
This comment has been minimized.
Ok so the reason for
This is because the screen size is calculated once and cached. react-native/React/Base/RCTUtils.m Lines 304 to 310 in 619d5d6 I think the right fix would be to remove the fixed width for the subviews and use AutoLayout constraints. The react-native/Libraries/Text/TextInput/RCTInputAccessoryViewContent.m Lines 67 to 71 in 619d5d6 I am still trying to figure out the lifecycle of view/shadow view/view managers, I shall update here if I make any progress. @hramos @demchenkoalex @PeteTheHeat @janicduplessis Please share your thoughts if any. |
Hi everyone.
I've noticed that InputAccessoryView does not change its width when device orientation changes (related #24473). Moreover, if app is initially ran in landscape mode, right part (usually send button) is going off-screen, see examples below.
As stated in this comment my understanding that this is a known issue and it is being tracked somewhere (
T27974328
?)react-native/Libraries/Text/TextInput/RCTInputAccessoryViewContent.m
Line 26 in 30491a2
I am more than happy to fix this myself and submit a PR, however after 3 hours of trying I just don't know where to go. Maybe somebody can share some thoughts about this issue. My only observation is that the latest PR #21179 with changes to the safe area was using code very similar to https://github.com/stockx/SafeAreaInputAccessoryViewWrapperView/blob/master/SafeAreaInputAccessoryViewWrapperView/Classes/SafeAreaInputAccessoryViewWrapperView.swift and width is resizing normally in this native code, so the problem might be deeper than in the
RCTInputAccessoryViewContent.m
class.React Native version:
Steps To Reproduce
Describe what you expected to happen:
InputAccessoryView's width automatically resizes when changing between portrait and landscape orientation. Trailing layout anchor is preserving safe area boundaries (right now it's off-screen if ran from landscape).
Snack, code example, screenshot, or link to a repository:
https://github.com/facebook/react-native/tree/master/RNTester#30491a208513451efa6c2a62a116c61b21363a22
Ran in portrait mode example GIF: https://imgur.com/a/TE3VxxI
Ran in landscape mode example GIF: https://imgur.com/a/4bt5LPz