react-native-navigation icon indicating copy to clipboard operation
react-native-navigation copied to clipboard

my android app was crached when using bottomtab in RNN V2

Open harikrishnadvk1991 opened this issue 7 years ago • 7 comments

Issue Description

[ENTER DESCRIPTION HERE] app was crashed when using Reactnative navigation v2 bottomTab what is the problum in this code

Steps to Reproduce / Code Snippets / Screenshots

import {Navigation} from 'react-native-navigation'

Navigation.setRoot({
    root:{
sideMenu: {
    id:"RootStack",
    left: {
        component: {
            id: 'SideMenu',
            name: 'reminder.sideMenu',
        }
    },
    center: {
        bottomTabs: {
            id:'bottomTab',
        options: {
                bottomTabs: {
                        titleDisplayMode: 'alwaysShow',
                        //testID: testIDs.BOTTOM_TABS_ELEMENT,
                        backgroundColor: 'white',
                        currentTabIndex: 0,
                        },
                },
    children: [
        {
            stack: {
            id: 'BOTTOM_TAB_SCREENS',
            options: {
                        bottomTab:{
                        selectedIconColor: 'green',
                        }
                    },

            children: [{
            component: {
                name: 'reminder.ContactList',
                passProps: {
                            text: 'This is tab 1',
                            // myFunction: () => 'Hello from a function!',
                            },
                options: {
                        bottomTab: {
                            icon:require('../../Images/home1.png'),
                            text:'Home',
                            },
                            // topBar:{
                            //  // visible:true
                            // }
                    },
                }
            },
            ]
        }
        },
        {
            component: {
                name: 'reminder.ContactList',
                options: {
                    bottomTab: {
                        icon: require('../../Images/contact.png'),
                        text:'Contact',
                        selectedIconColor: 'green',
                    }
                }
            },
        },
        {
            component: {
                name: 'reminder.FeedBack',
                options: {
                    bottomTab: {
                        icon: require('../../Images/chatbot.png'),
                        text:'Chatbot',
                        selectedIconColor: 'green',
                    }
                }
            },
        },
        {
            component: {
                name: 'reminder.FeedBack',
                options: {
                    bottomTab: {
                        icon: require('../../Images/feedback.png'),
                        text:'Feedback',
                        selectedIconColor: 'green',

                    }
                }
            },
        },
    ],
},
}

}, } }) }

[FILL THIS OUT]


Environment

  • React Native Navigation version: 2.1.3
  • React Native version: 0.57.5
  • Platform(s) (iOS, Android, or both?): android
  • Device info (Simulator/Device? OS version? Debug/Release?): FILL THIS OUT

harikrishnadvk1991 avatar Jan 03 '19 18:01 harikrishnadvk1991

Crashes also. See example: same screen component used...

If used as bottomTabs -> Android crashes If used just as component -> ok

RN 0.57.8 RNN 2.5.1

export const gotoTab = () => Navigation.setRoot({ root: { bottomTabs: { children: [ { component: { name: 'Events',
}, } ], }, } });

export const gotoAuth = () => Navigation.setRoot({ root: { component: { name: 'Auth', } } })

Log from AS 2019-01-08 17:00:21.285 27419-27419/com.flyaway E/AndroidRuntime: FATAL EXCEPTION: main Process: com.test, PID: 27419 java.lang.RuntimeException: Tried to get null value! at com.reactnativenavigation.parse.params.Param.get(Param.java:14) at com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabsController.lambda$createTabs$3(BottomTabsController.java:152) at com.reactnativenavigation.viewcontrollers.bottomtabs.-$$Lambda$BottomTabsController$hVDDSxSvqNX-4DhQHls8ynB4x2w.map(Unknown Source:4) at com.reactnativenavigation.utils.CollectionUtils.map(CollectionUtils.java:42) at com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabsController.createTabs(BottomTabsController.java:148) at com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabsController.createView(BottomTabsController.java:72) at com.reactnativenavigation.viewcontrollers.ViewController.getView(ViewController.java:155) at com.reactnativenavigation.viewcontrollers.ParentController.getView(ParentController.java:60) at com.reactnativenavigation.viewcontrollers.navigator.RootPresenter.setRoot(RootPresenter.java:29) at com.reactnativenavigation.viewcontrollers.navigator.Navigator.setRoot(Navigator.java:134) at com.reactnativenavigation.react.NavigationModule.lambda$setRoot$1(NavigationModule.java:70) at com.reactnativenavigation.react.-$$Lambda$NavigationModule$IfiDeOnYfgJADKZUxIVN9Zforsw.run(Unknown Source:8) at android.os.Handler.handleCallback(Handler.java:790) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

philoubxl avatar Jan 08 '19 16:01 philoubxl

I have same issue

private List<AHBottomNavigationItem> createTabs() {
		if (tabs.size() > 5) throw new RuntimeException("Too many tabs!");
        return map(tabs, tab -> {
            BottomTabOptions options = tab.resolveCurrentOptions().bottomTabOptions;
            return new AHBottomNavigationItem(
                    options.text.get(""),
                    imageLoader.loadIcon(getActivity(), options.icon.get()),
                    options.testId.get("")
            );
        });
	}

when the application reaches this line imageLoader.loadIcon(getActivity(), options.icon.get()) after cannot go ahead @guyca

bayazetyan avatar Jan 11 '19 21:01 bayazetyan

Same issue here, did you guys find a workaround for this?

kabus202 avatar Jan 12 '19 08:01 kabus202

@kabus202 see https://github.com/wix/react-native-navigation/issues/4510#issuecomment-453812276

bayazetyan avatar Jan 13 '19 17:01 bayazetyan

Try to set icon. On adroid it crashes when you didnt give an icon source to bottomTab.

kadircanerergun avatar Jan 15 '19 09:01 kadircanerergun

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.

stale[bot] avatar Feb 14 '19 09:02 stale[bot]

The issue has been closed for inactivity.

stale[bot] avatar Feb 21 '19 09:02 stale[bot]