Eduardo
Eduardo

Reputation: 1831

React Native: Create custom component to wrap a page

I am wondering if it is possible to create a custom component which wraps each screen content. I am thinking this as an alternative to create global styles just for the wrapper, just as an experiment:

import React from 'react';

const customPageContainer = (props) => {
    return (
        <View {...props}>
            ????
        </View>
    )
}

export default customPageContainer;

How could I pass each screen content here? I was thinking with a prop, but not sure if it will slow down the app.

Any ideas?

Upvotes: 0

Views: 558

Answers (1)

H. J. Rhenals
H. J. Rhenals

Reputation: 145

You can always use the children prop, more info:

https://reactjs.org/docs/composition-vs-inheritance.html

Upvotes: 1

Related Questions