JoshJoshJosh
JoshJoshJosh

Reputation: 917

add a view to window in react native

I'm developing a react native app primarily for android. I am trying to add a sticky view to the window of the phone, as in iOS, where I can easily access the Window and add a subview to it. But I am struggling with how to do it with react-native.

Upvotes: 2

Views: 725

Answers (1)

gran33
gran33

Reputation: 12951

You can achieve that by using position: 'absolute' and zIndex.

Wrap the whole app with a single view and add to it style={{position: absolute}}

See an example here:

<View style={{flex: 1}}>
  <View style={{position: 'absolute', zIndex: 999}}>...</>
  <SomeView/>
</View>

Upvotes: 4

Related Questions