score:3
Accepted answer
onlayout(event) {
const {x, y, height, width} = event.nativeevent.layout;
const newheight = this.state.view2layoutprops.height + 1;
const newlayout = {
height: newheight ,
width: width,
left: x,
top: y,
};
this.setstate({ view2layoutprops: newlayout });
}
render() {
return (
<view style={styles.container}>
<view style={styles.view1}>
<text>{this.state.view2layoutprops.height}</text>
</view>
<view onlayout={(event) => this.onlayout(event)}
style={[styles.view2, this.state.view2layoutprops]} />
<view style={styles.view3} />
</view>
);
}
}
Source: stackoverflow.com
Related Query
- React Native (View) onLayout does not execute functions
- Async function does not execute - Expo React Native
- Why does React Native not offer a justify-self
- React router 4 does not update view on link, but does on refresh
- Scroll View inside view not working react native
- React Native - why padding does not work?
- React Native does not support development on Windows (yet)?
- Forcing onLayout on React Native view
- React Native react-native-maps Mapview does not show up
- React native buttons OnPress does not fire when app running in debug mode
- Why does my Animated view not stay in the correct place in React Native?
- uri image is not rendering in React native Image view
- React component view does not get update
- reactnative IllegalViewOperationException: Unable to execute operation dispatchViewManagerCommand on view with tag: 1909 since the view does not exist
- Problem: Why react native video does not play video in full screen?
- React Native issue: Module does not exist in the Haste module map
- React native does not give error on undefined variables
- React router goes to proper URL but does not update the view
- React Native release apk does not fetch data from local network
- React Router does not update View
- React : useEffect updates the state, but does not re-render the view
- React JS: Calling two functions in an onClick event does not run functions
- React Query w/NextJS - I'm noticing that, once my page has loaded, the query does not execute until I have clicked within the browser's viewport
- React redux and React router,link change does not re render view
- Why does react redux does not re render view for object states changes?
- React map function does not execute when the component is rendered
- Object.keys does not render my view in react
- React Button does not update the view
- Warning: Functions are not valid as a React child- List items does not show up
- REACT my custom crosshair does not activate onclick functions
More Query from same tag
- How to get search box in `CommandBar` after update to Fabric 6
- Not redirecting to desired page
- Showing a value (instead of label) on a Material UI Autocomplete
- I need to make my react-modal change background color whenever I click on a button
- I am trying to restart a GIF animation in a React using hooks
- json render issue using react to generate form field?
- React-bootstrap Modal is not popping up onClick of function
- Re-render only part of the component
- added a props onPress in that I am calling an event handleEvent. but nothing printing inside the method
- Cannot access property passed via user provider
- How to use keyboard shortcuts globally
- How to get id of the clicked element in React JS?
- Regular Expression just takes forever on a non recognized character
- Why does async function fail as soon as I reference value set by useParams react hook?
- When I use outlet in accordion, axios request in useEffect keeps executing
- Different behaviour of setInterval in react vs vanilla javascript
- Can I append my component to a div's existing content in ReactJS?
- React material-ui TextField text align and hide cursor
- how can useRef be used for storing previous state
- How to edit input value in React Js?
- Three.js and React-three-fiber model is completely black?
- Change Menu background color on React-Admin
- styled-system props typing with TypeScript
- React setTimeout after 3 seconds on Error
- Setting baseURL for axios for use with Stripe / React
- React.js: Use Map function to Array of Objects into Array of Array depends by specified attribute
- ReactJs submitting form data to the screen
- Invalid value for createPaymentMethod: card should be an object or element
- material ui autocomplete in dialog placeholder fix delay
- Click 2 elements at the same time?