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

Switch of android will cause a NullPointerException #16000

Closed
4ndroidev opened this issue Sep 19, 2017 · 4 comments
Closed

Switch of android will cause a NullPointerException #16000

4ndroidev opened this issue Sep 19, 2017 · 4 comments
Labels
Good first issue Interested in collaborating? Take a stab at fixing one of these issues. Help Wanted :octocat: Issues ideal for external contributors. Resolution: Locked This issue was locked by the bot.

Comments

@4ndroidev
Copy link
Contributor

Is this a bug report?

(Yes)

Have you read the Contributing Guidelines?

(No)

Environment

  1. react-native -v: 2.0.1
  2. node -v: 6.11.1
  3. npm -v: 5.3.0
  4. yarn --version: 0.27.5

Then, specify:

  • Target Platform: Android

  • Development Operating System: macOS

  • Build tools: Android Studio

Steps to Reproduce

(Write your steps here:)

  1. using library com.android.support:appcompat-v7:24.2.1
  2. using component <Switch />

Expected Behavior

display a Switch component

Actual Behavior

switch-crash

Reason

switch-reason

from this picture, line 59 and line 102 create instance of ReactSwitch;

the difference:

  1. the first one hasn't called setShowText(false), it will get the error of the red box, while calling measure.
  2. the second one has called setShowText(false), that's right.

how to fix:

follow line 59, insert a new line reactSwitch.setShowText(false);

if using com.android.support:appcompat-v7:23.0.1, it will not get this error; but i think this error can be avoided without downgrading appcompat-v7 library. Sorry for my poor english, thank you!

@4ndroidev 4ndroidev changed the title Android Switch Switch of android will cause a NullPointerException Sep 19, 2017
@janicduplessis janicduplessis added Android Good first issue Interested in collaborating? Take a stab at fixing one of these issues. Help Wanted :octocat: Issues ideal for external contributors. labels Sep 22, 2017
@janicduplessis
Copy link
Contributor

Thanks for reporting this, would you like to send a PR with your fix?

4ndroidev added a commit to 4ndroidev/react-native that referenced this issue Sep 22, 2017
see [Issue facebook#16000](facebook#16000) 
fix a null pointer exception while using higher version 'com.android.support:appcompat-v7'
@Fortidude
Copy link

react-native-cli: 2.0.1
react-native: 0.50.3

"com.android.support:appcompat-v7:25.3.1"

Still buggy, Can someone fix it? :)

zrzut ekranu 2017-12-03 o 13 16 22

@Fouppy
Copy link

Fouppy commented Dec 3, 2017

@Fortidude you should ping there #16064

@Fortidude
Copy link

@Fouppy oke, thx

@facebook facebook locked as resolved and limited conversation to collaborators Jan 26, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jan 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Good first issue Interested in collaborating? Take a stab at fixing one of these issues. Help Wanted :octocat: Issues ideal for external contributors. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants