Giter Site home page Giter Site logo

Comments (12)

watadarkstar avatar watadarkstar commented on June 8, 2024 7

If you need someone with React Native and Expo experience to help with this feel free to email me at adrian at g2i dot co

I'm good friends with the Expo team :)

from console-ninja.

LunatiqueCoder avatar LunatiqueCoder commented on June 8, 2024 6

I'd choose the paid version if it had support for React Native. 🥲

from console-ninja.

brentvatne avatar brentvatne commented on June 8, 2024 5

hello! i work on expo. feel free to email me at brent at expo dot dev if you have any questions about how to integrate

from console-ninja.

kirillzyusko avatar kirillzyusko commented on June 8, 2024 4

Console Ninja won't work when running on iPhone / Android (it only connects to your localhost right now)

@smcenlly is there any plans to add support for that?

I think many react-native projects are targeting only Android/iOS as platforms. And I (as a react-native developer) would love to see support for Android/iOS.

Anyway, the project is really great and I can only wish you the success in the development of this plugin 😊

from console-ninja.

smcenlly avatar smcenlly commented on June 8, 2024 2

We tried Console Ninja on a fresh expo project, using npm run web and it worked for us without needing to do anything special.

Console Ninja won't work when running on iPhone / Android (it only connects to your localhost right now), but it should work when running using the web version.

If it's not working for you, please create a new issue and provide us with steps to reproduce your problem.

expo

from console-ninja.

smcenlly avatar smcenlly commented on June 8, 2024 2

@kirillzyusko - I don't expect we'd be able to target Android/iOS as runtime platforms any time soon. There will likely be some network isolation problems as well as possibly some runtime problems.

I'll re-open this issue and change the title to be more explicity about Android and iOS since browser runtime for expo/react-native is supported.

from console-ninja.

kirillzyusko avatar kirillzyusko commented on June 8, 2024 2

If you're modifying environment for local development somehow, then react-native provides a way how to remove "development only" code in production builds. You can use:

if (__DEV__) {
  // ... your code
}

or if you are modifying env via babel plugin, then you can use process.env.BABEL_ENV === "production" check.

from console-ninja.

kirillzyusko avatar kirillzyusko commented on June 8, 2024 1

@smcenlly sorry for a long response! Sure, I will share. We did it only for Android, but I think a similar approach could be applied to iOS too.

Basically we've opened logcat process in NodeJS script:

const { spawn } = require("child_process");

const child = spawn("adb", ["logcat"]);

And we added a listener to stdout:

child.stdout.on("data", (data) => {
  const output = data.toString();
});

Every new log will emit a new event. It will look like:

01-20 20:44:18.525 25066 25124 I ReactNativeJS: TAG: 1083

ReactNativeJS means that it has been logged by JS side of react-native. In my case the output above has been generated by next code in JS:

const tag = findNodeHandle(ref.current);
console.log('TAG: ' + tag);

Using simple transformation you can split up only part that has been logged by JS:

if (output.includes("ReactNativeJS")) {
  const jsOutput = output.split(" ")... // take the output from 6-index and concat with remaining part of array, but it can be optimised through regular expression 
}

That's how we gathered data from console.log statements. Do you think it will be possible to use a similar approach in console-ninja?

from console-ninja.

twocs avatar twocs commented on June 8, 2024

Our app on the simulator is logging into VS Code via react-native-logs, and it's running watchman for file changes. There must be something you can do!

from console-ninja.

kirillzyusko avatar kirillzyusko commented on June 8, 2024

@smcenlly got it. Do you have any architecture docs on how your plugin works?

I'm asking because in the past I had a need to capture console.log statements in android app (we had kind of performance benchmarks and we measured startup metrics). Once they've been captured we've sent them as HTML report to GitLab comments.

Just thought that maybe the same mechanism (or partially) can be used in console-ninja plugin?

from console-ninja.

smcenlly avatar smcenlly commented on June 8, 2024

@smcenlly got it. Do you have any architecture docs on how your plugin works?

Unfortunately, we don't have anything public we can share.

--

If you're able to share a sample of how you've sent console.log statements from Android/iOS runtime to a remote system, that could definitely help.

from console-ninja.

smcenlly avatar smcenlly commented on June 8, 2024

Thanks for the details. Unfortunately we're not very familiar with react-native development so we'll need to set it up and try what you've suggested to make sense of the details you've provided.

The key concern that we have is that right now, Console Ninja has no side-effects on your application/code unless it's running locally. If we were to modify your react-native runtime on a separate device, we may not have a mechanism to know it's running in localhost/dev mode. Probably just that we're not familiar with react-native, hopefully such a mechanism already exists that we could check.

from console-ninja.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.