有没有人有关于如何在 GraphRequestManager 中使用 promise 的例子?我在我的动作创建者中得到了无法读取属性然后未定义的错误。
function graphRequest(path, params, token=undefined, version=undefined, method='GET') {
return new Promise((resolve, reject) => {
new GraphRequestManager().addRequest(new GraphRequest(
path,
{
httpMethod: method,
version: version,
accessToken: token
},
(error, result) => {
if (error) {
console.log('Error fetching data: ' + error);
reject('error making request. ' + error);
} else {
console.log('Success fetching data: ');
console.log(result);
resolve(result);
}
},
)).start();
});
Run Code Online (Sandbox Code Playgroud)
}
我使用我的动作创建者调用上面的
export function accounts() {
return dispatch => {
console.log("fetching accounts!!!!!!");
dispatch(accountsFetch());
fbAPI.accounts().then((accounts) => {
dispatch(accountsFetchSuccess(accounts));
}).catch((error) …Run Code Online (Sandbox Code Playgroud) LikeView本RCTFBLikeView.onLayout机类型的原生道具没有propType boolean
如果您自己没有更改此道具,这通常意味着您的本机代码版本和JavaScript代码不同步.更新两者应该会使此错误消失.

不知道为什么我收到此错误.我在android应用程序中根本没有使用LikeView.我试过跑步npm start --reset-cache.
此外,iOS版本的应用程序运行没有问题.这只发生在Android上.
欢迎任何建议.
谢谢!
android react-native fbsdk react-native-android react-native-fbsdk
我想实现Facebook Login to My react-native app.我在安装这个插件之前在我的项目上安装了react-native-fbsdk所有东西都工作正常但是在安装之后我要构建我的应用程序时我在下面提到了例外.
D:\Android\mPiggy\mPiggy\node_modules\react-native-fbsdk\android\src\main\java\com\facebook\reactnative\androidsdk\FBSDKPackage.java:61: error: method
does not override or implement a method from a supertype
@Override
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: D:\Android\mPiggy\mPiggy\node_modules\react-native-fbsdk\android\src\main\java\com\facebook\reactnative\androidsdk\Utility.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
:react-native-fbsdk:compileReleaseJavaWithJavac FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-fbsdk:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* …Run Code Online (Sandbox Code Playgroud) 简单来说,如何使用 react-native-fbsdk 提供的 LoginManager 登出?
如果我们查看 react-native-fbsdk 提供的 LoginManager 中的代码,我们会发现这部分是关于logout 的:
logOut() {
LoginManager.logOut();
},
Run Code Online (Sandbox Code Playgroud)
所以没有回调,或承诺?那我该如何真正使用它呢?如果我调用LoginManager.logout(),它实际上会执行注销。但是由于我不允许传递任何回调,并且由于它不返回承诺,那么我怎么知道注销何时完成,或者是否成功?我尝试提供回调,但导致错误。我也试图从中返回一个承诺,但它也返回了一个错误。所以我不知道这应该如何使用?不可能是同步注销吧?
我正在使用react native 0.49.5并反应16.0.0-beta.5来制作应用程序.
我正在使用react native-fbsdk(^ 0.6.3)进行facebook登录.所有必要的步骤都被用来链接android和facebook sdk.
但是当我跑的时候react-native run-android,它引发了一个错误.
CLI中的错误日志(TERMINAL):
/home/sunny/projects/ReactNativeApp/node_modules/react-native-fbsdk/android/build/intermediates/res/merged/release/values-v26/values-v26.xml:15:21-54:AAPT:找不到资源匹配给定名称:attr'android:keyboardNavigationCluster'.
/home/sunny/projects/ReactNativeApp/node_modules/react-native-fbsdk/android/build/intermediates/res/merged/release/values-v26/values-v26.xml:15:错误:错误:找不到匹配的资源给定的名称:attr'android:keyboardNavigationCluster'.
:react-native-fbsdk:processReleaseResources FAILED
FAILURE:构建因异常而失败.
出了什么问题:任务执行失败':react-native-fbsdk:processReleaseResources'.com.android.ide.common.process.ProcessException:无法执行aapt
尝试:使用--stacktrace选项运行以获取堆栈跟踪.使用--info或--debug选项运行以获取更多日志输出.
建筑失败
总时间:4.015秒无法在设备上安装应用程序,请阅读上述错误以获取详细信息.确保运行Android模拟器或连接设备并设置Android开发环境:https: //facebook.github.io/react-native/docs/android-setup.html
这是我的android/build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories { …Run Code Online (Sandbox Code Playgroud) 我刚刚开始使用 react-native 并考虑将其用于离线优先应用程序。我将使用 asyncStorage 作为我的本地存储,因为它可以满足我对这个应用程序的所有需求。但是,我进行了一次徒劳的搜索,寻找类似原生 android 的 Sync Adapter 之类的东西,它允许您根据各种条件自动将数据从本地存储传输到远程数据库。
是否有任何库可以轻松导入到我的 RN 项目中以帮助进行数据同步。或者,我不需要任何外部模块,并且 asyncStorage API 已经支持数据同步到远程数据库。
无论哪种方式,我都想知道是否可以在 AsyncStorage 和远程数据库之间同步数据。谢谢你。
我在运行命令react-native run-android 或 ./gradlew build 时收到以下错误
:react-native-fbsdk:generateReleaseResValues UP-TO-DATE
:react-native-fbsdk:generateReleaseResources
:react-native-fbsdk:mergeReleaseResources
:react-native-fbsdk:processReleaseManifest
:react-native-fbsdk:processReleaseResources
/Users/a/projects/gratisapp/node_modules/react-native-fbsdk/android/build/intermediates/exploded-aar/com.android.support/appcompat-v7/25.3.1/res/values-v24/values-v24.xml:2 : Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.
/Users/a/projects/gratisapp/node_modules/react-native-fbsdk/android/build/intermediates/exploded-aar/com.android.support/appcompat-v7/25.3.1/res/values-v24/values-v24.xml:2 : Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.
:react-native-fbsdk:processReleaseResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-fbsdk:processReleaseResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/a/Library/Android/sdk/build-tools/23.0.1/aapt'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to …Run Code Online (Sandbox Code Playgroud) facebook-android-sdk android-facebook react-native react-native-fbsdk
我正在我的 React-Native 应用程序中使用react-native-fbsdk. 我不明白为什么“使用 facebook 应用程序登录”不起作用。当用户单击此按钮而不是在 Web 视图中输入其凭据时,LoginManager回调似乎永远不会被触发。
以下是发生的情况的视频:https://i.imgur.com/1XeJC1o.mp4
这个问题似乎可能是常见问题解答中的这个问题,但我相信我的AppDelegate.m文件Info.plist设置正确。
#import "AppDelegate.h"
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <SentryReactNative/RNSentry.h>
#import <GoogleMaps/GoogleMaps.h>
#import <react-native-branch/RNBranch.h>
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <RNGoogleSignin/RNGoogleSignin.h>
#import <CodePush/CodePush.h>
#import <AppCenterReactNativeCrashes/AppCenterReactNativeCrashes.h>
#import <AppCenterReactNativeAnalytics/AppCenterReactNativeAnalytics.h>
#import <AppCenterReactNative/AppCenterReactNative.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[RNBranch initSessionWithLaunchOptions:launchOptions isReferrable:YES];
NSURL *jsCodeLocation;
[AppCenterReactNativeCrashes registerWithAutomaticProcessing]; // Initialize AppCenter crashes
[AppCenterReactNativeAnalytics registerWithInitiallyEnabled:true]; // Initialize AppCenter analytics
[AppCenterReactNative register]; // Initialize AppCenter
[GMSServices provideAPIKey:@"myAPiKey"];
[[FBSDKApplicationDelegate sharedInstance] application:application …Run Code Online (Sandbox Code Playgroud) After upgrading a react-native from 0.56 to 0.59.8 (using FBSDK 0.10.1), the facebook login don't work anymore on android.
when I fill the Fb login form and continue, LoginManager.logInWithPermissions promise does not resolve and never goes to .then() after logInWithPermissions()
here is my code:
loginWithFBSDKLoginManager() {
LoginManager.logOut();
const self = this;
return new Promise((resolve, reject) => {
LoginManager.logInWithPermissions(['public_profile', 'email']).then(function (result) {
if (result.isCancelled) {
return;
}
AccessToken.getCurrentAccessToken().then((data) => {
const accessToken = data.accessToken.toString();
const userID = data.userID.toString();
self
.getUserInfos(accessToken)
.then((response) …Run Code Online (Sandbox Code Playgroud)我建立一个简单的阵营原生应用程序,它实现“登录与Facebook的”使用反应本地-fbsdk
我可以登录和注销从按钮改变登录到注销时记录有凭据,但onLoginFinished回调永远不会被解雇,虽然onLogoutFinished工作正常。
这是我的代码:
import React, { Component } from 'react';
import { View,Alert,Button,Text } from 'react-native';
import { LoginButton, AccessToken } from 'react-native-fbsdk';
export default class Login extends Component {
constructor(props) {
super(props);
this.state = {
userInfo: null
}
}
onFacebookLoginFinished = (error, result) => {
if (error) {
Alert.alert("login has error: " + result.error);
} else if (result.isCancelled) {
Alert.alert("login is cancelled.");
} else {
AccessToken.getCurrentAccessToken().then(
(data) => {
Alert.alert(data.accessToken.toString()) …Run Code Online (Sandbox Code Playgroud) react-native ×10
android ×4
facebook ×2
javascript ×2
es6-promise ×1
fbsdk ×1
react-redux ×1
reactjs ×1