question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Absolute layout for inner views doesn't work

See original GitHub issue

I need to have backdrop background for some modal views - i.e. inner view overlaps parent using ‘absolute’ position and full-screen dimensions. It worked well with ReactNative 0.6.0, but now doesn’t - it just fills parent view. Here is example - instead of full black screen you will see just 200x100 black area.

How to achieve this goal with new version? Maybe i’ve missed some breaking changes for 0.8.0…

       <View style={{flex:1,alignItems: 'center',justifyContent: 'center'}}>
         <Text>Hello world!</Text>
          <View style={{width:200,height:100,backgroundColor:'red'}}>
            <View style={{position:'absolute',top:0,left:0,bottom:0,right:0, backgroundColor:'black'}}/>
          </View>
       </View>

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
idecommented, Sep 13, 2015

Also I recommend that you use a top-level Navigator instead of Modal. Modal was designed for use in hybrid applications where you have a React Native view embedded in a UINavigationController, and want the React Native code to present a screen on top of the UINavigationController.

With pure React Native, you can simply use a top-level Navigator (wrap your entire app in a scene of this top-level Navigator) and present a modal screen by pushing a scene onto the top-level Navigator’s scene stack with the FloatFromBottom config.

tl;dr: If you are writing a React Native app whose root view is an RCTRootView, do not use Modal. Instead, use Navigator with the “FloatFromBottom” scene config.

1reaction
aksonovcommented, Aug 14, 2015

Could you clarify? How to use truly modularized “react” approach with current react-native layout behavior? I want to have “modal” component which could be used from other component. This way i can’t put it to ‘top-view’ as suggested above, it brokes idea of components.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Absolute layout Scroll view Does not working - MSDN - Microsoft
A ScrollView that you want to fill an AbsoluteLayout needs to specify: AbsoluteLayout.LayoutBounds="0,0,1,1" AbsoluteLayout.LayoutFlags="All" ...
Read more >
Why tap gesture recognizer wont work in absolute layout?
Only images in the bottom of the screen show and others are overlapping by these two AbsoluteLayout, so the tap gesture recognizer wont...
Read more >
Absolute Layout With Example In Android Studio
Tutorial on Absolute Layout with example and code in Android Studio. Also find out why it is depreciated in Android.
Read more >
Android Layout - LinearLayout, RelativeLayout - DigitalOcean
AbsoluteLayout : allows us to specify the exact location of the child views and widgets; TableLayout : is a view that groups its...
Read more >
Relative Layout | Android Developers
RelativeLayout lets child views specify their position relative to the parent view or to each other (specified by ID). So you can align...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found