Skip to content

chore: handle keyboard and formsheet together in progress #2923

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

maciekstosio
Copy link
Contributor

@maciekstosio maciekstosio commented May 15, 2025

Description

Changes

Test code and steps to reproduce

import React from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { Button, View, TextInput, Text } from 'react-native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';

const RootStack = createNativeStackNavigator();

function RootStackHost() {
  return (
    <RootStack.Navigator screenOptions={{headerShown: false}}>
      <RootStack.Screen name="Root" component={RootScreen} options={{}} />
      <RootStack.Screen name="FormSheet" component={FormSheet} options={{
        presentation: 'formSheet',
        // sheetAllowedDetents: 'fitToContents',
        sheetAllowedDetents: [0.5, 0.7],
      }} />
    </RootStack.Navigator>
  );
}

const RootScreen = ({navigation}) => (
  <View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
    <TextInput style={{borderColor: '#f0f', borderWidth: 1, padding: 10, backgroundColor: '#fff'}} />
    <Button title="Go to Tabs" onPress={() => navigation.navigate('FormSheet')} />
  </View>
);

const FormSheet = ({navigation}) => {

  return (
      <View style={{
        flex: 1,
        // height: 400,
        borderWidth: 5,
        borderColor: '#ff0',
      }}>
        <Text style={{textAlign: 'center', position: 'absolute'}}>FormSheet</Text>
        <TextInput style={{borderColor: '#f0f', borderWidth: 1, padding: 10, backgroundColor: '#fff'}} />
      </View>
  );
};

function App() {
  return (
    <NavigationContainer>
      <RootStackHost />
    </NavigationContainer>
  );
}
export default App;

Checklist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant