@wordpress/components
Version:
UI components for WordPress.
34 lines (32 loc) • 879 B
JavaScript
import _extends from "@babel/runtime/helpers/esm/extends";
import { createElement } from "@wordpress/element";
/**
* External dependencies
*/
import { FlatList } from 'react-native';
import Animated, { useAnimatedScrollHandler } from 'react-native-reanimated';
/**
* Internal dependencies
*/
import KeyboardAvoidingView from '../keyboard-avoiding-view';
const AnimatedFlatList = Animated.createAnimatedComponent(FlatList);
export const KeyboardAwareFlatList = _ref => {
let {
innerRef,
onScroll,
...props
} = _ref;
const scrollHandler = useAnimatedScrollHandler({
onScroll
});
return createElement(KeyboardAvoidingView, {
style: {
flex: 1
}
}, createElement(AnimatedFlatList, _extends({
ref: innerRef,
onScroll: scrollHandler
}, props)));
};
export default KeyboardAwareFlatList;
//# sourceMappingURL=index.android.js.map