This repository has been archived on 2022-03-12. You can view files and clone it, but cannot push or open issues or pull requests.

29 lines
710 B
JavaScript
Raw Permalink Normal View History

2021-04-02 02:24:13 +03:00
import React from 'react';
import { StyleSheet } from 'react-native';
import hoistNonReactStatics from 'hoist-non-react-statics';
import GestureHandlerRootView from './GestureHandlerRootView';
export default function gestureHandlerRootHOC(
Component,
containerStyles = undefined
) {
function Wrapper(props) {
return (
<GestureHandlerRootView style={[styles.container, containerStyles]}>
<Component {...props} />
</GestureHandlerRootView>
);
}
Wrapper.displayName = `gestureHandlerRootHOC(${Component.displayName ||
Component.name})`;
hoistNonReactStatics(Wrapper, Component);
return Wrapper;
}
const styles = StyleSheet.create({
container: { flex: 1 },
});