Skip to content

Instantly share code, notes, and snippets.

@serkanince
Created February 22, 2019 08:00
Show Gist options
  • Save serkanince/75543d89b5401db73e5f59985d818245 to your computer and use it in GitHub Desktop.
Save serkanince/75543d89b5401db73e5f59985d818245 to your computer and use it in GitHub Desktop.
React-Native Navigation Simple Ex
import React, { Component } from 'react'
import { AppRegistry, View, Image,StyleSheet,TextInput,FlatList,ActivityIndicator ,SectionList,Text} from 'react-native'
import { StackViewStyleInterpolator } from 'react-navigation-stack';
import { Scene, Router, Actions, Reducer, ActionConst, Overlay, Tabs, Modal, Drawer, Stack, Lightbox } from 'react-native-router-flux';
import PageOne from './PageOne';
import PageTwo from './PageTwo';
export default class App extends Component {
render() {
return (
<Router>
<Scene key="root">
<Scene key="pageOne" component={PageOne} title="PageOne" initial={true} />
<Scene key="pageTwo" component={PageTwo} title="PageTwo" />
</Scene>
</Router>
)
}
}
import React, { Component } from 'react';
import { View, Text } from 'react-native';
import { Actions,Scene } from 'react-native-router-flux';
export default class PageOne extends Component {
render() {
const goToPageTwo = () => Actions.pageTwo({text: 'Merhaba Dünya!'});
return (
<View style={{margin: 128}}>
<Text onPress={goToPageTwo}>Sayfa 1...!</Text>
</View>
)
}
}
import React, { Component } from 'react';
import { View, Text,Button } from 'react-native';
import { Actions } from 'react-native-router-flux';
export default class PageTwo extends Component {
render() {
return (
<View style={{margin: 128}}>
<Text>Sayfa 2....</Text>
<Text>{this.props.text}</Text>
<Button onPress={()=> Actions.pop()} title='<- Geri Dön'></Button>
<Button onPress={()=> Actions.refresh({text: 'S3rkan!'})} title='Yenile !!'></Button>
</View>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment