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>
 );
}

Related Query

More Query from same tag