小编atl*_*teh的帖子

RTL在RTL设备中被强制使用

本机作出反应的新版本已经发布了RTL设备的支持: https://facebook.github.io/react-native/blog/2016/08/19/right-to-left-support-for-react-native-apps .html
然而,似乎在RTL安卓设备中,RTL布局是强制的,并且没有办法改变它,所以现在所有的应用程序都被破坏了RTL设备.如何强制我的应用程序使用LTR?

android right-to-left react-native

25
推荐指数
4
解决办法
4833
查看次数

Facebook登录react-native&firebase 3.1

最近firebase团队发布了新版本的firebase 3.1,它与react-native兼容.我正试图在facebook上使用新的firebase api.

由于firebase不支持react-native中的弹出或重定向,我使用react-native-fbsdk来获取访问令牌,但是当我尝试使用auth.signInWithCredential时,登录失败

代码:"auth/app-not-authorized",
消息:"此应用由托管的域识别,无权使用提供的API密钥使用Firebase身份验证.请在Google API控制台中查看您的密钥配置."

这是我的代码.任何帮助将非常感谢.

import { LoginManager, AccessToken} from 'react-native-fbsdk';
import firebase from '../Services/firebase';

const auth = firebase.auth();
const provider = firebase.auth.FacebookAuthProvider;

LoginManager.logInWithReadPermissions(['public_profile'])
.then(loginResult => {
    if (loginResult.isCancelled) {
        console.log('user canceled');
        return;
    }
    AccessToken.getCurrentAccessToken()
    .then(accessTokenData => {
        const credential = provider.credential(accessTokenData.accessToken);
        return auth.signInWithCredential(credential);
    })
    .then(credData => {
        console.log(credData);
    })
    .catch(err => {
        console.log(err);
    });
});
Run Code Online (Sandbox Code Playgroud)

facebook firebase react-native firebase-authentication

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

使用es6 import语句的Firebase云功能

有没有办法在Cloud Functions for Firebase中使用es6语法?

import functions from 'firebase-functions';

export const helloWorld = functions.https.onRequest((request, response) => {
 response.send("Hello from Firebase!");
})
Run Code Online (Sandbox Code Playgroud)

失败:

SyntaxError: Unexpected token import
Run Code Online (Sandbox Code Playgroud)

firebase ecmascript-6 google-cloud-functions

13
推荐指数
5
解决办法
6545
查看次数

发送响应后继续执行(Cloudbase for Firebase)

我正在使用具有https触发器的Firebase函数,我想知道在将响应发送到客户端多长时间后,函数仍在执行.我想向客户端发送响应,然后执行另一个操作(发送邮件).目前我这样做如下:

module.exports.doSomeJob = functions.https.onRequest((req, res) => {
    doSomeAsyncJob()
    .then(() => {
        res.send("Ok");
    })
    .then(() => {
        emailSender.sendEmail();
    })
    .catch(...);
});
Run Code Online (Sandbox Code Playgroud)

上面的代码对我有用,但是我怀疑代码只能起作用,因为在res.send完成之前发送邮件已经完成了,所以我想知道终止进程是如何工作的以确保代码不会打破.

firebase google-cloud-functions

11
推荐指数
3
解决办法
1848
查看次数

react-native google api限制

使用firebasereact-native-google-places-autocomplete时,我需要提供api密钥.显然,我不能使用本机api密钥,因为调用是使用Web客户端进行的.所以我必须使用web api密钥.问题是,我无法在谷歌控制台中限制它,因为我没有推荐人或IP地址.有什么方法可以解决这个问题吗?

google-api firebase react-native

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

防止 ToolStripMenuItems 跳转到第二个屏幕

我有一个应用程序,主要是通过 NotifyIcon 的 ContextMenuStrip 操作的
,ToolStripMenuItems 有多个级别,用户可以通过它们。
问题是,当用户有两个屏幕时,如果没有可用空间,MenuItems 会跳转到第二个屏幕。像这样:

在此处输入图片说明

我怎样才能强迫他们留在同一个屏幕上?我试图通过网络搜索,但找不到合适的答案。

这是我用来测试这个 senario 的一段示例代码:

public partial class Form1 : Form
{

    public Form1()
    {
        InitializeComponent();

        var resources = new ComponentResourceManager(typeof(Form1));
        var notifyIcon1 = new NotifyIcon(components);
        var contextMenuStrip1 = new ContextMenuStrip(components);
        var level1ToolStripMenuItem = new ToolStripMenuItem("level 1 drop down");
        var level2ToolStripMenuItem = new ToolStripMenuItem("level 2 drop down");
        var level3ToolStripMenuItem = new ToolStripMenuItem("level 3 drop down");

        notifyIcon1.ContextMenuStrip = contextMenuStrip1;
        notifyIcon1.Icon = ((Icon)(resources.GetObject("notifyIcon1.Icon")));
        notifyIcon1.Visible = true;

        level2ToolStripMenuItem.DropDownItems.Add(level3ToolStripMenuItem);
        level1ToolStripMenuItem.DropDownItems.Add(level2ToolStripMenuItem);
        contextMenuStrip1.Items.Add(level1ToolStripMenuItem);
    }
}
Run Code Online (Sandbox Code Playgroud)

c# multiple-monitors notifyicon winforms toolstripdropdown

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

带有\后备字段的二进制格式化程序和属性

我使用BinaryFormatter将以下类序列化到一个文件中:

[Serializable]
public class TestClass
{
    public String ItemTwo { get; set; }
    public String ItemOne { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

使用此代码:

FileStream fs = new FileStream("DataFile.dat", FileMode.Create);
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(fs, new TestClass{ItemOne = "ItemOne", ItemTwo = "ItemTwo"});
fs.Close();
Run Code Online (Sandbox Code Playgroud)

使用此代码反序列化时:

FileStream fs = new FileStream("DataFile.dat", FileMode.Open);
BinaryFormatter formatter = new BinaryFormatter();
TestClass addresses = (TestClass)formatter.Deserialize(fs);
fs.Close();
Run Code Online (Sandbox Code Playgroud)

我得到一切正常.但是,现在我需要这个类有一些支持字段,如下所示:

[Serializable]
public class TestClass
{
    private string _itemTwo;
    private string _itemOne;

    public String ItemTwo
    {
        get { return _itemTwo; } …
Run Code Online (Sandbox Code Playgroud)

c# properties binaryformatter backing-field deserialization

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