小编Nou*_*hir的帖子

React Native - Firebase auth持久性不起作用

Firebase身份验证不会持续登录用户,每次刷新或重新打开应用程序时我都必须重新登录.

我已经尝试将持久性设置为本地,并且回调确实验证了它的设置,但持久性仍然无效

为了设置持久性我正在使用...

  //set auth persistence
  firebase.auth().setPersistence(firebase.auth.Auth.Persistence.LOCAL)
    .then(function() {
      console.log("successfully set the persistence");

    })
    .catch(function(error){
    console.log("failed to ser persistence: " + error.message)
  });
Run Code Online (Sandbox Code Playgroud)

...登录时我正在使用此代码

firebase.auth().signInWithEmailAndPassword(email, password)
      .then((user) =>{
        this.checkAccountStatus(user.uid, user.email);
      })
      .catch(function(error) {
      // Handle Errors here.

      var errorCode = error.code;
      var errorMessage = error.message;

      console.log(errorMessage)
      // ...
    });
Run Code Online (Sandbox Code Playgroud)

这是我用来检查登录状态的代码......

if (firebase.auth().currentUser) {
        const currentUser = firebase.auth().currentUser;
        console.log("Signed in username" + currentUser.displayName);

        this.props.navigation.navigate('AppTab');
      }else{
        console.log("no user signed in");
        this.props.navigation.navigate('AuthTab');
      }
Run Code Online (Sandbox Code Playgroud)

如果有什么我做得不对

persistence firebase react-native firebase-authentication

9
推荐指数
1
解决办法
6436
查看次数

响应本机-iOS-启用大文本表单可访问性弄乱了一切

到目前为止,我的应用程序看上去很漂亮,但是一旦从“辅助功能”中启用了“大文本”选项,所有内容就开始变得肮脏,甚至是导航栏。

请提出一种智能处理这些更改的方法。 在此处输入图片说明

ios react-native react-navigation

3
推荐指数
1
解决办法
691
查看次数

react native - webview在构建发布apk时不呈现本地html

我在 webview 中为我的应用程序渲染了本地 html,它在 iOS 和 Android 上都很棒。这是一个嵌入了 svg 标签的 html。

但是一旦我在 Android 上生成了一个 apk 并尝试在我的手机上本地运行,它就不会呈现。

即使导出 .ipa 文件,也能在 iOS 上正常运行

const VECTOR_BODY_HTML = require('../custom_views/vector-body.html');
...
         <WebView
           ref={component => this.mWebView = component}

           automaticallyAdjustContentInsets = {false}
           contentInset={{top:0 , left:0 ,bottom:-20, right:0}}

           source = {VECTOR_BODY_HTML}
           scalesPageToFit = {false}

           onLoad = {() => {
               this.updateBodyViewBox(bodyWidth, bodyHeight);
               this.initColorMap();
               this.populateBodyMap(15)
             }
             }
           onMessage = {(data) => {this.onMessage(data);}}

           style = {{height:bodyHeight}}
          >
          </WebView>
Run Code Online (Sandbox Code Playgroud)

android build webview apk react-native

1
推荐指数
1
解决办法
3592
查看次数