Skip to content

Instantly share code, notes, and snippets.

@tspike
Created March 25, 2020 16:42
Show Gist options
  • Save tspike/71b716edd4c8c138783e2d1040d8193b to your computer and use it in GitHub Desktop.
Save tspike/71b716edd4c8c138783e2d1040d8193b to your computer and use it in GitHub Desktop.
<FlatList> nested within <Content> workaround
import React from 'react';
import {Content} from 'native-base';
import {KeyboardAwareView} from 'react-native-keyboard-aware-view';
import {SafeAreaView} from 'react-native';
class FlatlistContent extends Content {
render() {
const {
children,
contentContainerStyle,
keyboardShouldPersistTaps,
padder,
} = this.props;
const containerStyle = {
flex: 1,
};
return (
<SafeAreaView style={containerStyle}>
<KeyboardAwareView
keyboardShouldPersistTaps={keyboardShouldPersistTaps || 'handled'}
style={[{padding: padder}, contentContainerStyle]}>
{children}
</KeyboardAwareView>
</SafeAreaView>
);
}
}
export default FlatlistContent;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment