score:2
however, this renders without any of the maincontainer elements at all.
you need to use this.props.children
<lineargradient
style={{ flex: 1 }}
colors={[primary, primarygradient2, primarygradient1]}
locations={locations}>
//add this:
{this.props.children}
</lineargradient>
it's a prop passed to all components using an opening and closing tag and contains whatever is between the opening and closing tags.
i'm not totally clear on exactly what you're trying to accomplish, but i suspect you would be best served by placing the <gradienttheme/>
component at or near the root of your app, and managing the theme either locally in it's parent component state or with redux
. in case you need it, here is a nice series of tutorials on using redux and react-navigation together in react-native.
Source: stackoverflow.com
Related Query
- How to apply react-native-linear-gradient for the entire app background with React Native
- How to apply the AsyncStorage to React Native app for storing data on TextInput and Picker
- How to make the background color of an app cover the entire screen (using style) in React Native?
- How to keep a background timer running in react native even when app is in the background
- How to set background image for entire screen in app js file in react js?
- How to detect the device on React SSR App with Next.js?
- How to run socket.io in the background on iOS in a React Native app?
- How should the new context api work with React Native navigator?
- Is there a way to apply a fade in/out transition with React suspense for the fallback component?
- How to enable the Android monitor in React Native for checking logs?
- How to implement the OAuth2 Authorization code grant with PKCE for a React single page application?
- How do I access the phone's camera with React Native iOS?
- React Native start failed with error code -4094 how to solve this ONCE for ALL?
- How can I replace screen with React Navigation for React Native
- Change the background color of a screen with react native
- Can't find variable: _d when running react native app for the first time
- How to run a React Native App with Node js Backend on Android Device?
- How to use Turborepo for an existing react app created with Create React App in order to make it a monorepo?
- How to implement push notifications in React Native when the app is closed
- How can I programmatically set the user details for Launch Darkly in my react app
- How to fix React Native App not building for iOS
- React native buld failed with the following message Failed to list versions for com.facebook.react:react-native
- How to make a gradient background in React with single color?
- How to setup sublime 3 with react native so that when you click on the error and it jump to your code?
- How do I open a React Native Android deeplink when the app is open in the background?
- How do I resolve the React app error for npm run build "Failed to compile. Failed to minify the bundle."?
- How to change the selected table row background color with React
- how to run my node application and react app in the same time with one command?
- How to Update latitude and longitude in service when app is background in react native
- How to determine the order of css in my create react app build with webpack and customize-cra?
More Query from same tag
- Why isBefore method doesn't work as expected in dayjs?
- How do I make SVG level from center of polygon rather than bottom?
- Update in one setState property causes another property change automatically in reactjs
- How do I export a function in a class component into another page?
- How to move a React component to a new Window
- Ant Design form element is not submitting when the form button is clicked
- Concat arrays in redux reducer
- react/flux- child component user events - should everything be routed via the dispatcher
- How to define Relay fragment for GraphQLList of GraphQLObjectType?
- Browser not storing session cookie from React XHR request from express-sessions ** updated config
- ReactJS: passing function to child component results in TypeError
- Mocking `getAppState()` with Jest & Enzyme
- Component keeps making api calls with custom axios hook
- Cache data may be lost when replacing the getPosts field of a Query object. Apollo
- Only half of react router link is clickable
- React ref current is NULL
- Render Blob as State with this.setState() and render Image in DOM
- React Datepicker exclude past dates
- Facebook pixel in Gatsby js/ React js
- i18n translation make a variable in bold
- Is it possible to have more than one parameters in data for a FlatList?
- How can I set height of Material-UI Tabs component?
- Admin-On-Rest auto logout after timeout
- How do i select an object from local json and pass it to the state?
- Unable to modify textfield when using validation from states in Reat js
- use setState Hook to update previous value based on a set of conditions in React JS
- redux state is undefined in useEffect and useSelector
- Functions are not defined (Multiple function calls) - React
- Unobserve IntersectionObserver in React.useEffect
- React unexepected token on a conditional HTML link