UNPKG

1.48 kBJavaScriptView Raw
1var _jsxFileName="/home/runner/work/react-native-action-sheet/react-native-action-sheet/src/ActionSheetProvider.tsx";import*as React from'react';import NativeActionSheet from'./ActionSheet';import CustomActionSheet from'./ActionSheet/CustomActionSheet';import{Provider}from'./context';export default React.forwardRef(function ActionSheetProvider(_ref,ref){var children=_ref.children,useNativeDriver=_ref.useNativeDriver,_ref$useCustomActionS=_ref.useCustomActionSheet,useCustomActionSheet=_ref$useCustomActionS===void 0?false:_ref$useCustomActionS;var actionSheetRef=React.useRef(null);var context=React.useMemo(function(){return{showActionSheetWithOptions:function showActionSheetWithOptions(options,callback){if(actionSheetRef.current){actionSheetRef.current.showActionSheetWithOptions(options,callback);}}};},[actionSheetRef]);React.useImperativeHandle(ref,function(){return{getContext:function getContext(){return context;},showActionSheetWithOptions:context.showActionSheetWithOptions};},[context]);var ActionSheet=React.useMemo(function(){return useCustomActionSheet?CustomActionSheet:NativeActionSheet;},[useCustomActionSheet]);return React.createElement(Provider,{value:context,__source:{fileName:_jsxFileName,lineNumber:48,columnNumber:5}},React.createElement(ActionSheet,{ref:actionSheetRef,useNativeDriver:useNativeDriver,__source:{fileName:_jsxFileName,lineNumber:49,columnNumber:7}},React.Children.only(children)));});
2//# sourceMappingURL=ActionSheetProvider.js.map
\No newline at end of file