javascript - React Native specific blog detail -


i'm creating react native app , on it's first page(home page) show content of blog feeds , on clicking read more show detailed view of blog feed on next page. so, question how ? using react-native-router-flux navigate between pages. can't understand whether need use reducer opens blog feed on clicking read more or there other option too?

here code:

 import react, { component } 'react';  import {    activityindicator,    listview,    text,    stylesheet,    view,    touchableopacity  } 'react-native';  import {stacknavigator} 'react-navigation';  import {actions, router, scene} 'react-native-router-flux';  import timeago 'react-native-timeago';  import details './details';  import {    card,    carditem,    content,    header,    body,    footer,    footertab,    container,    left,    icon,    right  } 'native-base';   import {getimage,contentsnippet} './helpers/helpers';  import htmlview 'react-native-htmlview';  import fitimage 'react-native-fit-image';  export default class home extends component {    constructor(props) {      super(props);      this.state = {        isloading: true,      }    }  }     componentdidmount() {      return fetch('http://www.cardory.co.uk/jan/json')        .then((response) => response.json())        .then((responsejson) => {          let ds = new listview.datasource({rowhaschanged: (r1, r2) => r1 !==                r2});          this.setstate({            isloading: false,            datasource: ds.clonewithrows(responsejson.items),          }, function() {            // new state          });        })        .catch((error) => {          console.error(error);        });    }     render() {      if (this.state.isloading) {        return (          <view style={{flex: 1, paddingtop: 80}}>                <activityindicator />          </view>        );      }       return (        <container style={{flex: 1, paddingtop: 60}} >        <listview          datasource={this.state.datasource}          renderrow={(rowdata) =>             <card>              <carditem header>                <text style={styles.titleheading}>{rowdata.title}</text>              </carditem>              <carditem cardbody>                  <content style={{marginleft:10,marginright:10}}>                    <fitimage source={{uri: getimage(rowdata.content_html)}}/>                    <htmlview value=     {contentsnippet(rowdata.content_html.replace(/<img[^>]*>/g,""))}/>                  </content>              </carditem>              <carditem>                  <left>                    <touchableopacity onpress={actions.details}>                      <text style={styles.readmore}>                        read more                      </text>                    </touchableopacity>                  </left>                  <body style={{flex:1,flexdirection:'row',justifycontent: 'space-around'}}>                    <touchableopacity >                                          <icon name="heart" style={{color:'#f08080'}}/>                    </touchableopacity>                    <touchableopacity >                       <icon name="share" style={{color:'#778899'}}/>                    </touchableopacity>                  </body>                  <right>                    <text style={styles.time}>                      <icon name="time" style={{color:'#483d8b'}}/>                      <timeago time=  {rowdata.date_published}/>                    </text>                  </right>              </carditem>            </card>          }        />        </container>      );    }  }  const styles=stylesheet.create({    textheading:{      fontsize:20,      margintop:20    },    titleheading:{      fontsize:20,      fontweight:'bold',      color:'black',      alignitems:'center',    },    readmore:{      color:'#483d8b',      fontsize:15,      fontweight:'bold'    },    time:{      color:'#483d8b',      alignself:'stretch'    },  });  module.export=home; 

here output: output image oncliking read more should open specific blog post, kindly tell me how it?


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -