「Navigator」オブジェクトを使用するReact Nativeのチュートリアルを行っていますが、このチュートリアルは、投稿されました。コードに修正が加えられているエラッタがいくつか含まれていますが、それでも上記のエラーは防げません。このトピックに関する他の質問を検索しましたが、解決策は私のためには機能しません。React-Native - 未定義はオブジェクトではありません( "evaluation_react3.default.PropTypes.shape")
私は'react-native-deprecated-custom-components'
と'prop-types'
をインストールし、以下のコードに含めました。ここで
は、コードは次のとおりです。あなたが提供することができます任意の助け
import React, { Component } from 'react';
import {
Platform,
StyleSheet,
Text,
View,
Image,
TouchableOpacity
} from 'react-native';
import { Navigator } from 'react-native-deprecated-custom-components';
import PropTypes from 'prop-types';
import Quote from './quote';
const zenImage = require ('./assets/zen_circle.png');
const navScene = {
sceneContainer: {
flex: 1,
justifyContent: 'center',
alignItems: 'stretch'
}
}
export default class App extends Component<{}> {
// Following two lines of code were included in the errata, but cause
// an unexpected token error right on the first period below.
// Navigator.sceneStyle = {navScene.sceneContainer};
// sceneStyle={styles.sceneContainer};
render() {
return (
<Navigator
initialRoute={{ name: 'StartScreen' }}
renderScene={(route, navigator) => {
return (
<View style={styles.container}>
{/*<TouchableOpacity style={styles.button} onPress={() => {alert('I was pressed!')}}>
<Image source={zenImage} style={styles.buttonImage} />
</TouchableOpacity>
<Text style={styles.readyText}>I'm ready to relax...</Text>*/}
<Quote quoteText="Amazing quote!" quoteSource="- Great source!"/>
</View>
);
}}
/>
);
}
}
ありがとう!既にインストールされているが
"react-native-deprecated-custom-components": "github:facebookarchive/react-native-custom-components",
あなたはRM -rf node_modules && NPM私を試してみたのですか? – challenger