定義されたアセンブリは、ネイティブリアクト

App.jsまた、このファイルには、複数のコンポーネントを定義することができ、構成要素と考えることができますか?

輸入こんにちは'./Hello'から
の輸出のデフォルトクラスのAppは、コンポーネントを{拡張

  (){レンダリング
    リターン <表示> 
        <こんにちは名= "你伟哥" /> 
      </ビュー>     ); 
  } 
}

  

 

第二の方法

// 機能状態は、この使用せずに書き込むことができない
機能をアプリケーション(小道具){
   リターン <= {{テキストスタイルのfontSize:20である、のbackgroundColor: '赤'、marginTop:50}}>。ハロー{} </テキスト> Props.name
 } 
module.exportsは =アプリ。

 

あなたが反応し、ネイティブのinit XXXコマンドを使用してプロジェクトを作成すると、彼はこのようなコンポーネントを作成します。

機能アセンブリのライフサイクルを記述するための唯一の方法

また、すべての権利を削除されたconstキーワードの役割は何ですか?あると思われます

CONSTアプリ=()=> {
   リターン <断片> 
      <ステータスバーbarStyle = "暗コンテンツ" /> 
      <SafeAreaView> 
        < ScrollView 
          contentInsetAdjustmentBehavior = "自動" 
          スタイル = {styles.scrollView}> 
          <ヘッダ/> 
          {global.HermesInternal == NULLヌル <ビュースタイル= {styles.engine}> 
              <テキストスタイル= {styles.footer}>エンジン:エルメス</テキスト> 
            </ビュー>           )}
           <ビュースタイル= {styles.body}> 
              <テキストスタイル= {styles.sectionTitle}>ステップ1 </テキスト>
 
            <ビュースタイル= {} styles.sectionContainer>
              <テキストスタイル= {} styles.sectionDescription> 
                編集 <テキストスタイル= {} styles.highlight> App.js </テキスト>この変更に
                 画面をして、編集内容を見に戻ってきます。
              </テキスト> 
            </ビュー> 
            <ビュースタイル= {} styles.sectionContainer> 
              <テキストスタイル= {} styles.sectionTitle>変更を参照してください。</テキスト> 
              <テキストスタイル= {} styles.sectionDescription> 
                <ReloadInstructions /> 
              < /テキスト> 
            </表示> 
              <テキストスタイル= {styles.sectionDescription}> 
            <ビュースタイル= {} styles.sectionContainer>
              <テキストスタイル= {} styles.sectionTitle>デバッグ</テキスト> 
              </テキスト> 
            </ビュー> 
            <ビュースタイル= {} styles.sectionContainer> 
              <テキストスタイル= {} styles.sectionTitle>詳細はこちら</テキスト> 
              <テキストスタイル= {} styles.sectionDescription> 
                するものを発見するためにドキュメントを読んでください次:
               </テキスト> 
            </表示> 
            <LearnMoreLinks /> 
          </ビュー> 
        </ ScrollView> 
      </ SafeAreaView> 
    </フラグメント>   ); 
}。
constのスタイル = スタイルシート。


    backgroundColor:Colors.lighter、
  }、
  エンジン:{ '絶対' 
    右: 0 
  }、
  本体:{ 
    backgroundColorの:Colors.white、
  }、
  sectionContainer:{ 
    marginTop: 32 
    paddingHorizo​​ntal: 24 
  }、
  sectionTitle:{ 
    たfontSize: 24 
    たfontWeight: '600' 
    色:Colors.black、
  }、
  sectionDescription:{ 
    marginTop: 8 
    のfontSize: 18 
    たfontWeight:'400' 
    色:Colors.dark、
  }、
  ハイライト:{ 
    たfontWeight: '700' 
  }、
  フッタ:{ 
    色:Colors.dark、
    のfontSize: 12 
    たfontWeight: '600' 
    パディング: 4 
    paddingRight: 12 
    textAlign: '正しいです' 
  }、
}); 

輸出デフォルトのApp。

 

おすすめ

転載: www.cnblogs.com/liuw-flexi/p/11408471.html