Comments (10)
@okwasniewski , @Saadnajmi : Maybe I managed to do something, I replied on react-native-macos.
from react-native-menubar-extra.
Hey, so according to this stackoverflow thread you can use this library to achive it in React Native. However this is way out of scope for react-native-menubar-extra
library, therefore I'm closing this issue.
from react-native-menubar-extra.
@okwasniewski : I tried to make it work, but I couldn't.
import {spawn, kill} from 'react-native-childprocess'
useEffect(() => {
const fetchData = async () => {
cmdID = await spawn('/sbin/ping', ['google.com'], {
pwd: "/",
stdout: (output) => {
console.log('>>>', output)
}
});
console.log(cmdID)
}
fetchData()
.catch(console.error);
}, [])
from react-native-menubar-extra.
It works for me did you ran pod install
after installing this library?
from react-native-menubar-extra.
@okwasniewski : it stops working.
from react-native-menubar-extra.
You need to clean up the old build. Inside macos
folder run rm -rf Pods build
and then install pods again (pod install
)
from react-native-menubar-extra.
@okwasniewski : I don't understand why it's always macos from all these problems.
the first time it was worth:
console.log('o:', cmdID);
then changed it by saving it, then it updated:
console.log('oo:', cmdID);
I tried this:
useEffect(() => {
let cmdID;
const shell = async () => {
cmdID = await spawn('pwd', ['-LP'], {
pwd: '/Users',
stdout: (output) => {
console.log('stdout:', output);
},
stderr: (output) => {
console.log('stderr:', output);
},
terminate: (output) => {
console.log('terminate:', output);
},
});
console.log('oo:', cmdID);
};
shell().catch(console.error);
return () => {
console.log("kill")
kill(cmdID);
};
}, []);
But the command written this way seems to work well, I get this:
LOG o: -1
LOG kill
LOG [Error: invalid cmdID]
LOG oo: -1
from react-native-menubar-extra.
See my explanation here: microsoft/react-native-macos#1937 (comment)
It's not currently possible to run arbitrary node native modules with React Native macOS, as they have two completely separate methods of JS->Native (C++) communication.
from react-native-menubar-extra.
@Saadnajmi The solution for this particular issue would be to create an RN Macos library that would wrap another native library to execute shell commands like https://github.com/JohnSundell/ShellOut right?
from react-native-menubar-extra.
@Saadnajmi The solution for this particular issue would be to create an RN Macos library that would wrap another native library to execute shell commands like https://github.com/JohnSundell/ShellOut right?
Yep, unless the other project I mentioned lands and we can get all node native modules to "just work" with react native macOS (while using Hermes). But you know, that's a ways away I think, and writing your own native module OS the way to go IMO
from react-native-menubar-extra.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-menubar-extra.