react,react-nativeを勉強中です。functionでコードを書いたらexpoでいけるのですが、アロー関数にするとエラーがでます。エラーをみる限りでは、rootがとおってないのでclassかfunctionでしてくださいとのことみたいです。設定(jsonなど)が違うとかなのでしょうか?
ちなみに、書籍を参考にしています。(コードは設定値を変えてアップしています)
import React from 'react';
import { View, Text, StyleSheet } from 'react-native';
export const MarginPadding = () => (
<View style={styles.container}>
<Text>コンテンツ</Text>
</View>
);
const styles =StyleSheet.create({
container: {
margin: 72,
padding: 16,
width: 200,
height:100,
borderWidth: StyleSheet.hairlineWidth,
borderColor: '#bbb'
}
});
あなたの回答
tips
プレビュー