As SJuan96 already pointed out in the comments, the EU does not forbid direct democracy. But of course there are certain rules that have to be obeyed when being a member of the EU - as is the case for a membership in any group. Acting against these rules and staying in the group will pose a problem (although reality shows that breaking the rules will be tolerated to a certain extent if the rulebreakers are determined enough).
Since joining a group brings the burden of adhering to the rules of the group, yes, this may limit the things people can decide via direct democracy. But this is not EU-specific. Switzerland, being part of the WTOWorld Tade Organisation, also has to adhere to the rules of the WTOWorld Trade Organisation. A group actually makes little sense if any member is to be allowed to always act as it wants.