UNPKG

3.17 kBSource Map (JSON)View Raw
1{"version":3,"sources":["ActionSheetProvider.tsx"],"names":["React","NativeActionSheet","CustomActionSheet","Provider","forwardRef","ActionSheetProvider","ref","children","useNativeDriver","useCustomActionSheet","actionSheetRef","useRef","context","useMemo","showActionSheetWithOptions","options","callback","current","useImperativeHandle","getContext","ActionSheet","Children","only"],"mappings":"qHAAA,MAAO,GAAKA,CAAAA,KAAZ,KAAuB,OAAvB,CAGA,MAAOC,CAAAA,iBAAP,KAA8B,eAA9B,CACA,MAAOC,CAAAA,iBAAP,KAA8B,iCAA9B,CACA,OAASC,QAAT,KAAyB,WAAzB,CASA,cAAeH,CAAAA,KAAK,CAACI,UAAN,CAAgD,QAASC,CAAAA,mBAAT,MAE7DC,GAF6D,CAG7D,IAFEC,CAAAA,QAEF,MAFEA,QAEF,CAFYC,eAEZ,MAFYA,eAEZ,4BAF6BC,oBAE7B,CAF6BA,oBAE7B,gCAFoD,KAEpD,uBACA,GAAMC,CAAAA,cAAc,CAAGV,KAAK,CAACW,MAAN,CAAgC,IAAhC,CAAvB,CAEA,GAAMC,CAAAA,OAAO,CAAGZ,KAAK,CAACa,OAAN,CACd,iBAAO,CACLC,0BAA0B,CAAE,oCAACC,OAAD,CAA8BC,QAA9B,CAAgE,CAC1F,GAAIN,cAAc,CAACO,OAAnB,CAA4B,CAC1BP,cAAc,CAACO,OAAf,CAAuBH,0BAAvB,CAAkDC,OAAlD,CAA2DC,QAA3D,EACD,CACF,CALI,CAAP,EADc,CAQd,CAACN,cAAD,CARc,CAAhB,CAWAV,KAAK,CAACkB,mBAAN,CACEZ,GADF,CAEE,iBAAO,CAELa,UAAU,CAAE,4BAAMP,CAAAA,OAAN,EAFP,CAGLE,0BAA0B,CAAEF,OAAO,CAACE,0BAH/B,CAAP,EAFF,CAOE,CAACF,OAAD,CAPF,EAUA,GAAMQ,CAAAA,WAAW,CAAGpB,KAAK,CAACa,OAAN,CAClB,iBAAOJ,CAAAA,oBAAoB,CAAGP,iBAAH,CAAuBD,iBAAlD,EADkB,CAElB,CAACQ,oBAAD,CAFkB,CAApB,CAKA,MACE,qBAAC,QAAD,EAAU,KAAK,CAAEG,OAAjB,gEACE,oBAAC,WAAD,EAAa,GAAG,CAAEF,cAAlB,CAAkC,eAAe,CAAEF,eAAnD,gEACGR,KAAK,CAACqB,QAAN,CAAeC,IAAf,CAAoBf,QAApB,CADH,CADF,CADF,CAOD,CAvCc,CAAf","sourcesContent":["import * as React from 'react';\n\n// NativeActionSheet will always be custom when on Android/web\nimport NativeActionSheet from './ActionSheet';\nimport CustomActionSheet from './ActionSheet/CustomActionSheet';\nimport { Provider } from './context';\nimport { ActionSheetOptions, ActionSheetProviderRef } from './types';\n\ninterface Props {\n children: React.ReactNode;\n useNativeDriver?: boolean;\n useCustomActionSheet?: boolean;\n}\n\nexport default React.forwardRef<ActionSheetProviderRef, Props>(function ActionSheetProvider(\n { children, useNativeDriver, useCustomActionSheet = false },\n ref\n) {\n const actionSheetRef = React.useRef<NativeActionSheet>(null);\n\n const context = React.useMemo(\n () => ({\n showActionSheetWithOptions: (options: ActionSheetOptions, callback: (i: number) => void) => {\n if (actionSheetRef.current) {\n actionSheetRef.current.showActionSheetWithOptions(options, callback);\n }\n },\n }),\n [actionSheetRef]\n );\n\n React.useImperativeHandle(\n ref,\n () => ({\n // backwards compatible with 13.x before context was being passed right on the ref\n getContext: () => context,\n showActionSheetWithOptions: context.showActionSheetWithOptions,\n }),\n [context]\n );\n\n const ActionSheet = React.useMemo(\n () => (useCustomActionSheet ? CustomActionSheet : NativeActionSheet),\n [useCustomActionSheet]\n );\n\n return (\n <Provider value={context}>\n <ActionSheet ref={actionSheetRef} useNativeDriver={useNativeDriver}>\n {React.Children.only(children)}\n </ActionSheet>\n </Provider>\n );\n});\n"]}
\No newline at end of file