Error

[React Native] error: Text strings must be rendered within a <Text> component

웨일파도 2024. 6. 14. 13:47
반응형

 Error: Text strings must be rendered within a <Text> component.

for (let d = 1; d <= monthDays; d++) {
      const date = new Date(currentMonth.getFullYear(), currentMonth.getMonth(), d);
      const isToday = today.toDateString() === date.toDateString();
      dayViews.push(
        <Pressable
                key={`day-${d}`}
                style={styles.dayItem}
                onPress={() => setSelectedDate(date)}
        >
          <View>
            <Text style={isToday ? [getDayStyle(d), styles.today] : getDayStyle(d)}>{d}</Text>
          </View>      
        </Pressable>
      );
    }

 

<Text> 컨포넌트가 있어야 한다!

반응형