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

Transparent background for around Modal 0.10.0rc #2386

Closed
levic92 opened this issue Aug 19, 2015 · 3 comments
Closed

Transparent background for around Modal 0.10.0rc #2386

levic92 opened this issue Aug 19, 2015 · 3 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@levic92
Copy link
Contributor

levic92 commented Aug 19, 2015

I have tried to create a Modal that only takes up part of the screen (on iPad) the problem is that I want the surrounding area to have a transparent background. What I did was wrap the Modal component with a View and applied a background color to the style of that view, this seems to successfully pass down the background color to the area surrounding the modal container. So i tried applying a transparent background to that view and during the animation it is transparent but once the animation stops the area surrounding the modal is black. Is there any way to achieve this behavior?

<View  style={styles.wrapper}>
  <Modal animated={true} ... >
    <View style={styles.container}>
      <Text>Modal content....</Text>
    </View>
  </Modal>
</View>

var styles = StyleSheet.create({
  wrapper: {
    backgroundColor: "transparent",
  },
  container: {
    alignItems: 'center',
    backgroundColor: '#f5fcff',
    flex: 1,
    justifyContent: 'center',
    marginVerical: 100,
    marginHorizontal: 100,
  },
});
@browniefed
Copy link
Contributor

@ide
Copy link
Contributor

ide commented Aug 27, 2015

Should be synced now and published with 0.11-rc.

@y2k-shubham
Copy link

See my answer at aksonov/react-native-router-flux#749

I achieved this by the combination of following:

  • in your render method where you are rendering Modal, pass a prop transparent={true}
  • add a single View child to your modal (put all other things inside this View) and apply style to it with backgroundColor = 'rgba(r, g, b, a)' as described above

@facebook facebook locked as resolved and limited conversation to collaborators Jul 21, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

6 participants