@fto-consult/expo-ui 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/adaptive-icon.png +0 -0
- package/assets/add_photo.png +0 -0
- package/assets/favicon.png +0 -0
- package/assets/icon.png +0 -0
- package/assets/logo.png +0 -0
- package/assets/splash.png +0 -0
- package/babel.config.alias.js +32 -0
- package/babel.config.js +18 -0
- package/circular-dependencies.js +24 -0
- package/compiler.config.js +28 -0
- package/expo.metro.config.js +27 -0
- package/index.js +21 -0
- package/metro.config.js +1 -0
- package/package.json +60 -0
- package/src/App.js +65 -0
- package/src/Preferences.js +5 -0
- package/src/auth/Login.js +254 -0
- package/src/auth/index.js +3 -0
- package/src/components/ActivityIndicator/index.js +9 -0
- package/src/components/Animations/Animation/index.js +95 -0
- package/src/components/Animations/Animation/utils.js +78 -0
- package/src/components/Animations/OpacityAnimation/index.js +53 -0
- package/src/components/Animations/OpacityAnimation/utils.js +38 -0
- package/src/components/Animations/index.js +6 -0
- package/src/components/AppBar/Content.js +132 -0
- package/src/components/AppBar/index.js +164 -0
- package/src/components/AppBar/utils.js +204 -0
- package/src/components/AutoLink/index.js +45 -0
- package/src/components/Avatar/AutoHeightImage/AnimatableImage.js +22 -0
- package/src/components/Avatar/AutoHeightImage/ImagePolyfill.js +33 -0
- package/src/components/Avatar/AutoHeightImage/cache.js +75 -0
- package/src/components/Avatar/AutoHeightImage/helpers.js +2 -0
- package/src/components/Avatar/AutoHeightImage/index.js +97 -0
- package/src/components/Avatar/Image.js +115 -0
- package/src/components/Avatar/Text.js +74 -0
- package/src/components/Avatar/index.js +89 -0
- package/src/components/BackToTop/index.js +89 -0
- package/src/components/Badge/index.js +141 -0
- package/src/components/Badge/index1.js +34 -0
- package/src/components/BottomSheet/Content.js +19 -0
- package/src/components/BottomSheet/Menu.js +126 -0
- package/src/components/BottomSheet/Provider.js +58 -0
- package/src/components/BottomSheet/Sheet.js +434 -0
- package/src/components/BottomSheet/index.js +8 -0
- package/src/components/BottomSheet/utils.js +30 -0
- package/src/components/Br/index.js +4 -0
- package/src/components/Br/index.web.js +3 -0
- package/src/components/Browser/index.js +4 -0
- package/src/components/Button/index.js +465 -0
- package/src/components/CardView/index.android.js +55 -0
- package/src/components/CardView/index.ios.js +36 -0
- package/src/components/CardView/index.web.js +3 -0
- package/src/components/Chart/appexchart.3.5.text +14 -0
- package/src/components/Chart/index.js +22 -0
- package/src/components/Chart/index.native.js +61 -0
- package/src/components/Chart/utils.js +0 -0
- package/src/components/Checkbox/index.js +178 -0
- package/src/components/Chip/index.js +350 -0
- package/src/components/Color/ColorPicker.js +724 -0
- package/src/components/Color/assets/black-gradient-rotated.png +0 -0
- package/src/components/Color/assets/black-gradient.png +0 -0
- package/src/components/Color/assets/color-wheel.png +0 -0
- package/src/components/Color/index.js +158 -0
- package/src/components/ContentLoader/BarChar.js +19 -0
- package/src/components/ContentLoader/Circle.js +3 -0
- package/src/components/ContentLoader/Circle.web.js +3 -0
- package/src/components/ContentLoader/Datagrid.js +28 -0
- package/src/components/ContentLoader/Form.js +39 -0
- package/src/components/ContentLoader/Loader/RLoader/index.js +3 -0
- package/src/components/ContentLoader/Loader/RLoader/index.web.js +3 -0
- package/src/components/ContentLoader/Loader/index.js +20 -0
- package/src/components/ContentLoader/PieChart.js +22 -0
- package/src/components/ContentLoader/Placeholder/Placeholder.js +52 -0
- package/src/components/ContentLoader/Placeholder/PlaceholderLine.js +59 -0
- package/src/components/ContentLoader/Placeholder/PlaceholderMedia.js +47 -0
- package/src/components/ContentLoader/Placeholder/animations/Fade.js +58 -0
- package/src/components/ContentLoader/Placeholder/animations/Loader.js +24 -0
- package/src/components/ContentLoader/Placeholder/animations/Progressive.js +62 -0
- package/src/components/ContentLoader/Placeholder/animations/Raw.js +4 -0
- package/src/components/ContentLoader/Placeholder/animations/Shine.js +56 -0
- package/src/components/ContentLoader/Placeholder/animations/ShineOverlay.js +56 -0
- package/src/components/ContentLoader/Placeholder/animations/context.js +4 -0
- package/src/components/ContentLoader/Placeholder/index.js +12 -0
- package/src/components/ContentLoader/Placeholder/tokens.js +9 -0
- package/src/components/ContentLoader/Profile.js +27 -0
- package/src/components/ContentLoader/Rect.js +3 -0
- package/src/components/ContentLoader/Rect.web.js +3 -0
- package/src/components/ContentLoader/Skeleton.js +145 -0
- package/src/components/ContentLoader/Table.js +69 -0
- package/src/components/ContentLoader/TaskList.js +27 -0
- package/src/components/ContentLoader/index copy.js +148 -0
- package/src/components/ContentLoader/index.js +151 -0
- package/src/components/ContentLoader/utils.js +8 -0
- package/src/components/CountUp/index.js +67 -0
- package/src/components/Countries/SelectCountry.js +65 -0
- package/src/components/Countries/index.js +5 -0
- package/src/components/Countries/resources/countries.json +1746 -0
- package/src/components/Countries/resources/flags/images/ad.png +0 -0
- package/src/components/Countries/resources/flags/images/ae.png +0 -0
- package/src/components/Countries/resources/flags/images/af.png +0 -0
- package/src/components/Countries/resources/flags/images/ag.png +0 -0
- package/src/components/Countries/resources/flags/images/ai.png +0 -0
- package/src/components/Countries/resources/flags/images/al.png +0 -0
- package/src/components/Countries/resources/flags/images/am.png +0 -0
- package/src/components/Countries/resources/flags/images/ao.png +0 -0
- package/src/components/Countries/resources/flags/images/ar.png +0 -0
- package/src/components/Countries/resources/flags/images/as.png +0 -0
- package/src/components/Countries/resources/flags/images/at.png +0 -0
- package/src/components/Countries/resources/flags/images/au.png +0 -0
- package/src/components/Countries/resources/flags/images/aw.png +0 -0
- package/src/components/Countries/resources/flags/images/ax.png +0 -0
- package/src/components/Countries/resources/flags/images/az.png +0 -0
- package/src/components/Countries/resources/flags/images/ba.png +0 -0
- package/src/components/Countries/resources/flags/images/bb.png +0 -0
- package/src/components/Countries/resources/flags/images/bd.png +0 -0
- package/src/components/Countries/resources/flags/images/be.png +0 -0
- package/src/components/Countries/resources/flags/images/bf.png +0 -0
- package/src/components/Countries/resources/flags/images/bg.png +0 -0
- package/src/components/Countries/resources/flags/images/bh.png +0 -0
- package/src/components/Countries/resources/flags/images/bi.png +0 -0
- package/src/components/Countries/resources/flags/images/bj.png +0 -0
- package/src/components/Countries/resources/flags/images/bl.png +0 -0
- package/src/components/Countries/resources/flags/images/bm.png +0 -0
- package/src/components/Countries/resources/flags/images/bn.png +0 -0
- package/src/components/Countries/resources/flags/images/bo.png +0 -0
- package/src/components/Countries/resources/flags/images/bq.png +0 -0
- package/src/components/Countries/resources/flags/images/br.png +0 -0
- package/src/components/Countries/resources/flags/images/bs.png +0 -0
- package/src/components/Countries/resources/flags/images/bt.png +0 -0
- package/src/components/Countries/resources/flags/images/bw.png +0 -0
- package/src/components/Countries/resources/flags/images/by.png +0 -0
- package/src/components/Countries/resources/flags/images/bz.png +0 -0
- package/src/components/Countries/resources/flags/images/ca.png +0 -0
- package/src/components/Countries/resources/flags/images/cc.png +0 -0
- package/src/components/Countries/resources/flags/images/cd.png +0 -0
- package/src/components/Countries/resources/flags/images/cf.png +0 -0
- package/src/components/Countries/resources/flags/images/cg.png +0 -0
- package/src/components/Countries/resources/flags/images/ch.png +0 -0
- package/src/components/Countries/resources/flags/images/ci.png +0 -0
- package/src/components/Countries/resources/flags/images/ck.png +0 -0
- package/src/components/Countries/resources/flags/images/cl.png +0 -0
- package/src/components/Countries/resources/flags/images/cm.png +0 -0
- package/src/components/Countries/resources/flags/images/cn.png +0 -0
- package/src/components/Countries/resources/flags/images/co.png +0 -0
- package/src/components/Countries/resources/flags/images/cr.png +0 -0
- package/src/components/Countries/resources/flags/images/cu.png +0 -0
- package/src/components/Countries/resources/flags/images/cv.png +0 -0
- package/src/components/Countries/resources/flags/images/cw.png +0 -0
- package/src/components/Countries/resources/flags/images/cx.png +0 -0
- package/src/components/Countries/resources/flags/images/cy.png +0 -0
- package/src/components/Countries/resources/flags/images/cz.png +0 -0
- package/src/components/Countries/resources/flags/images/de.png +0 -0
- package/src/components/Countries/resources/flags/images/dj.png +0 -0
- package/src/components/Countries/resources/flags/images/dk.png +0 -0
- package/src/components/Countries/resources/flags/images/dm.png +0 -0
- package/src/components/Countries/resources/flags/images/do.png +0 -0
- package/src/components/Countries/resources/flags/images/dz.png +0 -0
- package/src/components/Countries/resources/flags/images/ec.png +0 -0
- package/src/components/Countries/resources/flags/images/ee.png +0 -0
- package/src/components/Countries/resources/flags/images/eg.png +0 -0
- package/src/components/Countries/resources/flags/images/eh.png +0 -0
- package/src/components/Countries/resources/flags/images/er.png +0 -0
- package/src/components/Countries/resources/flags/images/es.png +0 -0
- package/src/components/Countries/resources/flags/images/et.png +0 -0
- package/src/components/Countries/resources/flags/images/fi.png +0 -0
- package/src/components/Countries/resources/flags/images/fj.png +0 -0
- package/src/components/Countries/resources/flags/images/fk.png +0 -0
- package/src/components/Countries/resources/flags/images/fm.png +0 -0
- package/src/components/Countries/resources/flags/images/fo.png +0 -0
- package/src/components/Countries/resources/flags/images/fr.png +0 -0
- package/src/components/Countries/resources/flags/images/ga.png +0 -0
- package/src/components/Countries/resources/flags/images/gb.png +0 -0
- package/src/components/Countries/resources/flags/images/gd.png +0 -0
- package/src/components/Countries/resources/flags/images/ge.png +0 -0
- package/src/components/Countries/resources/flags/images/gf.png +0 -0
- package/src/components/Countries/resources/flags/images/gg.png +0 -0
- package/src/components/Countries/resources/flags/images/gh.png +0 -0
- package/src/components/Countries/resources/flags/images/gi.png +0 -0
- package/src/components/Countries/resources/flags/images/gm.png +0 -0
- package/src/components/Countries/resources/flags/images/gn.png +0 -0
- package/src/components/Countries/resources/flags/images/gp.png +0 -0
- package/src/components/Countries/resources/flags/images/gq.png +0 -0
- package/src/components/Countries/resources/flags/images/gr.png +0 -0
- package/src/components/Countries/resources/flags/images/gt.png +0 -0
- package/src/components/Countries/resources/flags/images/gu.png +0 -0
- package/src/components/Countries/resources/flags/images/gw.png +0 -0
- package/src/components/Countries/resources/flags/images/gy.png +0 -0
- package/src/components/Countries/resources/flags/images/hk.png +0 -0
- package/src/components/Countries/resources/flags/images/hn.png +0 -0
- package/src/components/Countries/resources/flags/images/hr.png +0 -0
- package/src/components/Countries/resources/flags/images/ht.png +0 -0
- package/src/components/Countries/resources/flags/images/hu.png +0 -0
- package/src/components/Countries/resources/flags/images/id.png +0 -0
- package/src/components/Countries/resources/flags/images/ie.png +0 -0
- package/src/components/Countries/resources/flags/images/il.png +0 -0
- package/src/components/Countries/resources/flags/images/im.png +0 -0
- package/src/components/Countries/resources/flags/images/in.png +0 -0
- package/src/components/Countries/resources/flags/images/io.png +0 -0
- package/src/components/Countries/resources/flags/images/iq.png +0 -0
- package/src/components/Countries/resources/flags/images/ir.png +0 -0
- package/src/components/Countries/resources/flags/images/is.png +0 -0
- package/src/components/Countries/resources/flags/images/it.png +0 -0
- package/src/components/Countries/resources/flags/images/je.png +0 -0
- package/src/components/Countries/resources/flags/images/jm.png +0 -0
- package/src/components/Countries/resources/flags/images/jo.png +0 -0
- package/src/components/Countries/resources/flags/images/jp.png +0 -0
- package/src/components/Countries/resources/flags/images/ke.png +0 -0
- package/src/components/Countries/resources/flags/images/kg.png +0 -0
- package/src/components/Countries/resources/flags/images/kh.png +0 -0
- package/src/components/Countries/resources/flags/images/ki.png +0 -0
- package/src/components/Countries/resources/flags/images/km.png +0 -0
- package/src/components/Countries/resources/flags/images/kn.png +0 -0
- package/src/components/Countries/resources/flags/images/kp.png +0 -0
- package/src/components/Countries/resources/flags/images/kr.png +0 -0
- package/src/components/Countries/resources/flags/images/ks.png +0 -0
- package/src/components/Countries/resources/flags/images/kw.png +0 -0
- package/src/components/Countries/resources/flags/images/ky.png +0 -0
- package/src/components/Countries/resources/flags/images/kz.png +0 -0
- package/src/components/Countries/resources/flags/images/la.png +0 -0
- package/src/components/Countries/resources/flags/images/lb.png +0 -0
- package/src/components/Countries/resources/flags/images/lc.png +0 -0
- package/src/components/Countries/resources/flags/images/li.png +0 -0
- package/src/components/Countries/resources/flags/images/lk.png +0 -0
- package/src/components/Countries/resources/flags/images/lr.png +0 -0
- package/src/components/Countries/resources/flags/images/ls.png +0 -0
- package/src/components/Countries/resources/flags/images/lt.png +0 -0
- package/src/components/Countries/resources/flags/images/lu.png +0 -0
- package/src/components/Countries/resources/flags/images/lv.png +0 -0
- package/src/components/Countries/resources/flags/images/ly.png +0 -0
- package/src/components/Countries/resources/flags/images/ma.png +0 -0
- package/src/components/Countries/resources/flags/images/mc.png +0 -0
- package/src/components/Countries/resources/flags/images/md.png +0 -0
- package/src/components/Countries/resources/flags/images/me.png +0 -0
- package/src/components/Countries/resources/flags/images/mf.png +0 -0
- package/src/components/Countries/resources/flags/images/mg.png +0 -0
- package/src/components/Countries/resources/flags/images/mh.png +0 -0
- package/src/components/Countries/resources/flags/images/mk.png +0 -0
- package/src/components/Countries/resources/flags/images/ml.png +0 -0
- package/src/components/Countries/resources/flags/images/mm.png +0 -0
- package/src/components/Countries/resources/flags/images/mn.png +0 -0
- package/src/components/Countries/resources/flags/images/mo.png +0 -0
- package/src/components/Countries/resources/flags/images/mp.png +0 -0
- package/src/components/Countries/resources/flags/images/mq.png +0 -0
- package/src/components/Countries/resources/flags/images/mr.png +0 -0
- package/src/components/Countries/resources/flags/images/ms.png +0 -0
- package/src/components/Countries/resources/flags/images/mt.png +0 -0
- package/src/components/Countries/resources/flags/images/mu.png +0 -0
- package/src/components/Countries/resources/flags/images/mv.png +0 -0
- package/src/components/Countries/resources/flags/images/mw.png +0 -0
- package/src/components/Countries/resources/flags/images/mx.png +0 -0
- package/src/components/Countries/resources/flags/images/my.png +0 -0
- package/src/components/Countries/resources/flags/images/mz.png +0 -0
- package/src/components/Countries/resources/flags/images/na.png +0 -0
- package/src/components/Countries/resources/flags/images/nc.png +0 -0
- package/src/components/Countries/resources/flags/images/ne.png +0 -0
- package/src/components/Countries/resources/flags/images/nf.png +0 -0
- package/src/components/Countries/resources/flags/images/ng.png +0 -0
- package/src/components/Countries/resources/flags/images/ni.png +0 -0
- package/src/components/Countries/resources/flags/images/nl.png +0 -0
- package/src/components/Countries/resources/flags/images/no.png +0 -0
- package/src/components/Countries/resources/flags/images/np.png +0 -0
- package/src/components/Countries/resources/flags/images/nr.png +0 -0
- package/src/components/Countries/resources/flags/images/nu.png +0 -0
- package/src/components/Countries/resources/flags/images/nz.png +0 -0
- package/src/components/Countries/resources/flags/images/om.png +0 -0
- package/src/components/Countries/resources/flags/images/pa.png +0 -0
- package/src/components/Countries/resources/flags/images/pe.png +0 -0
- package/src/components/Countries/resources/flags/images/pf.png +0 -0
- package/src/components/Countries/resources/flags/images/pg.png +0 -0
- package/src/components/Countries/resources/flags/images/ph.png +0 -0
- package/src/components/Countries/resources/flags/images/pk.png +0 -0
- package/src/components/Countries/resources/flags/images/pl.png +0 -0
- package/src/components/Countries/resources/flags/images/pm.png +0 -0
- package/src/components/Countries/resources/flags/images/pr.png +0 -0
- package/src/components/Countries/resources/flags/images/ps.png +0 -0
- package/src/components/Countries/resources/flags/images/pt.png +0 -0
- package/src/components/Countries/resources/flags/images/pw.png +0 -0
- package/src/components/Countries/resources/flags/images/py.png +0 -0
- package/src/components/Countries/resources/flags/images/qa.png +0 -0
- package/src/components/Countries/resources/flags/images/re.png +0 -0
- package/src/components/Countries/resources/flags/images/ro.png +0 -0
- package/src/components/Countries/resources/flags/images/rs.png +0 -0
- package/src/components/Countries/resources/flags/images/ru.png +0 -0
- package/src/components/Countries/resources/flags/images/rw.png +0 -0
- package/src/components/Countries/resources/flags/images/sa.png +0 -0
- package/src/components/Countries/resources/flags/images/sb.png +0 -0
- package/src/components/Countries/resources/flags/images/sc.png +0 -0
- package/src/components/Countries/resources/flags/images/sd.png +0 -0
- package/src/components/Countries/resources/flags/images/se.png +0 -0
- package/src/components/Countries/resources/flags/images/sg.png +0 -0
- package/src/components/Countries/resources/flags/images/sh.png +0 -0
- package/src/components/Countries/resources/flags/images/si.png +0 -0
- package/src/components/Countries/resources/flags/images/sj.png +0 -0
- package/src/components/Countries/resources/flags/images/sk.png +0 -0
- package/src/components/Countries/resources/flags/images/sl.png +0 -0
- package/src/components/Countries/resources/flags/images/sm.png +0 -0
- package/src/components/Countries/resources/flags/images/sn.png +0 -0
- package/src/components/Countries/resources/flags/images/so.png +0 -0
- package/src/components/Countries/resources/flags/images/sr.png +0 -0
- package/src/components/Countries/resources/flags/images/ss.png +0 -0
- package/src/components/Countries/resources/flags/images/st.png +0 -0
- package/src/components/Countries/resources/flags/images/sv.png +0 -0
- package/src/components/Countries/resources/flags/images/sx.png +0 -0
- package/src/components/Countries/resources/flags/images/sy.png +0 -0
- package/src/components/Countries/resources/flags/images/sz.png +0 -0
- package/src/components/Countries/resources/flags/images/tc.png +0 -0
- package/src/components/Countries/resources/flags/images/td.png +0 -0
- package/src/components/Countries/resources/flags/images/tg.png +0 -0
- package/src/components/Countries/resources/flags/images/th.png +0 -0
- package/src/components/Countries/resources/flags/images/tj.png +0 -0
- package/src/components/Countries/resources/flags/images/tk.png +0 -0
- package/src/components/Countries/resources/flags/images/tl.png +0 -0
- package/src/components/Countries/resources/flags/images/tm.png +0 -0
- package/src/components/Countries/resources/flags/images/tn.png +0 -0
- package/src/components/Countries/resources/flags/images/to.png +0 -0
- package/src/components/Countries/resources/flags/images/tr.png +0 -0
- package/src/components/Countries/resources/flags/images/tt.png +0 -0
- package/src/components/Countries/resources/flags/images/tv.png +0 -0
- package/src/components/Countries/resources/flags/images/tw.png +0 -0
- package/src/components/Countries/resources/flags/images/tz.png +0 -0
- package/src/components/Countries/resources/flags/images/ua.png +0 -0
- package/src/components/Countries/resources/flags/images/ug.png +0 -0
- package/src/components/Countries/resources/flags/images/us.png +0 -0
- package/src/components/Countries/resources/flags/images/uy.png +0 -0
- package/src/components/Countries/resources/flags/images/uz.png +0 -0
- package/src/components/Countries/resources/flags/images/va.png +0 -0
- package/src/components/Countries/resources/flags/images/vc.png +0 -0
- package/src/components/Countries/resources/flags/images/ve.png +0 -0
- package/src/components/Countries/resources/flags/images/vg.png +0 -0
- package/src/components/Countries/resources/flags/images/vi.png +0 -0
- package/src/components/Countries/resources/flags/images/vn.png +0 -0
- package/src/components/Countries/resources/flags/images/vu.png +0 -0
- package/src/components/Countries/resources/flags/images/wf.png +0 -0
- package/src/components/Countries/resources/flags/images/ws.png +0 -0
- package/src/components/Countries/resources/flags/images/ye.png +0 -0
- package/src/components/Countries/resources/flags/images/yt.png +0 -0
- package/src/components/Countries/resources/flags/images/za.png +0 -0
- package/src/components/Countries/resources/flags/images/zm.png +0 -0
- package/src/components/Countries/resources/flags/images/zw.png +0 -0
- package/src/components/Countries/resources/flags/index.js +255 -0
- package/src/components/Countries/utils.js +28 -0
- package/src/components/Datagrid/Accordion/AppleSwipeable.js +123 -0
- package/src/components/Datagrid/Accordion/Filters.js +186 -0
- package/src/components/Datagrid/Accordion/GmailSwipeable.js +85 -0
- package/src/components/Datagrid/Accordion/Row.js +295 -0
- package/src/components/Datagrid/Accordion/index.js +719 -0
- package/src/components/Datagrid/Accordion/utils.js +22 -0
- package/src/components/Datagrid/Actions/Header.js +58 -0
- package/src/components/Datagrid/Actions/index.js +104 -0
- package/src/components/Datagrid/Checkbox.js +40 -0
- package/src/components/Datagrid/Common/Common.js +1866 -0
- package/src/components/Datagrid/Common/TableData.js +245 -0
- package/src/components/Datagrid/Common/factory.js +9 -0
- package/src/components/Datagrid/Common/index.js +7 -0
- package/src/components/Datagrid/Common/session.js +20 -0
- package/src/components/Datagrid/Common/setQueryLimit.js +32 -0
- package/src/components/Datagrid/Footer/Footer.js +86 -0
- package/src/components/Datagrid/Footer/index.js +93 -0
- package/src/components/Datagrid/List.js +2 -0
- package/src/components/Datagrid/RenderType.js +53 -0
- package/src/components/Datagrid/RenderTypes/index.native.js +1 -0
- package/src/components/Datagrid/RenderTypes/index.web.js +10 -0
- package/src/components/Datagrid/RenderTypes/utils.js +5 -0
- package/src/components/Datagrid/Table/Cell.js +45 -0
- package/src/components/Datagrid/Table/Datatable.js +232 -0
- package/src/components/Datagrid/Table/index.js +446 -0
- package/src/components/Datagrid/Table/renderTable.js +664 -0
- package/src/components/Datagrid/factory.js +12 -0
- package/src/components/Datagrid/getComponent.js +26 -0
- package/src/components/Datagrid/index.js +43 -0
- package/src/components/Datagrid/utils.js +185 -0
- package/src/components/Date/DatePickerModal/index.js +10 -0
- package/src/components/Date/DatePickerModal/index.native.js +22 -0
- package/src/components/Date/PickerInput/TextInputMask.js +106 -0
- package/src/components/Date/PickerInput/index.js +253 -0
- package/src/components/Date/Time.js +154 -0
- package/src/components/Date/TimePickerModal/index.js +3 -0
- package/src/components/Date/TimePickerModal/index.native.js +21 -0
- package/src/components/Date/dictionary.js +26 -0
- package/src/components/Date/index.js +11 -0
- package/src/components/Date/utils.common.js +3 -0
- package/src/components/Date/utils.common.native.js +0 -0
- package/src/components/Date/utils.js +209 -0
- package/src/components/Dialog/AppBarDialog.js +41 -0
- package/src/components/Dialog/Dialog.js +377 -0
- package/src/components/Dialog/DialogActions.js +69 -0
- package/src/components/Dialog/DialogFooter.js +36 -0
- package/src/components/Dialog/DialogTitle.js +47 -0
- package/src/components/Dialog/DropdownAlert/Queue.js +28 -0
- package/src/components/Dialog/DropdownAlert/Utils.js +36 -0
- package/src/components/Dialog/DropdownAlert/assets/cancel.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/cancel@2x.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/cancel@3x.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/error.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/error@2x.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/error@3x.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/info.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/info@2x.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/info@3x.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/success.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/success@2x.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/success@3x.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/warn.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/warn@2x.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/warn@3x.png +0 -0
- package/src/components/Dialog/DropdownAlert/index.js +685 -0
- package/src/components/Dialog/Provider.js +75 -0
- package/src/components/Dialog/confirm/Alert/Alert.old/Alert.web.js +360 -0
- package/src/components/Dialog/confirm/Alert/Alert.old/index.js +2 -0
- package/src/components/Dialog/confirm/Alert/index.js +43 -0
- package/src/components/Dialog/confirm/index.js +12 -0
- package/src/components/Dialog/confirm/showConfirmOrAlertOrPrompt.js +145 -0
- package/src/components/Dialog/dialogs.js +70 -0
- package/src/components/Dialog/index.js +17 -0
- package/src/components/Dialog/showConfirmOrAlertOrPrompt.js +90 -0
- package/src/components/Dialog/style.css +103 -0
- package/src/components/Dialog/utils.js +33 -0
- package/src/components/Divider/index.js +44 -0
- package/src/components/Drawer/DrawerHeader.js +70 -0
- package/src/components/Drawer/DrawerItems/DrawerItem.js +88 -0
- package/src/components/Drawer/DrawerItems/DrawerSection.js +34 -0
- package/src/components/Drawer/DrawerItems/ExpandableItem.js +44 -0
- package/src/components/Drawer/DrawerItems/_DrawerItem.js +173 -0
- package/src/components/Drawer/DrawerItems/index.js +155 -0
- package/src/components/Drawer/DrawerItems/utils.js +107 -0
- package/src/components/Drawer/DrawerLayout/index.js +476 -0
- package/src/components/Drawer/NavigationView.js +90 -0
- package/src/components/Drawer/Provider.js +6 -0
- package/src/components/Drawer/index.js +455 -0
- package/src/components/Drawer/session.js +28 -0
- package/src/components/Drawer/utils.js +39 -0
- package/src/components/Dropdown/index.js +1317 -0
- package/src/components/Dropdown/utils.js +19 -0
- package/src/components/ErrorBoundary/ErrorMessage.js +107 -0
- package/src/components/ErrorBoundary/Provider.js +68 -0
- package/src/components/ErrorBoundary/index.js +64 -0
- package/src/components/Expandable/Item.js +159 -0
- package/src/components/Expandable/index.js +229 -0
- package/src/components/Fab/Fab.js +46 -0
- package/src/components/Fab/Group.js +143 -0
- package/src/components/Fab/GroupComponent.js +384 -0
- package/src/components/Fab/index.js +8 -0
- package/src/components/FadeInOut/index.js +70 -0
- package/src/components/Filter/filterTextTypes.js +1 -0
- package/src/components/Filter/index.js +570 -0
- package/src/components/Filter/session.js +18 -0
- package/src/components/Filter/utils.js +289 -0
- package/src/components/Form/Action.js +112 -0
- package/src/components/Form/Fields/Checkbox.js +29 -0
- package/src/components/Form/Fields/Color.js +21 -0
- package/src/components/Form/Fields/Date.js +24 -0
- package/src/components/Form/Fields/Field.js +1048 -0
- package/src/components/Form/Fields/Html.js +21 -0
- package/src/components/Form/Fields/IdField.js +131 -0
- package/src/components/Form/Fields/Image.js +65 -0
- package/src/components/Form/Fields/PieceField.js +143 -0
- package/src/components/Form/Fields/Radio.js +31 -0
- package/src/components/Form/Fields/SelectCountry.js +12 -0
- package/src/components/Form/Fields/SelectField.js +147 -0
- package/src/components/Form/Fields/SelectStructData.js +24 -0
- package/src/components/Form/Fields/SelectTableData.js +24 -0
- package/src/components/Form/Fields/SelectTheme.js +11 -0
- package/src/components/Form/Fields/Slider.js +32 -0
- package/src/components/Form/Fields/Switch.js +34 -0
- package/src/components/Form/Fields/Tel.js +21 -0
- package/src/components/Form/Fields/TextField.js +44 -0
- package/src/components/Form/Fields/Time.js +28 -0
- package/src/components/Form/Fields/index.js +52 -0
- package/src/components/Form/Fields/selectPromptField.js +59 -0
- package/src/components/Form/Fields/sprintf.js +42 -0
- package/src/components/Form/Fields/sprintfSelectors.js +117 -0
- package/src/components/Form/Fields/utils.js +8 -0
- package/src/components/Form/Form.js +221 -0
- package/src/components/Form/FormData/Dialog.js +116 -0
- package/src/components/Form/FormData/DialogProvider.js +117 -0
- package/src/components/Form/FormData/FormData.js +403 -0
- package/src/components/Form/FormData/FormDataActions.js +155 -0
- package/src/components/Form/FormData/componentsTypes.js +117 -0
- package/src/components/Form/FormData/index.js +15 -0
- package/src/components/Form/FormData/utils.js +111 -0
- package/src/components/Form/KeyboardAvoidingView.js +23 -0
- package/src/components/Form/KeyboardEventHandler/index.js +115 -0
- package/src/components/Form/KeyboardEventHandler/keyEvents.js +139 -0
- package/src/components/Form/KeyboardEventHandler/readMe.md +1 -0
- package/src/components/Form/List/List.js +794 -0
- package/src/components/Form/List/index.js +2 -0
- package/src/components/Form/index.js +14 -0
- package/src/components/Form/utils/FormsManager.js +101 -0
- package/src/components/Form/utils/index.js +8 -0
- package/src/components/Form/utils/keyboardEvents.js +8 -0
- package/src/components/Form/utils/keyboardShortcuts.js +57 -0
- package/src/components/Grid/Cell.js +108 -0
- package/src/components/Grid/Col.js +30 -0
- package/src/components/Grid/Grid.js +35 -0
- package/src/components/Grid/Row.js +30 -0
- package/src/components/Grid/index.js +11 -0
- package/src/components/Hashtag/index.js +119 -0
- package/src/components/HeavyScreen/index.js +52 -0
- package/src/components/HeavyScreen/utils.js +36 -0
- package/src/components/HelperText/index.js +36 -0
- package/src/components/Html/AutoSizedImage.js +56 -0
- package/src/components/Html/HtmlToElement.js +173 -0
- package/src/components/Html/View.js +166 -0
- package/src/components/Icon/Checkbox.js +83 -0
- package/src/components/Icon/CrossFadeIcon.js +133 -0
- package/src/components/Icon/Icon.js +52 -0
- package/src/components/Icon/IconButton.js +155 -0
- package/src/components/Icon/MaterialCommunityIcon.js +93 -0
- package/src/components/Icon/index.js +10 -0
- package/src/components/Icon/utils.js +15 -0
- package/src/components/Image/Editor/index copy.js +42 -0
- package/src/components/Image/Editor/index.js +52 -0
- package/src/components/Image/index.js +309 -0
- package/src/components/InlineIndicator/Select.js +58 -0
- package/src/components/InlineIndicator/index.js +156 -0
- package/src/components/Label/index.js +104 -0
- package/src/components/Link/Browser.js +17 -0
- package/src/components/Link/getUrlCallback.js +10 -0
- package/src/components/Link/index.js +38 -0
- package/src/components/List/BigList.js +44 -0
- package/src/components/List/Common.js +233 -0
- package/src/components/List/FlashList.js +29 -0
- package/src/components/List/FlatList.js +34 -0
- package/src/components/List/RecyclerView.js +83 -0
- package/src/components/List/index.js +12 -0
- package/src/components/List/utils.js +23 -0
- package/src/components/Logo/Logo.js +98 -0
- package/src/components/Logo/Progress.js +21 -0
- package/src/components/Logo/index.js +3 -0
- package/src/components/Menu/Item.js +203 -0
- package/src/components/Menu/Menu.js +590 -0
- package/src/components/Menu/index.js +118 -0
- package/src/components/Menu/utils.js +81 -0
- package/src/components/Modal/index.js +212 -0
- package/src/components/NewLine/index.js +4 -0
- package/src/components/NewLine/index.web.js +3 -0
- package/src/components/Paragraph/index.js +32 -0
- package/src/components/PasswordText/index.js +29 -0
- package/src/components/PhoneInput/PhoneNumber.js +121 -0
- package/src/components/PhoneInput/country.js +54 -0
- package/src/components/PhoneInput/index.js +217 -0
- package/src/components/PhoneInput/numberType.json +14 -0
- package/src/components/PhoneInput/styles.js +52 -0
- package/src/components/Portal/index.js +5 -0
- package/src/components/Preloader/index.js +227 -0
- package/src/components/Progress/LoadingDots.js +126 -0
- package/src/components/Progress/index.js +18 -0
- package/src/components/Radio/index.js +164 -0
- package/src/components/ReadMoreText/index.js +120 -0
- package/src/components/ScrollView/index.js +34 -0
- package/src/components/Signature/Panel.js +246 -0
- package/src/components/Signature/index.js +69 -0
- package/src/components/SimpleSelect/index.js +483 -0
- package/src/components/Slider/Slider.js +770 -0
- package/src/components/Slider/index.js +144 -0
- package/src/components/Slider/styles.js +39 -0
- package/src/components/SplashScreen/index.js +194 -0
- package/src/components/SplashScreen/styles.js +74 -0
- package/src/components/StatusBar/Component/index.js +5 -0
- package/src/components/StatusBar/Component/index.web.js +88 -0
- package/src/components/StatusBar/index.js +7 -0
- package/src/components/Surface/Elevations.js +218 -0
- package/src/components/Surface/index.js +22 -0
- package/src/components/Swipeable/Swipe.js +225 -0
- package/src/components/Swipeable/SwipeableGesture.js +77 -0
- package/src/components/Swipeable/index.js +5 -0
- package/src/components/Swiper/Controls.js +277 -0
- package/src/components/Swiper/index.js +463 -0
- package/src/components/Swiper/nodeType.js +8 -0
- package/src/components/Swiper/renderNode.js +21 -0
- package/src/components/Switch/index.js +172 -0
- package/src/components/Tab/TabContent.js +72 -0
- package/src/components/Tab/TabItem.js +112 -0
- package/src/components/Tab/TabItems.js +246 -0
- package/src/components/Tab/index.js +114 -0
- package/src/components/Table/index.js +383 -0
- package/src/components/TextField/Affix.js +18 -0
- package/src/components/TextField/index.js +749 -0
- package/src/components/TextField/utils.js +64 -0
- package/src/components/Tooltip/Popover/index.js +254 -0
- package/src/components/Tooltip/Popover/index.web.js +60 -0
- package/src/components/Tooltip/index.js +42 -0
- package/src/components/TouchableRipple/index.js +0 -0
- package/src/components/View/index.js +49 -0
- package/src/components/WebView/Component/index.native.js +2 -0
- package/src/components/WebView/Component/index.web.js +154 -0
- package/src/components/WebView/Component/postMock.html +21 -0
- package/src/components/WebView/index.js +79 -0
- package/src/index.js +166 -0
- package/src/layouts/AppBar/index.js +59 -0
- package/src/layouts/AppBar/utils.js +12 -0
- package/src/layouts/Fab/actions.js +5 -0
- package/src/layouts/Fab/index.js +60 -0
- package/src/layouts/Fab/utils.js +25 -0
- package/src/layouts/Footer/index.js +8 -0
- package/src/layouts/Screen/FormData/FormData.js +103 -0
- package/src/layouts/Screen/FormData/List.js +83 -0
- package/src/layouts/Screen/FormData/index.js +3 -0
- package/src/layouts/Screen/Screen.js +173 -0
- package/src/layouts/Screen/index.js +11 -0
- package/src/media/Assets/index.js +6 -0
- package/src/media/Assets/utils.js +28 -0
- package/src/media/camera.js +1 -0
- package/src/media/camera.native.js +4 -0
- package/src/media/camera.web.js +9 -0
- package/src/media/file-system/index.js +20 -0
- package/src/media/file-system/utils/index.js +32 -0
- package/src/media/file-system/utils/utils.js +0 -0
- package/src/media/file-system/utils.native/index.js +1 -0
- package/src/media/index.js +137 -0
- package/src/navigation/Drawer/ProfilAvatar/defaultAvatar.js +1 -0
- package/src/navigation/Drawer/ProfilAvatar/index.js +142 -0
- package/src/navigation/Drawer/ProfilAvatar/style.css +18 -0
- package/src/navigation/Drawer/index.js +81 -0
- package/src/navigation/Drawer/items/SidebarFeedsItems.js +0 -0
- package/src/navigation/Drawer/items/SyncDataItem.js +20 -0
- package/src/navigation/Drawer/items/index.js +23 -0
- package/src/navigation/Drawer/items/items.js +31 -0
- package/src/navigation/Drawer/utils.js +18 -0
- package/src/navigation/index.js +45 -0
- package/src/navigation/utils.js +1 -0
- package/src/screens/Auth/index.js +31 -0
- package/src/screens/Auth/routes.js +9 -0
- package/src/screens/Auth/utils.js +5 -0
- package/src/screens/index.js +201 -0
- package/src/screens/mainScreens.js +4 -0
- package/src/screens/utils.js +13 -0
- package/webpack.config.js +31 -0
- package/workflows/release-package.yml +33 -0
|
@@ -0,0 +1,590 @@
|
|
|
1
|
+
import React,{BaseComponent as AppComponent} from '$react';
|
|
2
|
+
import View from "$ecomponents/View";
|
|
3
|
+
import ScrollView from "$ecomponents/ScrollView";
|
|
4
|
+
import {
|
|
5
|
+
Platform,
|
|
6
|
+
StyleSheet,
|
|
7
|
+
Animated,
|
|
8
|
+
BackHandler,
|
|
9
|
+
Dimensions,
|
|
10
|
+
Easing,
|
|
11
|
+
I18nManager,
|
|
12
|
+
TouchableWithoutFeedback,
|
|
13
|
+
findNodeHandle,
|
|
14
|
+
} from 'react-native';
|
|
15
|
+
import PropTypes from "prop-types";
|
|
16
|
+
import { withTheme,Surface,Portal} from 'react-native-paper';
|
|
17
|
+
//import Surface from "$ecomponents/Surface";
|
|
18
|
+
import { NativeModules} from 'react-native';
|
|
19
|
+
import {defaultDecimal,extendObj} from "$utils";
|
|
20
|
+
import theme,{StylePropTypes} from "$theme";
|
|
21
|
+
import APP from "$capp/instance";
|
|
22
|
+
import MenuItem from "./Item";
|
|
23
|
+
|
|
24
|
+
const RESIZE_PAGE = APP.EVENTS.RESIZE_PAGE;
|
|
25
|
+
|
|
26
|
+
const estimatedStatusBarHeight =
|
|
27
|
+
NativeModules.NativeUnimoduleProxy?.modulesConstants?.ExponentConstants
|
|
28
|
+
?.statusBarHeight ?? 0;
|
|
29
|
+
const APPROX_STATUSBAR_HEIGHT = Platform.select({
|
|
30
|
+
android: estimatedStatusBarHeight,
|
|
31
|
+
ios: Platform.Version < 11 ? estimatedStatusBarHeight : 0,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
// Minimum padding between the edge of the screen and the menu
|
|
36
|
+
const SCREEN_INDENT = 8;
|
|
37
|
+
// From https://material.io/design/motion/speed.html#duration
|
|
38
|
+
const ANIMATION_DURATION = 250;
|
|
39
|
+
// From the 'Standard easing' section of https://material.io/design/motion/speed.html#easing
|
|
40
|
+
const EASING = Easing.bezier(0.4, 0, 0.2, 1);
|
|
41
|
+
|
|
42
|
+
class _Menu extends AppComponent {
|
|
43
|
+
static Item = MenuItem;
|
|
44
|
+
|
|
45
|
+
static defaultProps = {
|
|
46
|
+
statusBarHeight: APPROX_STATUSBAR_HEIGHT,
|
|
47
|
+
overlayAccessibilityLabel: 'Close menu',
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
static getDerivedStateFromProps1(nextProps, prevState) {
|
|
51
|
+
if (nextProps.visible && !prevState.rendered) {
|
|
52
|
+
return { rendered: true };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
constructor(props){
|
|
58
|
+
super(props);
|
|
59
|
+
extendObj(this.state,{
|
|
60
|
+
rendered: this.props.visible,
|
|
61
|
+
top: 0,
|
|
62
|
+
left: 0,
|
|
63
|
+
menuLayout: { width: 0, height: 0 },
|
|
64
|
+
anchorLayout: { width: 0, height: 0 },
|
|
65
|
+
opacityAnimation: new Animated.Value(0),
|
|
66
|
+
scaleAnimation: new Animated.ValueXY({ x: 0, y: 0 }),
|
|
67
|
+
});
|
|
68
|
+
this._events.RESIZE_PAGE = this.handleDismiss.bind(this);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
componentDidUpdate(prevProps) {
|
|
72
|
+
if (prevProps.visible !== this.props.visible) {
|
|
73
|
+
this.updateVisibility();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
componentWillUnmount() {
|
|
78
|
+
super.componentWillUnmount();
|
|
79
|
+
this.removeListeners();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
anchor = null;
|
|
83
|
+
menu = null;
|
|
84
|
+
backHandlerSubscription;
|
|
85
|
+
|
|
86
|
+
isCoordinate = (anchor) =>
|
|
87
|
+
!React.isValidElement(anchor) &&
|
|
88
|
+
typeof anchor?.x === 'number' &&
|
|
89
|
+
typeof anchor?.y === 'number';
|
|
90
|
+
|
|
91
|
+
measureMenuLayout = () =>
|
|
92
|
+
new Promise((resolve) => {
|
|
93
|
+
if (this.menu) {
|
|
94
|
+
this.menu.measureInWindow((x, y, width, height) => {
|
|
95
|
+
resolve({ x, y, width:Math.max(width,defaultDecimal(this.props.minWidth)), height });
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
measureAnchorLayout = () =>
|
|
101
|
+
new Promise((resolve) => {
|
|
102
|
+
const { anchor } = this.props;
|
|
103
|
+
if (this.isCoordinate(anchor)) {
|
|
104
|
+
resolve({ x: anchor.x, y: anchor.y, width: 0, height: 0 });
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (this.anchor) {
|
|
109
|
+
this.anchor.measureInWindow((x, y, width, height) => {
|
|
110
|
+
resolve({ x, y, width, height });
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
updateVisibility = async () => {
|
|
116
|
+
// _Menu is rendered in Portal, which updates items asynchronously
|
|
117
|
+
// We need to do the same here so that the ref is up-to-date
|
|
118
|
+
await Promise.resolve();
|
|
119
|
+
|
|
120
|
+
if (this.props.visible) {
|
|
121
|
+
this.show();
|
|
122
|
+
} else {
|
|
123
|
+
this.hide();
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
isBrowser = () => Platform.OS === 'web' && 'document' in global;
|
|
128
|
+
|
|
129
|
+
focusFirstDOMNode = (el) => {
|
|
130
|
+
if (el && this.isBrowser()) {
|
|
131
|
+
// When in the browser, we want to focus the first focusable item on toggle
|
|
132
|
+
// For example, when menu is shown, focus the first item in the menu
|
|
133
|
+
// And when menu is dismissed, send focus back to the button to resume tabbing
|
|
134
|
+
const node = findNodeHandle(el);
|
|
135
|
+
const focusableNode = node.querySelector(
|
|
136
|
+
// This is a rough list of selectors that can be focused
|
|
137
|
+
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
focusableNode?.focus();
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
handleDismiss = () => {
|
|
145
|
+
if (this.props.visible) {
|
|
146
|
+
this.props.onDismiss();
|
|
147
|
+
}
|
|
148
|
+
return true;
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
handleKeypress = (e) => {
|
|
152
|
+
if (e.key === 'Escape') {
|
|
153
|
+
this.props.onDismiss();
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
attachListeners = () => {
|
|
158
|
+
this.backHandlerSubscription = BackHandler.addEventListener(
|
|
159
|
+
'hardwareBackPress',
|
|
160
|
+
this.handleDismiss
|
|
161
|
+
);
|
|
162
|
+
APP.on(RESIZE_PAGE,this._events.RESIZE_PAGE);
|
|
163
|
+
|
|
164
|
+
this.isBrowser() && document.addEventListener('keyup', this.handleKeypress);
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
removeListeners = () => {
|
|
168
|
+
if (this.backHandlerSubscription?.remove) {
|
|
169
|
+
this.backHandlerSubscription.remove();
|
|
170
|
+
} else {
|
|
171
|
+
BackHandler.removeEventListener('hardwareBackPress', this.handleDismiss);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
APP.off(RESIZE_PAGE,this._events.RESIZE_PAGE);
|
|
175
|
+
this.clearEvents();
|
|
176
|
+
|
|
177
|
+
this.isBrowser() &&
|
|
178
|
+
document.removeEventListener('keyup', this.handleKeypress);
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
show = async () => {
|
|
182
|
+
if(!this._isMounted()) return;
|
|
183
|
+
const windowLayout = Dimensions.get('window');
|
|
184
|
+
const [menuLayout, anchorLayout] = await Promise.all([
|
|
185
|
+
this.measureMenuLayout(),
|
|
186
|
+
this.measureAnchorLayout(),
|
|
187
|
+
]);
|
|
188
|
+
|
|
189
|
+
// When visible is true for first render
|
|
190
|
+
// native views can be still not rendered and
|
|
191
|
+
// measureMenuLayout/measureAnchorLayout functions
|
|
192
|
+
// return wrong values e.g { x:0, y: 0, width: 0, height: 0 }
|
|
193
|
+
// so we have to wait until views are ready
|
|
194
|
+
// and rerun this function to show menu
|
|
195
|
+
if (
|
|
196
|
+
!windowLayout.width ||
|
|
197
|
+
!windowLayout.height ||
|
|
198
|
+
!menuLayout.width ||
|
|
199
|
+
!menuLayout.height ||
|
|
200
|
+
(!anchorLayout.width && !this.isCoordinate(this.props.anchor)) ||
|
|
201
|
+
(!anchorLayout.height && !this.isCoordinate(this.props.anchor))
|
|
202
|
+
) {
|
|
203
|
+
requestAnimationFrame(this.show);
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
this.setState(
|
|
208
|
+
() => ({
|
|
209
|
+
left: anchorLayout.x,
|
|
210
|
+
top: anchorLayout.y,
|
|
211
|
+
anchorLayout: {
|
|
212
|
+
height: anchorLayout.height,
|
|
213
|
+
width: anchorLayout.width,
|
|
214
|
+
},
|
|
215
|
+
menuLayout: {
|
|
216
|
+
width: menuLayout.width,
|
|
217
|
+
height: menuLayout.height,
|
|
218
|
+
},
|
|
219
|
+
}),
|
|
220
|
+
() => {
|
|
221
|
+
this.attachListeners();
|
|
222
|
+
|
|
223
|
+
const animation = theme.animation;
|
|
224
|
+
Animated.parallel([
|
|
225
|
+
Animated.timing(this.state.scaleAnimation, {
|
|
226
|
+
toValue: { x: menuLayout.width, y: menuLayout.height },
|
|
227
|
+
duration: ANIMATION_DURATION * animation.scale,
|
|
228
|
+
easing: EASING,
|
|
229
|
+
useNativeDriver: true,
|
|
230
|
+
}),
|
|
231
|
+
Animated.timing(this.state.opacityAnimation, {
|
|
232
|
+
toValue: 1,
|
|
233
|
+
duration: ANIMATION_DURATION * animation.scale,
|
|
234
|
+
easing: EASING,
|
|
235
|
+
useNativeDriver: true,
|
|
236
|
+
}),
|
|
237
|
+
]).start(({ finished }) => {
|
|
238
|
+
if (finished) {
|
|
239
|
+
this.focusFirstDOMNode(this.menu);
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
);
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
hide = () => {
|
|
247
|
+
this.removeListeners();
|
|
248
|
+
if(!this._isMounted()) return;
|
|
249
|
+
const animation = theme.animation;
|
|
250
|
+
Animated.timing(this.state.opacityAnimation, {
|
|
251
|
+
toValue: 0,
|
|
252
|
+
duration: ANIMATION_DURATION * animation.scale,
|
|
253
|
+
easing: EASING,
|
|
254
|
+
useNativeDriver: true,
|
|
255
|
+
}).start(({ finished }) => {
|
|
256
|
+
if (finished) {
|
|
257
|
+
this.setState({ menuLayout: { width: 0, height: 0 }, rendered: false });
|
|
258
|
+
this.state.scaleAnimation.setValue({ x: 0, y: 0 });
|
|
259
|
+
this.focusFirstDOMNode(this.anchor);
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
render() {
|
|
265
|
+
const {
|
|
266
|
+
visible,
|
|
267
|
+
anchor,
|
|
268
|
+
contentStyle,
|
|
269
|
+
style,
|
|
270
|
+
children,
|
|
271
|
+
statusBarHeight,
|
|
272
|
+
onDismiss,
|
|
273
|
+
handleScroll:canHandleScroll,
|
|
274
|
+
overlayAccessibilityLabel,
|
|
275
|
+
sameWidth,
|
|
276
|
+
minWidth:customMinWidth,
|
|
277
|
+
} = this.props;
|
|
278
|
+
const testID = defaultStr(this.props.testID,"RN_MainMenuComponent");
|
|
279
|
+
const {
|
|
280
|
+
rendered1,
|
|
281
|
+
menuLayout,
|
|
282
|
+
anchorLayout,
|
|
283
|
+
opacityAnimation,
|
|
284
|
+
scaleAnimation,
|
|
285
|
+
} = this.state;
|
|
286
|
+
const rendered = visible;
|
|
287
|
+
const minWidth = defaultDecimal(customMinWidth);
|
|
288
|
+
let { left, top } = this.state;
|
|
289
|
+
|
|
290
|
+
// I don't know why but on Android measure function is wrong by 24
|
|
291
|
+
const additionalVerticalValue = Platform.select({
|
|
292
|
+
android: statusBarHeight,
|
|
293
|
+
default: 0,
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
const scaleTransforms = [
|
|
297
|
+
{
|
|
298
|
+
scaleX: scaleAnimation.x.interpolate({
|
|
299
|
+
inputRange: [0, menuLayout.width],
|
|
300
|
+
outputRange: [0, 1],
|
|
301
|
+
}),
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
scaleY: scaleAnimation.y.interpolate({
|
|
305
|
+
inputRange: [0, menuLayout.height],
|
|
306
|
+
outputRange: [0, 1],
|
|
307
|
+
}),
|
|
308
|
+
},
|
|
309
|
+
];
|
|
310
|
+
|
|
311
|
+
const windowLayout = Dimensions.get('window');
|
|
312
|
+
|
|
313
|
+
// We need to translate menu while animating scale to imitate transform origin for scale animation
|
|
314
|
+
const positionTransforms = [];
|
|
315
|
+
|
|
316
|
+
// Check if menu fits horizontally and if not align it to right.
|
|
317
|
+
if (left <= windowLayout.width - menuLayout.width - SCREEN_INDENT) {
|
|
318
|
+
positionTransforms.push({
|
|
319
|
+
translateX: scaleAnimation.x.interpolate({
|
|
320
|
+
inputRange: [0, menuLayout.width],
|
|
321
|
+
outputRange: [-(menuLayout.width / 2), 0],
|
|
322
|
+
}),
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
// Check if menu position has enough space from left side
|
|
326
|
+
if (left < SCREEN_INDENT) {
|
|
327
|
+
left = SCREEN_INDENT;
|
|
328
|
+
}
|
|
329
|
+
} else {
|
|
330
|
+
positionTransforms.push({
|
|
331
|
+
translateX: scaleAnimation.x.interpolate({
|
|
332
|
+
inputRange: [0, menuLayout.width],
|
|
333
|
+
outputRange: [menuLayout.width / 2, 0],
|
|
334
|
+
}),
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
left += anchorLayout.width - menuLayout.width;
|
|
338
|
+
|
|
339
|
+
const right = left + menuLayout.width;
|
|
340
|
+
// Check if menu position has enough space from right side
|
|
341
|
+
if (right > windowLayout.width - SCREEN_INDENT) {
|
|
342
|
+
left = windowLayout.width - SCREEN_INDENT - menuLayout.width;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
const handleScroll = canHandleScroll !== false? true : false;
|
|
346
|
+
|
|
347
|
+
// If the menu is larger than available vertical space,
|
|
348
|
+
// calculate the height of scrollable view
|
|
349
|
+
let scrollableMenuHeight = 0;
|
|
350
|
+
|
|
351
|
+
// Check if the menu should be scrollable
|
|
352
|
+
if (
|
|
353
|
+
// Check if the menu overflows from bottom side
|
|
354
|
+
top >=
|
|
355
|
+
windowLayout.height -
|
|
356
|
+
menuLayout.height -
|
|
357
|
+
SCREEN_INDENT -
|
|
358
|
+
additionalVerticalValue &&
|
|
359
|
+
// And bottom side of the screen has more space than top side
|
|
360
|
+
top <= windowLayout.height - top
|
|
361
|
+
) {
|
|
362
|
+
// Scrollable menu should be below the anchor (expands downwards)
|
|
363
|
+
if(handleScroll){
|
|
364
|
+
scrollableMenuHeight =
|
|
365
|
+
windowLayout.height - top - SCREEN_INDENT - additionalVerticalValue;
|
|
366
|
+
}
|
|
367
|
+
} else if (
|
|
368
|
+
// Check if the menu overflows from bottom side
|
|
369
|
+
top >=
|
|
370
|
+
windowLayout.height -
|
|
371
|
+
menuLayout.height -
|
|
372
|
+
SCREEN_INDENT -
|
|
373
|
+
additionalVerticalValue &&
|
|
374
|
+
// And top side of the screen has more space than bottom side
|
|
375
|
+
top >= windowLayout.height - top &&
|
|
376
|
+
// And menu overflows from top side
|
|
377
|
+
top <=
|
|
378
|
+
menuLayout.height -
|
|
379
|
+
anchorLayout.height +
|
|
380
|
+
SCREEN_INDENT -
|
|
381
|
+
additionalVerticalValue
|
|
382
|
+
) {
|
|
383
|
+
// Scrollable menu should be above the anchor (expands upwards)
|
|
384
|
+
if(handleScroll){
|
|
385
|
+
scrollableMenuHeight =
|
|
386
|
+
top + anchorLayout.height - SCREEN_INDENT + additionalVerticalValue;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
// Scrollable menu max height
|
|
391
|
+
if(handleScroll){
|
|
392
|
+
scrollableMenuHeight =
|
|
393
|
+
scrollableMenuHeight > windowLayout.height - 2 * SCREEN_INDENT
|
|
394
|
+
? windowLayout.height - 2 * SCREEN_INDENT
|
|
395
|
+
: scrollableMenuHeight;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
// _Menu is typically positioned below the element that generates it
|
|
399
|
+
// So first check if it fits below the anchor (expands downwards)
|
|
400
|
+
if (
|
|
401
|
+
// Check if menu fits vertically
|
|
402
|
+
top <=
|
|
403
|
+
windowLayout.height -
|
|
404
|
+
menuLayout.height -
|
|
405
|
+
SCREEN_INDENT -
|
|
406
|
+
additionalVerticalValue ||
|
|
407
|
+
// Or if the menu overflows from bottom side
|
|
408
|
+
(top >=
|
|
409
|
+
windowLayout.height -
|
|
410
|
+
menuLayout.height -
|
|
411
|
+
SCREEN_INDENT -
|
|
412
|
+
additionalVerticalValue &&
|
|
413
|
+
// And bottom side of the screen has more space than top side
|
|
414
|
+
top <= windowLayout.height - top)
|
|
415
|
+
) {
|
|
416
|
+
positionTransforms.push({
|
|
417
|
+
translateY: scaleAnimation.y.interpolate({
|
|
418
|
+
inputRange: [0, menuLayout.height],
|
|
419
|
+
outputRange: [-((scrollableMenuHeight || menuLayout.height) / 2), 0],
|
|
420
|
+
}),
|
|
421
|
+
});
|
|
422
|
+
|
|
423
|
+
// Check if menu position has enough space from top side
|
|
424
|
+
if (top < SCREEN_INDENT) {
|
|
425
|
+
top = SCREEN_INDENT;
|
|
426
|
+
}
|
|
427
|
+
} else {
|
|
428
|
+
positionTransforms.push({
|
|
429
|
+
translateY: scaleAnimation.y.interpolate({
|
|
430
|
+
inputRange: [0, menuLayout.height],
|
|
431
|
+
outputRange: [(scrollableMenuHeight || menuLayout.height) / 2, 0],
|
|
432
|
+
}),
|
|
433
|
+
});
|
|
434
|
+
|
|
435
|
+
top += anchorLayout.height - (scrollableMenuHeight || menuLayout.height);
|
|
436
|
+
|
|
437
|
+
const bottom =
|
|
438
|
+
top +
|
|
439
|
+
(scrollableMenuHeight || menuLayout.height) +
|
|
440
|
+
additionalVerticalValue;
|
|
441
|
+
|
|
442
|
+
// Check if menu position has enough space from bottom side
|
|
443
|
+
if (bottom > windowLayout.height - SCREEN_INDENT) {
|
|
444
|
+
top =
|
|
445
|
+
scrollableMenuHeight === windowLayout.height - 2 * SCREEN_INDENT
|
|
446
|
+
? -SCREEN_INDENT * 2
|
|
447
|
+
: windowLayout.height -
|
|
448
|
+
menuLayout.height -
|
|
449
|
+
SCREEN_INDENT -
|
|
450
|
+
additionalVerticalValue;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
const shadowMenuContainerStyle = {
|
|
455
|
+
opacity: opacityAnimation,
|
|
456
|
+
transform: scaleTransforms,
|
|
457
|
+
borderRadius: theme.roundness,
|
|
458
|
+
...(scrollableMenuHeight && handleScroll ? { height: scrollableMenuHeight } : {}),
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
//- (sameWidth ? anchorLayout.height : 0)
|
|
462
|
+
const positionStyle = {
|
|
463
|
+
top: this.isCoordinate(anchor) ? top : top + additionalVerticalValue,
|
|
464
|
+
...(I18nManager.isRTL ? { right: left } : { left }),
|
|
465
|
+
};
|
|
466
|
+
if(sameWidth){
|
|
467
|
+
const bottom = windowLayout.height - SCREEN_INDENT - menuLayout.height - anchorLayout.height;
|
|
468
|
+
if(bottom >= top - SCREEN_INDENT){
|
|
469
|
+
positionStyle.top += anchorLayout.height;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
if(positionStyle.left < SCREEN_INDENT){
|
|
473
|
+
positionStyle.left = SCREEN_INDENT;
|
|
474
|
+
}
|
|
475
|
+
if(positionStyle.top < SCREEN_INDENT){
|
|
476
|
+
positionStyle.top = SCREEN_INDENT;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
return (
|
|
480
|
+
<View
|
|
481
|
+
testID = {testID}
|
|
482
|
+
ref={(ref) => {
|
|
483
|
+
this.anchor = ref;
|
|
484
|
+
}}
|
|
485
|
+
collapsable={false}
|
|
486
|
+
style = {{backgroundColor:'transparent'}}
|
|
487
|
+
>
|
|
488
|
+
{this.isCoordinate(anchor) ? null : anchor}
|
|
489
|
+
{rendered ? (
|
|
490
|
+
<Portal>
|
|
491
|
+
<TouchableWithoutFeedback
|
|
492
|
+
testID={testID+"_TouchableWithoutFeedBack"}
|
|
493
|
+
accessibilityLabel={overlayAccessibilityLabel}
|
|
494
|
+
accessibilityRole="button"
|
|
495
|
+
onPress={onDismiss}
|
|
496
|
+
>
|
|
497
|
+
<View style={[StyleSheet.absoluteFill,{flex:1,backgroundColor:'transparent'}]} testID={testID+"_Backdrop"} />
|
|
498
|
+
</TouchableWithoutFeedback>
|
|
499
|
+
<View
|
|
500
|
+
testID = {testID+"_ContentContainer"}
|
|
501
|
+
ref={(ref) => {
|
|
502
|
+
this.menu = ref;
|
|
503
|
+
}}
|
|
504
|
+
collapsable={false}
|
|
505
|
+
accessibilityViewIsModal={visible}
|
|
506
|
+
style={[styles.wrapper, positionStyle, style]}
|
|
507
|
+
pointerEvents={visible ? 'box-none' : 'none'}
|
|
508
|
+
onAccessibilityEscape={onDismiss}
|
|
509
|
+
>
|
|
510
|
+
<Animated.View style={{ transform: positionTransforms }} testID={testID+"_Animated"}>
|
|
511
|
+
<Surface
|
|
512
|
+
elevation = {5}
|
|
513
|
+
testID= {testID+"_Content"}
|
|
514
|
+
style={
|
|
515
|
+
[
|
|
516
|
+
styles.shadowMenuContainer,
|
|
517
|
+
shadowMenuContainerStyle,
|
|
518
|
+
contentStyle,
|
|
519
|
+
{backgroundColor : theme.colors.surface},
|
|
520
|
+
sameWidth && anchorLayout.width ? {width:Math.max(anchorLayout.width,minWidth)} : undefined,
|
|
521
|
+
]
|
|
522
|
+
}
|
|
523
|
+
>
|
|
524
|
+
{(scrollableMenuHeight && (
|
|
525
|
+
<ScrollView testID={testID+"_ScrollView"}>{children}</ScrollView>
|
|
526
|
+
)) || children}
|
|
527
|
+
</Surface>
|
|
528
|
+
</Animated.View>
|
|
529
|
+
</View>
|
|
530
|
+
</Portal>
|
|
531
|
+
) : null}
|
|
532
|
+
</View>
|
|
533
|
+
);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
const styles = StyleSheet.create({
|
|
538
|
+
wrapper: {
|
|
539
|
+
position: 'absolute',
|
|
540
|
+
},
|
|
541
|
+
shadowMenuContainer: {
|
|
542
|
+
opacity: 0,
|
|
543
|
+
paddingVertical: 8,
|
|
544
|
+
elevation: 8,
|
|
545
|
+
},
|
|
546
|
+
});
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
const Menu = withTheme(_Menu);
|
|
551
|
+
|
|
552
|
+
export default Menu;
|
|
553
|
+
|
|
554
|
+
Menu.propTypes = {
|
|
555
|
+
minWidth : PropTypes.number,///la longueur minimale du menu
|
|
556
|
+
handleScroll : PropTypes.bool, //si le contenu est scrollable
|
|
557
|
+
/**
|
|
558
|
+
* Whether the _Menu is currently visible.
|
|
559
|
+
*/
|
|
560
|
+
visible: PropTypes.bool,
|
|
561
|
+
/**
|
|
562
|
+
* The anchor to open the menu from. In most cases, it will be a button that opens the menu.
|
|
563
|
+
*/
|
|
564
|
+
anchor: PropTypes.any,
|
|
565
|
+
|
|
566
|
+
/**
|
|
567
|
+
* Extra margin to add at the top of the menu to account for translucent status bar on Android.
|
|
568
|
+
* If you are using Expo, we assume translucent status bar and set a height for status bar automatically.
|
|
569
|
+
* Pass `0` or a custom value to and customize it.
|
|
570
|
+
* This is automatically handled on iOS.
|
|
571
|
+
*/
|
|
572
|
+
statusBarHeight: PropTypes.number,
|
|
573
|
+
/**
|
|
574
|
+
* Callback called when _Menu is dismissed. The `visible` prop needs to be updated when this is called.
|
|
575
|
+
*/
|
|
576
|
+
onDismiss: PropTypes.func,
|
|
577
|
+
/**
|
|
578
|
+
* Accessibility label for the overlay. This is read by the screen reader when the user taps outside the menu.
|
|
579
|
+
*/
|
|
580
|
+
overlayAccessibilityLabel: PropTypes.string,
|
|
581
|
+
/**
|
|
582
|
+
* Content of the `_Menu`.
|
|
583
|
+
*/
|
|
584
|
+
children: PropTypes.node,
|
|
585
|
+
/**
|
|
586
|
+
* Style of menu's inner content.
|
|
587
|
+
*/
|
|
588
|
+
contentStyle : StylePropTypes,
|
|
589
|
+
style : StylePropTypes,
|
|
590
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import Icon from "$ecomponents/Icon";
|
|
2
|
+
import {defaultObj,isPlainObject,} from "$utils";
|
|
3
|
+
import React from "$react";
|
|
4
|
+
import {Pressable,StyleSheet} from "react-native";
|
|
5
|
+
import PropTypes from "prop-types";
|
|
6
|
+
import { renderItems } from "./utils";
|
|
7
|
+
|
|
8
|
+
export * from "./utils";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
import Item from "./Item";
|
|
12
|
+
import Menu from "./Menu";
|
|
13
|
+
|
|
14
|
+
export {Item};
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
/****
|
|
18
|
+
* @voir : https://callstack.github.io/react-native-paper/menu.html;
|
|
19
|
+
* @param anchorProps a deux type de valuers : lorsque anchor n'est pas un élément réact valide, il s'agit des props du composant Icon de react-native-paper
|
|
20
|
+
* lorsque anchror est un element réact valide, il s'agit des props du composant TouchableOpacity de react-native
|
|
21
|
+
* si closeOnPress est différent de false, alors le menu sera fermé lorsqu'on clique sur un item
|
|
22
|
+
* anchorProps peut être de la forme : {
|
|
23
|
+
* Component {default : Icon} qui est le composant qui sera rendu
|
|
24
|
+
* }
|
|
25
|
+
* is anchor est un objet plain alors anchorProps = {...anchorProps,...anchor};
|
|
26
|
+
*/
|
|
27
|
+
const MenuComponent = React.forwardRef((props,ref)=>{
|
|
28
|
+
let {items,onOpen,children,onAnchorPress,onClose,testID,onPressItem,filter,anchor,anchorProps,itemProps,renderItem,closeOnPressItem,...menuProps} = props;
|
|
29
|
+
anchorProps = defaultObj(anchorProps);
|
|
30
|
+
testID = defaultStr(testID,"RN_MenuComponent");
|
|
31
|
+
anchorProps.testID = defaultStr(anchorProps.testID,testID+"_Anchor");
|
|
32
|
+
menuProps = defaultObj(menuProps);
|
|
33
|
+
const [visible, setVisible] = React.useStateIfMounted(false);
|
|
34
|
+
const prevSibible = React.usePrevious(visible);
|
|
35
|
+
const openMenu = (event,callback) => {
|
|
36
|
+
if(callback === true && typeof onAnchorPress ==='function' && onAnchorPress(event) ===false){
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if(prevSibible === visible && visible) return;
|
|
40
|
+
setVisible(true);
|
|
41
|
+
if(typeof onOpen =="function"){
|
|
42
|
+
onOpen({});
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const closeMenu = () => {
|
|
46
|
+
setVisible(false);
|
|
47
|
+
if(typeof onClose =="function"){
|
|
48
|
+
onClose({});
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
const onPress = (e)=>{
|
|
52
|
+
if(typeof anchorProps.onPress =='function' && anchorProps.onPress(e) === false) return;
|
|
53
|
+
openMenu(e,true);
|
|
54
|
+
}
|
|
55
|
+
if(typeof anchor =='function'){
|
|
56
|
+
anchor = anchor({onPress:openMenu});
|
|
57
|
+
} else if(React.isValidElement(anchor)){
|
|
58
|
+
anchor = <Pressable {...anchorProps} onPress={onPress}>{anchor}</Pressable>
|
|
59
|
+
} else if(React.isComponent(anchor)){
|
|
60
|
+
const A = anchor;
|
|
61
|
+
anchor = <A
|
|
62
|
+
{...anchorProps}
|
|
63
|
+
onPress={onPress}
|
|
64
|
+
/>
|
|
65
|
+
} else {
|
|
66
|
+
if(isPlainObject(anchor)){
|
|
67
|
+
anchorProps = {...anchorProps,...anchor};
|
|
68
|
+
}
|
|
69
|
+
const Component = React.isComponent(anchorProps.Component)?anchorProps.Component : Icon;
|
|
70
|
+
anchor = <Component {...anchorProps} onPress = {onPress}/>
|
|
71
|
+
}
|
|
72
|
+
if(!anchor){
|
|
73
|
+
console.error("unable to render menu, anchor not spécified for props",props);
|
|
74
|
+
}
|
|
75
|
+
const context = {openMenu,closeMenu,open:openMenu,close:closeMenu};
|
|
76
|
+
React.setRef(ref,context);
|
|
77
|
+
if(typeof children =='function'){
|
|
78
|
+
children = children({openMenu,closeMenu,context});
|
|
79
|
+
}
|
|
80
|
+
React.useEffect(()=>{
|
|
81
|
+
return ()=>{
|
|
82
|
+
React.setRef(ref,null);
|
|
83
|
+
}
|
|
84
|
+
},[])
|
|
85
|
+
return <Menu {...menuProps} testID={testID} visible={visible} onDismiss={closeMenu} anchor={anchor}>
|
|
86
|
+
{renderItems({...props,onPressItem,renderItem,openMenu,closeMenu})}
|
|
87
|
+
{React.isValidElement(children)? children: null}
|
|
88
|
+
</Menu>
|
|
89
|
+
});
|
|
90
|
+
export default MenuComponent;
|
|
91
|
+
MenuComponent.displayName = "MenuComponent";
|
|
92
|
+
|
|
93
|
+
MenuComponent.propTypes = {
|
|
94
|
+
onAnchorPress : PropTypes.func,
|
|
95
|
+
anchor : PropTypes.oneOfType([
|
|
96
|
+
PropTypes.func,
|
|
97
|
+
PropTypes.element,
|
|
98
|
+
PropTypes.node,
|
|
99
|
+
]),
|
|
100
|
+
children : PropTypes.oneOfType([
|
|
101
|
+
PropTypes.node,
|
|
102
|
+
PropTypes.func,
|
|
103
|
+
]),
|
|
104
|
+
items : PropTypes.oneOfType([
|
|
105
|
+
PropTypes.object,
|
|
106
|
+
PropTypes.array,
|
|
107
|
+
]),
|
|
108
|
+
filter : PropTypes.func,
|
|
109
|
+
itemProps : PropTypes.shape({
|
|
110
|
+
closeOnPress : PropTypes.bool, //si le menu sera fermé lorsqu'on cliquera sur l'item props
|
|
111
|
+
}),
|
|
112
|
+
onOpen : PropTypes.func,
|
|
113
|
+
onClose : PropTypes.func,
|
|
114
|
+
onPressItem : PropTypes.func,
|
|
115
|
+
closeOnPressItem : PropTypes.bool, ///si le menu sera fermé lorsqu'on clique sur un item
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
MenuComponent.Item = Item;
|