doubts: where does this come from, and where should this log appear?
rodgomesc opened this issue · comments
Rodrigo Gomes commented
Marc Rousavy commented
declare + comment in VisionCamera :
/**
* A native logging function (outputs to Xcode console/Android Logcat)
*/
declare var _log: (message: string) => void | undefined;
implementation from Reanimated:
auto callback = [](
jsi::Runtime &rt,
const jsi::Value &thisValue,
const jsi::Value *args,
size_t count
) -> jsi::Value {
const jsi::Value *value = &args[0];
if (value->isString()) {
Logger::log(value->getString(rt).utf8(rt).c_str());
} else if (value->isNumber()) {
Logger::log(value->getNumber());
} else if (value->isUndefined()) {
Logger::log("undefined");
} else {
Logger::log("unsupported value type");
}
return jsi::Value::undefined();
};
jsi::Value log = jsi::Function::createFromHostFunction(rt, jsi::PropNameID::forAscii(rt, "_log"), 1, callback);
rt.global().setProperty(rt, "_log", log);
Marc Rousavy commented
This is outdated since VisionCamera supports console.log
since mrousavy/react-native-vision-camera#297.
Rodrigo Gomes commented
thanks, for the quick feedback