文字通り、初期化コードをindex.android.js/index.ios.js
からapp/index.js
に移動するだけです。私はそれをエクスポートし、それをindex.android.js
またはindex.ios.js
に戻します。糸でネイティブビルドエラーに反応しますか?
次にエラーが発生します。私は、NPMを使用する場合
Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object
は、この問題を持っていませんでした。私のパッケージャに何かを保存するときはいつでも、糸の構築プロセスは異なるかもしれないと言われます。
Bundling 'index.android.js'
しかしiOSについては何も言いません。この
import React, { Component } from 'react';
import {
StyleSheet,
Text,
View
} from 'react-native';
export default class Snapp extends Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to React Native!
</Text>
</View>
);
}
}
そして、私のindex.android.js
とindex.ios.js
ファイルのような
私app/index.js
ルックスはこの
import Snapp from './app'
import { AppRegistry } from 'react-native';
AppRegistry.registerComponent('Snapp',() => Snapp);
任意の考えのように見えますか?
'ネイティブ反応すると、あなたは、パッケージャを再起動しました糸のインストールの間に開始 - - リセットキャッシュ? – wmcbain
私のプロジェクトで 'rm yarn.lock && rm -rf node_module && npm install'を実行し、' react-native start -reset-cache'を実行してもエラーが発生しました。 – maxwellgover
パッケージャが停止していることを確認し、 'rm -rf ios/build ios/DerivedData rm -rf node_modules'も試してください。 Xcodeプロジェクトを開いてクリーンアップします(cmd + shift + K)。モジュールを再インストールし、packagerをリセットキャッシュで再起動してから実行してください。 – wmcbain