Closed dsabsay closed 1 year ago
If you've installed it with the Readme instruction, make sure to import it into your app using the @
, like :
import { MIDIMessageEvent, requestMIDIAccess } from "@motiz88/react-native-midi";
Let me know if that worked.
@kimchouard Thanks for the reply. My code has the @
already.
Okay, can you share the bits of code in which you're importing/using the lib (react-native-midi
)?
Sure.
import { requestMIDIAccess } from '@motiz88/react-native-midi';
...
useEffect(() => {
requestMIDIAccess()
.then((midiAccess) => {
console.log(midiAccess.input)
})
.catch((e) => alert(`Unable to get MIDI access: ${JSON.stringify(e)}`));
}, [])
...
I suspect it's something build-related.
Hey @dsabsay - I'd be happy to take a look at a repo showing this problem, if you can share one. (Seperately, I'll also try installing the module in a new vanilla RN project, and see if it repros the issue.)
Thanks for taking a look. I solved this by configuring my project to use Expo modules (documented here). In short, npx install-expo-modules@latest
.
I briefly tried without the Expo stuff. But it seems the Swift code depends on expo-modules-core. And even then, I needed to use a pod :path ../node_modules/...
in the Podfile which seemed less than ideal.
I think the README here should encourage people to use the Expo approach unless you know it works otherwise. I didn't try to reproduce, but my one experience suggests users will have a tough time getting it to work without Expo.
I did this:
I'm getting
Cannot find native module 'ReactNativeMidi
. I don't see any related Pod installed (looking at Podfile.lock and browsing Pods in Xcode).I'm on an M2 MacBook Pro. Xcode 14.2. react-native 0.70.6.
The rest of my app works as expected (using various native modules).
I don't know if this matters, but my terminal session is running in Rosetta, judging by the output of
uname -m
. I believe all/most binaries I'm running are only x86_64, because they were restored from a previous laptop.Any pointers or debugging advice would be appreciated. Thanks!