할 때 오류를 묶어 웹에서 반응하는 기본 구성 요소를 사용하여 바벨 플러그인 반작용-기본 웹사

0

질문

나는 다음과 같은 이 튜토리얼 을 설정 번들을 위해 웹에서 반응하는 기본 구성 요소입니다.

나는 성공적으로 묶어를 사용하는 웹팩 config 튜토리얼에서,그러나 그 때에 내가 가져올 수출 버튼으로 반응하는 프로젝트를 시도하고 그것을 렌더링,나는 다음과 같은 브라우저에서 오류가:

TypeError: Failed to construct 'Image': Please use the 'new' operator, this DOM object constructor cannot be called as a function.

renderWithHooks
./node_modules/react-dom/cjs/react-dom.development.js:14803

  14800 |   }
  14801 | }
  14802 | 
> 14803 | var children = Component(props, secondArg); // Check if there was a render phase update
        | ^  14804 | 
  14805 | if (workInProgress.expirationTime === renderExpirationTime) {
  14806 |   // Keep rendering in a loop for as long as render phase updates continue to

아래에 반응하는 기본 구성 요소 나는 첨부 웹 사이트:

import React from "react";
import { TouchableOpacity, StyleSheet, Text } from "react-native";

export default function Button({ onPress, imageSource }) {
  return (
    <TouchableOpacity style={styles.button} onPress={onPress}>
      <Text>
        A
        </Text>
    </TouchableOpacity>
  );
}

const styles = StyleSheet.create({
  container: {
    width: 56,
    height: 56,
    borderRadius: 28,
    justifyContent: "center",
    alignItems: "center",
    backgroundColor: "#fff",
  },
  image: {
    width: 28,
    height: 28,
  },
});

이러한 버전의 패키지를 사용하고 번들에 반응하는 기본 구성 요소:

"babel-plugin-react-native-web": "^0.17.5",
"metro-react-native-babel-preset": "^0.66.2",
"webpack": "^5.64.2",
"webpack-cli": "^4.9.1",
"babel-loader": "^8.2.3",
babeljs react-native reactjs webpack
2021-11-24 06:18:01
1

최고의 응답

0

저는 깨달은 문제는 튜토리얼을 내보내지 않습니다 Image에,나는 지금 제대로 내보내기 Image 이것은 효과가 있었습니다.

2021-11-24 11:37:12

다른 언어로

이 페이지는 다른 언어로되어 있습니다

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................