reactjs - Passing image source to another navigation - React Native -


i build simple app school , have question regarding passing images source 1 navigation view navigation view.

here code:

class projekt2 extends react.component {   render() {     return (       <navigator initialroute={{id:'first'}} renderscene={this.navigatorrenderscene}/>     )   }    navigatorrenderscene(route, navigator) {      _navigator = navigator;      switch(route.id) {       case 'first':         return (<first navigator={navigator} title="first" />);       case 'second':         return (<second navigator={navigator} title="second" />)       case 'third':         return (<third navigator={navigator} title="third" />)     }    } };  class first extends react.component { // http://blog.paracode.com/2016/01/05/routing-and-navigation-in-react-native/   navsecond() {     this.props.navigator.push({       id: 'second',     })   }   render() { //na sklad se da navigacijske slide, če klikaš gumbek back, se jemlje iz tega sklada     return (       <view style={styles.container}>            <touchablehighlight             onpress={this.navsecond.bind(this)}>               <view style={{flex: 1, alignitems: 'center', justifycontent: 'center', flexdirection: 'row'}}>               <image source={require('./slike_google/btn_google_light_normal_hdpi.9.png')}></image>                 <text>sign in google</text>               </view>           </touchablehighlight>         </view>     );   } }  class second extends react.component {    _handlepress() {     this.props.navigator.push({       id: 'third',          })   }    _dodaj() {     toastandroid.show('ni se vnesenih kartic',toastandroid.long);   }     render() {     return (       <view style={styles.container} id="prva">         <touchablehighlight onpress={this._dodaj.bind(this)}>           <image source={require( './slike_google/plus_318-80291.png')} style={{width: 30, height: 30}}></image>         </touchablehighlight>         <view>           <touchablehighlight onpress={this._handlepress.bind(this)}>             <image ref="prva" source={require('./slike_google/spar-plus-kartica-ugodnosti-card-benefits.jpg')} style={styles.images}></image>           </touchablehighlight>           <touchablehighlight onpress={this._handlepress.bind(this)}>             <image ref="prva" source={require('./slike_google/spar-plus-kartica-ugodnosti-card-benefits.jpg')} style={styles.images}></image>           </touchablehighlight>           <touchablehighlight onpress={this._handlepress.bind(this)}>             <image ref="prva" source={require('./slike_google/spar-plus-kartica-ugodnosti-card-benefits.jpg')} style={styles.images}></image>           </touchablehighlight>           <touchablehighlight onpress={this._handlepress.bind(this)}>             <image ref="prva" source={require('./slike_google/spar-plus-kartica-ugodnosti-card-benefits.jpg')} style={styles.images}></image>           </touchablehighlight>           <touchablehighlight onpress={this._handlepress.bind(this)}>             <image ref="prva" source={require('./slike_google/spar-plus-kartica-ugodnosti-card-benefits.jpg')} style={styles.images}></image>           </touchablehighlight>         </view>         <text ref="none" style={{opacity: 0}}>se ni dodanih kartic</text>       </view>     );   } };  class third extends react.component {    render() {     return (     <view style={styles.container}>       <image source={require('./slike_google/spar-plus-kartica-ugodnosti-card-benefits.jpg')}></image>     </view>     );   } } 



so, in class third should image's source should like: source={passed_data.url}.

thank help

i did example in https://rnplay.org/apps/b3mj5a

var sampleapp = react.createclass({   render: function() {     var vsource = {uri: 'http://cdn.arstechnica.net/wp-content/uploads/2016/02/5718897981_10faa45ac3_b-640x624.jpg'};     return (       <view style={styles.container}>         <text>customimage example</text>         <customimage source={vsource} />       </view>     );   } });  var customimage = react.createclass({   render: function() {     return (       <view style={styles.container}>         <image source={this.props.source} style={{width: 60,height: 60,}}/>       </view>     );   } }); 

it works fine.

hope looking for.


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -