2017-11-02 4 views
-1

나는 React-Native에서 2 개의 정적 페이지 앱을 만들고 있습니다.React-Native는 페이지 간을 이동합니다.

버튼이있는 방문 페이지 (TouchableHighlight) About us이 있으며 사용자가이를 클릭하면 전혀 새로운 구성 요소가 렌더링됩니다.

는 HTML에서는이 같은 것을 함께 할 것입니다 : 내가 react-native-router-flux를 사용하는 것을 시도했다 <a href="aboutus.html">

하지만 약간의 오차가 점점 계속 내가 헤더를 갖고 싶어하지 않습니다.

+2

나는 것 RECOM App.js 이를 위해 [반응 탐색] (https://github.com/react-community/react-navigation)을 사용하여 수정하십시오. 나는 그것을 여러 애플 리케이션에 사용했다. –

+0

라우터 코드를 게시 할 수 있습니까? –

답변

0

나는 이런 식

index.android.js에서

(하는 index.js), 가져 와서 당신이 여기에 이동하려는 화면에서

import {StackNavigator} from 'react-navigation' 
    import App from './App'; 
    import App1 from './App1'; 
    import App2 from './App2'; 

    const Navigation = StackNavigator({ 
     App:{screen: App}, 
     App1:{screen: App1}, 
     App2:{screen: App2} 
    }); 

를 탐색 할 화면을 정의 할

export default class App extends React.Component<{}> { 
     static navigationOptions={ 
      title:'First Screen', 
     } 
     render() { 
     var {navigate} = this.props.navigation; 
     return (
      <View> 
      <Text>This is first screen</Text> 
      <Button 
       onPress={() => navigate('App1')} 
       title="Go to screen 2" 
      /> 
      </View> 
     ); 
     } 
    }  

App1.js 것 같은 다른 (App2.js)로 이동하려면 App.js로