0

image of CMD スタイルを実行する前に、同じファイルが使用されていました。私たちはすべてのスタイルをカットし、別のファイルに貼り付けました。これはどのように見えるかです。スタイルファイルを分割しようとすると、アプリはレンダリングされず、いつも背景のスピナーが表示されます

import React, {Component} from "react"; 
import {Dimensions} from "react-native"; 
const win = Dimensions.get('window'); 

const styles={ 
    content: { 

    justifyContent:'center' 
}, 

    img: { 
    flex: 1, 
    alignSelf: "stretch", 
    width: win.width, 
     height: win.height, 

    }, 


    item:{ 
borderBottomColor: "#0dc49c" 
    }, 

    icon:{ 
color: "#a4916c", 
marginLeft: 10, 
    marginRight: 5 
    }, 

    input:{ 
    color: "#a4916c" 
    }, 

    list:{ 
    borderBottomWidth: 0, 
    borderTopWidth: 0, 
    borderBottomColor: "#a4916c", 
    }, 

    contacticon: { 
    justifyContent: "center", 
    alignSelf: "center", 
    fontSize: 60, 
    fontWeight: "bold", 
    color: "#0dc49c", 
    marginBottom: 2, 
    }, 
    contacttext: { 
    justifyContent: "center", 
    alignSelf: "center", 
    fontSize: 25, 
    color: "#0dc49c", 
    marginBottom: 180, 
    }, 

} 

module.exports = styles; 

コンポーネントと同じファイル上にあったときは、重複したスタイルのために完全に処理されていました。なにが問題ですか?どのように修正することができますか?

+0

のようなこの

import { StyleSheet } from "react-native"; const styles = StyleSheet.create({ content: { justifyContent:'center' }, }); module.exports = styles; 

と輸入のスタイルのようなスタイルを使用してみては? –

+0

"../styles/file"からimport {styles}を実行します。 は、各要素について次のようになります。また、私は 'それはその問題の理由ではないことを希望'を使用して追加していない。 – Syuzanna

答えて

0

はあなたのコンポーネントでそれをインポートするにはどうすればよいこの

import styles from "../styles/file 
関連する問題