Skip to content

Latest commit

 

History

History
26 lines (20 loc) · 831 Bytes

File metadata and controls

26 lines (20 loc) · 831 Bytes

react-native-app-helpers/createImageBackgroundComponent

Creates a new React component which displays an image background behind its children.

Usage

import { createImageBackgroundComponent } from "react-native-app-helpers";
import exampleImageSourceA from "./assets/example-a.jpg";
import exampleImageSourceB from "./assets/example-b.jpg";

const ExampleImageBackgroundA = createImageBackgroundComponent(exampleImageSourceA);

const ExampleImageBackgroundB = createImageBackgroundComponent(exampleImageSourceB);

const ExampleScreen = () => (
  <ExampleImageBackgroundA size="fillsContainer">
    <ExampleImageBackgroundB size="fitsContent">
      <Text>
        The entire background of this element is covered by the example image.
      </Text>
    </ExampleImageBackgroundB>
  </ExampleImageBackgroundA>
);