1 line
4.9 KiB
Plaintext
1 line
4.9 KiB
Plaintext
|
{"version":3,"sources":["TouchableNativeFeedback.android.tsx"],"names":["Platform","React","Component","GenericTouchable","TouchableNativeFeedback","getExtraButtonProps","extraProps","background","props","type","borderless","color","attribute","rippleRadius","useForeground","render","style","rest","defaultProps","extraButtonProps","rippleColor","Version"],"mappings":";;;;AAAA,SACEA,QADF,QAIO,cAJP;AAKA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,SAASC,SAAT,QAA0B,OAA1B;AACA,OAAOC,gBAAP,MAAwD,oBAAxD;;AASA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAMC,uBAAN,SAAsCF,SAAtC,CAEb;AAUA;AAyBAG,EAAAA,mBAAmB,GAAG;AACpB,UAAMC,UAA6C,GAAG,EAAtD;AACA,UAAM;AAAEC,MAAAA;AAAF,QAAiB,KAAKC,KAA5B;;AACA,QAAID,UAAJ,EAAgB;AACd;AACA;AACA,UAAIA,UAAU,CAACE,IAAX,KAAoB,eAAxB,EAAyC;AACvCH,QAAAA,UAAU,CAAC,YAAD,CAAV,GAA2BC,UAAU,CAACG,UAAtC;AACAJ,QAAAA,UAAU,CAAC,aAAD,CAAV,GAA4BC,UAAU,CAACI,KAAvC;AACD,OAHD,MAGO,IAAIJ,UAAU,CAACE,IAAX,KAAoB,kBAAxB,EAA4C;AACjDH,QAAAA,UAAU,CAAC,YAAD,CAAV,GACEC,UAAU,CAACK,SAAX,KAAyB,oCAD3B;AAED,OATa,CAUd;;;AACAN,MAAAA,UAAU,CAAC,cAAD,CAAV,GAA6BC,UAAU,CAACM,YAAxC;AACD;;AACDP,IAAAA,UAAU,CAAC,YAAD,CAAV,GAA2B,KAAKE,KAAL,CAAWM,aAAtC;AACA,WAAOR,UAAP;AACD;;AACDS,EAAAA,MAAM,GAAG;AACP,UAAM;AAAEC,MAAAA,KAAK,GAAG,EAAV;AAAc,SAAGC;AAAjB,QAA0B,KAAKT,KAArC;AACA,wBACE,oBAAC,gBAAD,eACMS,IADN;AAEE,MAAA,KAAK,EAAED,KAFT;AAGE,MAAA,gBAAgB,EAAE,KAAKX,mBAAL;AAHpB,OADF;AAOD;;AA/DD;;gBAFmBD,uB,kBAGG,EACpB,GAAGD,gBAAgB,CAACe,YADA;AAEpBJ,EAAAA,aAAa,EAAE,IAFK;AAGpBK,EAAAA,gBAAgB,EAAE;AAChB;AACAC,IAAAA,WAAW,EAAE;AAFG;AAHE,C;;gBAHHhB,uB,0BAaYS,YAAD,KAA4B;AACxDJ,EAAAA,IAAI,EAAE,kBADkD;AAExD;AACAG,EAAAA,SAAS,EAAE,0BAH6C;AAIxDC,EAAAA;AAJwD,CAA5B,C;;gBAbXT,uB,oCAmBsBS,YAAD,KAA4B;AAClEJ,EAAAA,IAAI,EAAE,kBAD4D;AAElEG,EAAAA,SAAS,EAAE,oCAFuD;AAGlEC,EAAAA;AAHkE,CAA5B,C;;gBAnBrBT,uB,YAwBH,CACdO,KADc,EAEdD,UAFc,EAGdG,YAHc,MAIV;AACJJ,EAAAA,IAAI,EAAE,eADF;AAEJE,EAAAA,KAFI;AAGJD,EAAAA,UAHI;AAIJG,EAAAA;AAJI,CAJU,C;;gBAxBGT,uB,4BAmCa,MAAMJ,QAAQ,CAACqB,OAAT,IAAoB,E","sourcesContent":["import {\n Platform,\n TouchableNativeFeedbackProps,\n ColorValue,\n} from 'react-native';\nimport * as React from 'react';\nimport { Component } from 'react';\nimport GenericTouchable, { GenericTouchableProps } from './GenericTouchable';\n\nexport type TouchableNativeFeedbackExtraProps = {\n borderless?: boolean;\n rippleColor?: number | null;\n rippleRadius?: number | null;\n foreground?: boolean;\n};\n\n/**\n * TouchableNativeFeedback behaves slightly different than RN's TouchableNativeFeedback.\n * There's small difference with handling long press ripple since RN's implementation calls\n * ripple animation via bridge. This solution leaves all animations' handling for native components so\n * it follows native behaviours.\n */\nexport default class TouchableNativeFeedback extends Component<\n TouchableNativeFeedbackProps & GenericTouchableProps\n> {\n static defaultProps = {\n ...GenericTouchable.defaultProps,\n useForeground: true,\n extraButtonProps: {\n // Disable hiding ripple on Android\n rippleColor: null,\n },\n };\n\n // could be taken as RNTouchableNativeFeedback.SelectableBackground etc. but the API may change\n static SelectableBackground = (rippleRadius?: number) => ({\n type: 'ThemeAttrAndroid',\n // I added `attribute` prop to clone the implementation of RN and be able to use only 2 types\n attribute: 'selectableItemBackground',\n rippleRadius,\n });\n static SelectableBackgroundBorderless = (rippleRadius?: number) => ({\n type: 'ThemeAttrAndroid',\n attribute: 'selectableItemBackgroundBorderless',\n rippleRadius,\n });\n static Ripple = (\n color: ColorValue,\n borderless: boolean,\n rippleRadius?: number\n ) => ({\n type: 'RippleAndroid',\n color,\n borderless,\n rippleRadius,\n });\n\n static canUseNativeForeground = () => Platform.Version >= 23;\n\n getExtraButtonProps() {\n const extraProps: TouchableNativeFeedbackExtraProps = {};\n const { background } = this.props;\n if (background) {\n // I changed type values to match those used in RN\n // TODO(TS): check if it works the same as previ
|