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

How can I hide a View #1404

Closed
magicismight opened this Issue May 26, 2015 · 11 comments

Comments

Projects
None yet
10 participants
@magicismight
Contributor

magicismight commented May 26, 2015

Is there a way to hide view and save the current state of the view?
I tried

this.ref.element.setNativeProps({
    hidden: true
});

but failed.
Is it possible to expose native componentshidden` property.
It would be great if there is a way to hide the element and save its state.

@JohnyDays

This comment has been minimized.

Show comment
Hide comment
@JohnyDays

JohnyDays May 26, 2015

Contributor

The react native philosophy is that you shouldn't (I think), there has been some discussion around supporting display:none, however simply removing the view from the tree saves memory, which is about as vital as saving the re-render, depending on your use case. If you really need this, you could expose that property from a custom view in obj-c.

Contributor

JohnyDays commented May 26, 2015

The react native philosophy is that you shouldn't (I think), there has been some discussion around supporting display:none, however simply removing the view from the tree saves memory, which is about as vital as saving the re-render, depending on your use case. If you really need this, you could expose that property from a custom view in obj-c.

@revskill10

This comment has been minimized.

Show comment
Hide comment
@revskill10

revskill10 May 26, 2015

As @JohnyDays said, in React, you should change your View based on your current State.

revskill10 commented May 26, 2015

As @JohnyDays said, in React, you should change your View based on your current State.

@magicismight

This comment has been minimized.

Show comment
Hide comment
@magicismight

magicismight May 26, 2015

Contributor

@checkraiser I tried to create some component like TabBarIOS with customed button to toggle the content views without reset the content`s state every time.
Is there any way to achieve that?

Contributor

magicismight commented May 26, 2015

@checkraiser I tried to create some component like TabBarIOS with customed button to toggle the content views without reset the content`s state every time.
Is there any way to achieve that?

@revskill10

This comment has been minimized.

Show comment
Hide comment
@revskill10

revskill10 May 26, 2015

Yes, i still not try, but i think you can wrap your view into a Custom View, then use the property subView.hidden=YES in your View Manager.
Good luck.

revskill10 commented May 26, 2015

Yes, i still not try, but i think you can wrap your view into a Custom View, then use the property subView.hidden=YES in your View Manager.
Good luck.

@magicismight

This comment has been minimized.

Show comment
Hide comment
@magicismight

magicismight May 26, 2015

Contributor

@checkraiser Thx!!!

Contributor

magicismight commented May 26, 2015

@checkraiser Thx!!!

@umhan35

This comment has been minimized.

Show comment
Hide comment
@umhan35

umhan35 May 26, 2015

Contributor

Or try set height to 0

Contributor

umhan35 commented May 26, 2015

Or try set height to 0

@brentvatne brentvatne closed this May 26, 2015

@JohnyDays

This comment has been minimized.

Show comment
Hide comment
@JohnyDays

JohnyDays May 26, 2015

Contributor

If you need measurements for said view set opacity to 0 instead of height

Contributor

JohnyDays commented May 26, 2015

If you need measurements for said view set opacity to 0 instead of height

@anhldbk

This comment has been minimized.

Show comment
Hide comment
@anhldbk

anhldbk commented Mar 24, 2016

@tigerraj32

This comment has been minimized.

Show comment
Hide comment
@tigerraj32

tigerraj32 Jun 27, 2016

please refer to this answer in stack overflow hide show component

tigerraj32 commented Jun 27, 2016

please refer to this answer in stack overflow hide show component

@sundayhd

This comment has been minimized.

Show comment
Hide comment
@sundayhd

sundayhd Jan 28, 2017

You can use my module react-native-display to show/hide components.

sundayhd commented Jan 28, 2017

You can use my module react-native-display to show/hide components.

@facebook facebook locked as resolved and limited conversation to collaborators May 29, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.