Я использую React Native Scroll View для работы с клавиатурой в моем макете приложения, он отлично работает, но добавляет дополнительные «отступы» или пробелы под моими компонентами.
![enter image description here](https://i.stack.imgur.com/fU7HW.png)
Он уже имеет стиль flex: 1
, чтобы занять все пространство экрана. Вот код jsx
для App.js
<PaperProvider>
<StatusBar
barStyle="dark-content"
hidden={false}
backgroundColor="#00BCD4"
translucent={true}
/>
<KeyboardAwareScrollView
style={{ flex: 1 }}
>
<View style={styles.container}>
<UnitCard />
<UnitCard />
<Converter />
</View>
</KeyboardAwareScrollView>
</PaperProvider>
);
};
const styles = StyleSheet.create({
container: {
display: "flex",
flexDirection: "column",
justifyContent: "center",
flex: 1,
backgroundColor: "#eee",
},
cards: {
flex: 1,
display: "flex",
flexDirection: "row",
alignItems: "center",
justifyContent: "center",
},
});