Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (
action.type !== NavigationActions.NAVIGATE &&
action.type !== NavigationActions.BACK
) {
return next(action);
}
const currentScreen = getCurrentRouteName(getState().nav);
const result = next(action);
const nextScreen = getCurrentRouteName(getState().nav);
if (nextScreen !== currentScreen) {
try {
Reactotron.log(`NAVIGATING ${currentScreen} to ${nextScreen}`);
// Example: Analytics.trackEvent('user_navigation', {currentScreen, nextScreen})
} catch (e) {
Reactotron.log(e);
}
}
return result;
};
export function * startup(action?: Action): SagaIterator {
if (__DEV__) {
// straight-up string logging
Reactotron.log("Hello, I'm an example of how to log via Reactotron.");
Reactotron.log(action);
// logging an object for better clarity
Reactotron.log({
message: "pass objects for better logging",
someGeneratorFunction: selectAvatar,
});
// fully customized!
const subObject = { a: 1, b: [1, 2, 3], c: true, circularDependency: undefined as any};
subObject.circularDependency = subObject; // osnap!
Reactotron.display({
name: "🔥 IGNITE 🔥",
preview: "You should totally expand this",
value: {
"💃": "Welcome to the future!",
subObject,
"someInlineFunction": () => true,
"someGeneratorFunction": startup,
"someNormalFunction": selectAvatar,
export function * startup(action?: Action): SagaIterator {
if (__DEV__) {
// straight-up string logging
Reactotron.log("Hello, I'm an example of how to log via Reactotron.");
Reactotron.log(action);
// logging an object for better clarity
Reactotron.log({
message: "pass objects for better logging",
someGeneratorFunction: selectAvatar,
});
// fully customized!
const subObject = { a: 1, b: [1, 2, 3], c: true, circularDependency: undefined as any};
subObject.circularDependency = subObject; // osnap!
Reactotron.display({
name: "🔥 IGNITE 🔥",
preview: "You should totally expand this",
value: {
"💃": "Welcome to the future!",
subObject,
export function * startup(action?: Action): SagaIterator {
if (__DEV__) {
// straight-up string logging
Reactotron.log("Hello, I'm an example of how to log via Reactotron.");
Reactotron.log(action);
// logging an object for better clarity
Reactotron.log({
message: "pass objects for better logging",
someGeneratorFunction: selectAvatar,
});
// fully customized!
const subObject = { a: 1, b: [1, 2, 3], c: true, circularDependency: undefined as any};
subObject.circularDependency = subObject; // osnap!
Reactotron.display({
name: "🔥 IGNITE 🔥",
preview: "You should totally expand this",
value: {
"💃": "Welcome to the future!",
subObject,
"someInlineFunction": () => true,
const screenTracking = ({ getState }) => (next) => (action) => {
if (
action.type !== NavigationActions.NAVIGATE &&
action.type !== NavigationActions.BACK
) {
return next(action);
}
const currentScreen = getCurrentRouteName(getState().nav);
const result = next(action);
const nextScreen = getCurrentRouteName(getState().nav);
if (nextScreen !== currentScreen) {
try {
Reactotron.log(`NAVIGATING ${currentScreen} to ${nextScreen}`);
// Example: Analytics.trackEvent('user_navigation', {currentScreen, nextScreen})
} catch (e) {
Reactotron.log(e);
}
}
return result;
};