Skip to content
A component for getting the dimensions of a view in React Native
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
__snapshots__ More dependency changing and bumped version Jul 11, 2017
.babelrc More dependency changing and bumped version Jul 11, 2017
.gitignore Initial commit Jun 27, 2017
README.md Change to a component that takes a function as a child Jul 6, 2017
index.js Change to a component that takes a function as a child Jul 6, 2017
index.test.js Change to a component that takes a function as a child Jul 6, 2017
jsconfig.json Initial commit Jun 27, 2017
package.json More dependency changing and bumped version Jul 11, 2017
yarn.lock

README.md

react-native-on-layout

Having to get a components rendered dimensions is a pretty common pattern in React Native and this is a component that makes doing so easy.

import OnLayout from 'react-native-on-layout'

<OnLayout>
    {({ width, height}) => (
        <Text>{width} {height}</text>
    )}
</OnLayout>

OnLayout renders a View component to do onLayout so you can pass any View prop to OnLayout and it will pass them as props to the rendered View component.

You can’t perform that action at this time.