@wordpress/components
Version:
UI components for WordPress.
52 lines (47 loc) • 1.74 kB
JavaScript
import { createElement } from "@wordpress/element";
/**
* External dependencies
*/
import { useRoute, useNavigation } from '@react-navigation/native';
/**
* WordPress dependencies
*/
import { useContext, useMemo } from '@wordpress/element';
import { BottomSheetContext } from '@wordpress/components';
/**
* Internal dependencies
*/
import ColorPicker from '../../color-picker';
const PickerScreen = () => {
const route = useRoute();
const navigation = useNavigation();
const {
onShouldEnableInnerHandling,
shouldEnableBottomSheetMaxHeight,
onHandleClosingBottomSheet,
isBottomSheetContentScrolling,
shouldEnableBottomSheetScroll,
onHandleHardwareButtonPress
} = useContext(BottomSheetContext);
const {
setColor,
currentValue,
isGradientColor
} = route.params;
return useMemo(() => {
return createElement(ColorPicker, {
onShouldEnableInnerHandling: onShouldEnableInnerHandling,
shouldEnableBottomSheetMaxHeight: shouldEnableBottomSheetMaxHeight,
setColor: setColor,
activeColor: currentValue,
isGradientColor: isGradientColor,
onNavigationBack: navigation.goBack,
onHandleClosingBottomSheet: onHandleClosingBottomSheet,
isBottomSheetContentScrolling: isBottomSheetContentScrolling,
shouldEnableBottomSheetScroll: shouldEnableBottomSheetScroll,
onHandleHardwareButtonPress: onHandleHardwareButtonPress
});
}, [setColor, currentValue, isGradientColor, onShouldEnableInnerHandling, shouldEnableBottomSheetMaxHeight, onHandleClosingBottomSheet, isBottomSheetContentScrolling, shouldEnableBottomSheetScroll, onHandleHardwareButtonPress]);
};
export default PickerScreen;
//# sourceMappingURL=picker-screen.native.js.map