alessiocancian / react-native-actionsheet

An elegant ActionSheet component for React Native.
MIT License
63 stars 24 forks source link

problem with jest #2

Closed misaku closed 3 years ago

misaku commented 3 years ago

`Details:

/media/michelkuguio/Novo volume/luizalabs/workspace/rodney/node_modules/@alessiocancian/react-native-actionsheet/lib/index.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import { Platform } from 'react-native'
                                                                                         ^^^^^^

SyntaxError: Cannot use import statement outside a module

  4 | import IconBtn from 'react-native-vector-icons/FontAwesome';
  5 | import {Searchbar} from 'react-native-paper';
> 6 | import ActionSheet from '@alessiocancian/react-native-actionsheet';

`

alessiocancian commented 3 years ago

I think the problem is not the library itself but Platform from react-native. You should to mock it with jest and set Platform.OS = "android" (I don't think you can set iOS because this library uses native code for iOS), check here (stackoverflow).