You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an app that uses react-native-screen's formsheet presentation.
on iOS the formsheet seems to entirely avoid the keyboard which is interesting. I still have to dig around if it breaks later.
On Android, the keyboard goes over the Formsheet. What is the recommended approach here.
Example Code
import{createStaticNavigation,StaticParamList,useNavigation,}from'@react-navigation/native';import{View,Button,TextInput}from'react-native';import{KeyboardProvider}from'react-native-keyboard-controller';import{createNativeStackNavigator}from'@react-navigation/native-stack';functionHomeScreen(){constnavigation=useNavigation();return(<Viewstyle={{flex: 1,alignItems: 'center',justifyContent: 'center'}}><Buttontitle="Go to Settings"onPress={()=>navigation.navigate('Settings')}/></View>);}functionSettingsScreen(){return(<Viewstyle={{padding: 16}}><TextInputplaceholder="Type here"style={{padding: 12,borderWidth: 1,borderColor: 'black'}}/></View>);}constRootStack=createNativeStackNavigator({screens: {Home: HomeScreen,Settings: {screen: SettingsScreen,options: {presentation: 'formSheet',sheetAllowedDetents: 'fitToContents',},},},});typeRootStackParamList=StaticParamList<typeofRootStack>;declare global {namespaceReactNavigation{interfaceRootParamListextendsRootStackParamList{}}}constNavigation=createStaticNavigation(RootStack);exportdefaultfunctionApp(){return(<KeyboardProvider><Navigation/></KeyboardProvider>);}
I investigated a little bit. It looks like KeyboardStickyView actually works, but somehow it doesn't move inner content. Or maybe it's moving, but maybe sheet has kind of overflow: hidden so that all inner content gets pushed above and becomes invisible 🤷♂️
Keyboard avoiding will have difficult time adjusting in screens with dynamic and unpredictable heights, one way I solved similar problem was forcing form sheet height to '100%'.
Anyways when keyboard is open, it will go to top of the screen even if you don't want it at 100% so why just not fix it at 100%?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi,
I have an app that uses react-native-screen's formsheet presentation.
on iOS the formsheet seems to entirely avoid the keyboard which is interesting. I still have to dig around if it breaks later.
On Android, the keyboard goes over the Formsheet. What is the recommended approach here.
Example Code
Repo
Keyboard Closed
Keyboard Opened
All reactions