Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v2] [Android] TestID for BottomTab: The key must be an application-specific resource id. #4812

Closed
saleksandras opened this issue Mar 4, 2019 · 12 comments

Comments

@saleksandras
Copy link
Contributor

Issue Description

Android app crash on setting testID of BottomTab.

Android log:

java.lang.IllegalArgumentException: The key must be an application-specific resource id.
03-03 19:38:32.875 14063 14063 E AndroidRuntime:     at android.view.View.setTag(View.java:19661)
03-03 19:38:32.875 14063 14063 E AndroidRuntime:     at com.reactnativenavigation.presentation.BottomTabPresenter.applyOptions(BottomTabPresenter.java:57)
03-03 19:38:32.875 14063 14063 E AndroidRuntime:     at com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabsController.applyOptions(BottomTabsController.java:90)
...

Error line in code:

https://github.com/wix/react-native-navigation/blob/master/lib/android/app/src/main/java/com/reactnativenavigation/presentation/BottomTabPresenter.java#L57

This issue was introduce with this commit:
bfdd41f#diff-fe7845e05fe8da4f48d10c4da23403e5

Code Snippets

Navigation.setRoot({
  root: {
    bottomTabs: {
        children: [
          {
            stack: {
              children: [
                {
                  component: {
                    name: COMPONENT,
                  },
                },
              ],
              options: {
                bottomTab: {
                  text: 'Tab name',
                  testID: 'TAB_ID',
                  icon: tabIcon,
                },
              },
            },
          },
        ]
      }
    }
});

Environment

  • React Native Navigation version: 2.13.1
  • React Native version: 0.56.0 - 0.58.6
  • Platform(s) (iOS, Android, or both?): Android
@saleksandras saleksandras changed the title [v2] Android The key must be an application-specific resource id. [v2] Android - The key must be an application-specific resource id. Mar 4, 2019
@saleksandras saleksandras changed the title [v2] Android - The key must be an application-specific resource id. [v2] [Android] TestID for BottomTab: The key must be an application-specific resource id. Mar 4, 2019
@minhtrungaa
Copy link

Just update the version few minutes ago, this happens.

@stockrel
Copy link

stockrel commented Mar 4, 2019

+1, seems to happen also when not setting any testID for bottomTabs

@holparb
Copy link

holparb commented Mar 5, 2019

Happens to me as well with testIDs defined for tabs.
Issue is not present in RNN v2.11, but is there in v2.13.1.

@charpeni
Copy link
Contributor

charpeni commented Mar 7, 2019

cc @guyca

@NweThazin
Copy link

I also encounter this issue on RNN version "^2.13.1".
thanks

@djnsu
Copy link

djnsu commented Mar 11, 2019

same here

@skumarcm
Copy link

I am facing the same issue with version 2.14.0 as well.

@jinshin1013
Copy link
Contributor

This is blocking few people to upgrade to the latest version of RNN. If anyone could make a PR, that'd be so helpful.

@guyca
Copy link
Collaborator

guyca commented Mar 19, 2019

Hey guys, I'm was unable to reproduce this crash in the playground app. Could anyone post a root declaration which crashes in the playground app?

@Oguntoye
Copy link

testID: 'TAB_ID',

i discovered a fix for now.
The fix for now is to downgrade to 2.11.0

npm install --save [email protected]

@trungthanhnt
Copy link

You can fix by comment this line: bottomTabs.setTag(i, tab.testId.get(null));
in this file:line (BottomTabPresenter.java:57)

@jinshin1013
Copy link
Contributor

It's really weird, I just tried the same configuration on the playground app, but everything seems to be working fine. We must be missing something here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests