Skip to content
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

Extra space in KeyboardAccessoryView when using TabNavigation #63

Open
mssod-alfa opened this issue Jan 22, 2021 · 3 comments
Open

Extra space in KeyboardAccessoryView when using TabNavigation #63

mssod-alfa opened this issue Jan 22, 2021 · 3 comments

Comments

@mssod-alfa
Copy link

Hello,

I have created a demo app using the ViewExample Code as component (including a view with a TextInput) inside a TabNavigator. Running the app with IOS Simulator iPhone12 (or iPhone7) there is an extra space below the KeyboardAccessoryView.

Bildschirmfoto 2021-01-22 um 11 26 14

If I use the StackNavigation the app runs correctly. It seems to be, that the height of the extra space below the KeyboardAccessoryView corresponds to the height of the tabbar, which is hidden by the keyboard.

Another observation: In android simulator you can see the tabbar below the KeyboardAccessoryView.

Bildschirmfoto 2021-01-22 um 11 45 01

Has anyone suggestions who to get rid of the extra space under IOS or another solution to create a toolbar which is only visible if the keyboard is open due a text edit?

Many thanks in advance and best regards

`app.js

import { StatusBar } from 'expo-status-bar';
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';

import ViewExample from "./screens/ViewExample";

import { NavigationContainer, useLinking } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';

const Stack = createStackNavigator();
const Tab = createBottomTabNavigator();

export default function App() {
return (

<Tab.Navigator initialRouteName="ViewExample">
<Tab.Screen options={{title: "TAB1"}} name="TAB1" component={TabScreen1} />
<Tab.Screen options={{title: "ViewExample"}} name="ViewExample" component={ViewExample} />
<Tab.Screen options={{title: "TAB2"}} name="TAB2" component={TabScreen2} />
<Tab.Screen options={{title: "TAB3"}} name="TAB3" component={TabScreen3} />
</Tab.Navigator>

);
}

const TabScreen1 = () => {
return (
TAB SCREEN 1
)
}

const TabScreen2 = () => {
return (
TAB SCREEN 1
)
}

const TabScreen3 = () => {
return (
TAB SCREEN 1
)
}

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});`

`ViewExample.js

import React, { Component } from "react";

import { StyleSheet, View, Text, TextInput, Button, ScrollView } from "react-native";

import { KeyboardAccessoryView } from "react-native-keyboard-accessory";

class ViewExample extends Component {
render() {
return (



<Text style={{ padding: 12 }}>Text 1


<Text style={{ padding: 12 }}>Text 2


<TextInput style={{ padding: 12 }} placeholder="Eingabe 5" />



{({ isKeyboardVisible }) => (


{isKeyboardVisible && (
<Button
style={styles.textInputButton}
title="Send"
onPress={() => {}}
/>
)}

)}


);
}
}

ViewExample.navigationOptions = {
title: "View Example",
};

const styles = StyleSheet.create({
container: {
flex: 1,
},
textInputView: {
padding: 8,
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center",
},
textInput: {
flexGrow: 1,
borderWidth: 1,
borderRadius: 10,
borderColor: "#CCC",
padding: 10,
fontSize: 16,
marginRight: 10,
textAlignVertical: "top",
},
textInputButton: {
flexShrink: 1,
},
});

export default ViewExample;`

@Brma1048
Copy link

Brma1048 commented Apr 1, 2021

@mssod-alfa did you find any solution?

@mssod-alfa
Copy link
Author

No, the problem still exists.

@SVPetrenko
Copy link

SVPetrenko commented Jun 14, 2023

@mssod-alfa , @Brma1048
Solution for this issue is addressed here. Please check it.

#47 (comment)

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

No branches or pull requests

3 participants