私のリアクションネイティブFirebase APLに奇妙なエラーがあります。NSnull型のJSON値をNSStringに変換できません
反応しないネイティブrun-androidはエラーなく正常に動作します。
しかし、NSnull型のJSON値で反応ネイティブrun-iosが失敗し、NSStringに変換できません。次のように
ソースコードがある。(firebase上の認証作業をメインとサインアップクラス)
私はFirebaseクラスはJSONをテキストに変換するには、IOSとAndroid上の異なるACTを持っていると思います。
ご了承ください。
商事
メイン
//ここfirebaseアプリを初期化し、必要に応じて他のコンポーネントに渡します。起動時にのみ初期化します。
const firebaseApp = firebase.initializeApp(firebaseConfig);
var GiftedMessenger = require('react-native-gifted-messenger');
let styles = {}
class Pricing extends Component {
constructor(props){
super(props);
this.state = {
page: null
};
/* this.itemsRef = this.getRef().child('items'); */
}
componentWillMount(){
// We must asynchronously get the auth state, if we use currentUser here, it'll be null
const unsubscribe = firebaseApp.auth().onAuthStateChanged((user) => {
// If the user is logged in take them to the accounts screen
if (user != null) {
this.setState({page: Account});
console.log('(user != null)')
return;
}
// otherwise have them login
console.log('(user != Login)')
this.setState({page: Login});
// unsubscribe this observer
unsubscribe();
});
}
render() {
if (this.state.page) {
return (
// Take the user to whatever page we set the state to.
// We will use a transition where the new page will slide in from the right.
<Navigator
initialRoute={{component: this.state.page}}
configureScene={() => {
return Navigator.SceneConfigs.FloatFromRight;
}}
renderScene={(route, navigator) => {
if(route.component){
// Pass the navigator the the page so it can navigate as well.
// Pass firebaseApp so it can make calls to firebase.
return React.createElement(route.component, { navigator, firebaseApp});
}
}} />
);
} else {
return (
// Our default loading view while waiting to hear back from firebase
エラーは非常に具体的です。質問は同じことを試みるべきです。 – user2864740
私のAPLと呼ばれるCLASS firebaseは以下の通りです。 const firebaseApp = firebase.initializeApp(firebaseConfig); CONST解除= firebaseApp.auth()。onAuthStateChanged((ユーザー)=> { this.props.firebaseApp.auth()。createUserWithEmailAndPassword( CONSTのuserData = this.props.firebaseApp.auth()。あるCurrentUser; ソース= {{URI:this.state.user.photoURL}}それが完了したら/> //ログアウト、ログイン画面にユーザを戻す this.props.firebaseApp。 auth()。signOut()。then(()=> { – itagaki