score:0
if you mean this:
onpress={() => this.setstate({pickedimage: photos.node.image.uri})}
it just change the state value. what you should do is put an if statement on the return of cameraroll.js:
private onpress = (img) => {
this.props.onimagepicked(img)
}
render() {
return(
<view style={styles.container}>
<image source={{uri: this.state.pickedimage}} style={styles.image}/>
<scrollview contentcontainerstyle={styles.scrollview} showsverticalscrollindicator={false}>
{this.state.photos.map((photos, index) => {
return(
<touchablehighlight
style={{opacity: index === this.state.index ? .5 : 1}}
onpress={() => this.onpress(photos.node.image.uri))}
key={index}
underlaycolor='transparent'
>
<image
style={{width: width / 3, height: width /3}}
source={{uri: photos.node.image.uri}}
resizemode='cover'
/>
</touchablehighlight>
);
})}
</scrollview>
</view>
);
}
and in eventcreator.js:
constructor(){
super(props);
this.state = {
pickedimg: undefined
}
}
private onimagepicked = (newimg) => {
this.setstate({
pickedimg: newimg
})
}
render(){
return(
<view style={styles.container}>
<eventinput
titleonchangetext={this.eventnamechangedhandler}
descriptiononchangetext={this.eventdescriptionchangedhandler}
titleevent={this.state.controls.eventname}
descriptionevent={this.state.controls.eventdescription}
/>
<image
style={styles.image}
source={this.props.source}
resizemode='contain'
/>
<cameraroll props={...} onimagepicked={this.onimagepicked}/>
</view>
);
}
Source: stackoverflow.com
Related Query
- React Native - How to pass the Image from the other Component without using React Redux
- How to pass the match when using render in Route component from react router (v4)
- I can not get the state from react router Link component using useLocation. So how can I pass it?
- How to pass function from FUNCTIONAL to CLASS component and access it outside of render( without prop ), using context in react js?
- How do you pass an image from the root component to a child component using state variables in React?
- How do you pass data from one view to the other via react-router-dom without using url parameters?
- How to pass a dynamic value from one component to the other in React
- How do I use react context API to pass data from parent component to child component when using react-router in the parent component in React.js?
- how to pass just the function from one component to other component without passing the whole component or button click
- React Native - How to load local image using the uri in Image Component?
- Using React how do I toggle the visibility of a nested component from a container component?
- How to call a component function on other component, but from the other component ? React
- How to add new props dynamically to the component using navigator in React Native
- How do I pass in the variant property of the material-ui TextField from a wrapping React component
- Using React Hooks, when I pass down a prop from parent to a child component, the prop in the child component is undefined
- How to pass input values from a child Form component to the state of its parent component for submission with react hooks?
- how to take out the day name from the input date without using moment js in react
- How to take the input from a react component and pass the length of the input to another react component
- How to update redux state using a react variable passed up to the component from a child
- How to pass route parameters from one Component and display in the other
- How to pass the props value from the other sibling components in React JS
- How to pass data from blade.php file to a react component using HTML element attributes?
- How to pass props from container component to redux form(component) - react using typescript
- How can I crop an image on the client side without losing resolution using React
- How to prevent React from re-rendering the whole component when using setInterval
- How to use the useHook in the component rather than passing the value returned from it as a prop to the components using react and typescript?
- How to set state in a React component using this.setState without explicitly passing the field name to update?
- In React How to pass object using history.push from a component to child component and read data
- How to extract common logic from a react component (But the common logic is using setState)
- How to invoke one component action from other component Using React Hooks?
More Query from same tag
- What is the correct way to write state-dependent inline CSS 'style'?
- How to run formatjs compile?
- is specifying isRequired in Proptypes should come at last?
- React - Module parse failed: Unexpected Token. You may need an appropriate loader to handle this file type
- Detecting which input is focused React hooks
- How to add a button inside every row under a particular column in Bootstrap React Table?
- ReactJs: Creating components from array leads to old props
- Cannot read properties of undefined (reading 'push')
- Why useState function made of javascript does not work when the state is variable?
- How to add Custom Styles for react-bootstrap Components?
- Material UI Table component is not playing nice with Redux
- React Typescript: Pass function as props with arguments
- How to Define TextdecoderStream and TextEncoderStream while using Web Serial in react?
- Create React app with React-Snapshot Pre-Rendering static files
- Python - scraping list content from ReactJS div
- How can I append objects to the body of a component in React?
- How to use `React.createElement` children parameter (without jsx)
- ReactJs - Each child in a list should have a unique "key" prop
- StyledComponents: Referencing another component
- How to make List Items clickable individually from one another in react.js
- React firebase api - .a.auth is not a function
- What is the right regex pattern for ignore in @babel/register
- I am trying to use a weather api that I am trying to pull data from i am getting undefined but the property does exist
- How to make scrollbar in lesser width/length compared to the container
- { apollo-client, react, grapgql } what is good way handle multiple loadings?
- Props Parent component to a parent - child component
- Can not use keyword 'await' outside an async function
- React Firebase Timestamp Usage
- Installing react gives the following error
- Next.JS - `.htaccess` file?