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

Image as background cannot set background position #12347

Closed
sscaff1 opened this issue Feb 12, 2017 · 8 comments
Closed

Image as background cannot set background position #12347

sscaff1 opened this issue Feb 12, 2017 · 8 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@sscaff1
Copy link
Contributor

sscaff1 commented Feb 12, 2017

I have a variable image coming from the web that I need to use as the background of a container. So this works fine. The only problem is I don't know how to set the position of the background. I want to use something like background-position so that my background is in the top left.

Here is a code snippet:

export default function App({ uri }) {
  return (
    <Image source={{ uri }} style={styles.container}>
      <Text>HELLO WORLD</Text>
    </Image>
  );
}
const styles = StyleSheet.create({
  container: {
    padding: 5,
    height: 150,
    width: WINDOW_WIDTH,
    resizeMode: 'cover',
    backgroundColor: 'transparent',
  },
});

The default background position seems to be the center of the image. Anyway to get this to work?

@hramos
Copy link
Contributor

hramos commented May 25, 2017

We're cutting down on the number of outstanding issues, in order to allow us to focus. I'm closing this issue because it has been open for over 60 days with no activity. If you think it should still be opened let us know why. PRs are always welcome.

@hramos hramos closed this as completed May 25, 2017
@hramos hramos added the Icebox label May 26, 2017
@unmec
Copy link

unmec commented Jun 26, 2017

I am also looking for something similar like background position

@anhuiliujun
Copy link

Me too.

@jeffpc1993
Copy link

Was looking for background position
Unable to find any solution.

@pewh
Copy link

pewh commented Nov 13, 2017

+1 need this for image sprite

@sscaff1
Copy link
Contributor Author

sscaff1 commented Nov 13, 2017

@hramos can this issue be reopened? It seems to be gaining some interest.

@hramos
Copy link
Contributor

hramos commented Nov 13, 2017

@sscaff1 I'd re-open it, but the original post does not adhere to the issue template we're using. Unless the OP edits it, it's probably best to open a new issue.

@sscaff1
Copy link
Contributor Author

sscaff1 commented Nov 13, 2017

Will do thank you.

@facebook facebook locked as resolved and limited conversation to collaborators May 29, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 19, 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

7 participants