nubescope / react-native-facebook-account-kit Goto Github PK
View Code? Open in Web Editor NEWFacebook Account Kit SDK wrapper for React Native
Facebook Account Kit SDK wrapper for React Native
App is getting crashed randomly on this error.
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.fetchsky.peekaboo/com.facebook.accountkit.ui.AccountKitActivity}: 500: Initialization error: 501: The SDK has not been initialized, make sure to call AccountKit.initialize() first
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2697)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2771)
at android.app.ActivityThread.access$900(ActivityThread.java:177)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1432)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5912)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1405)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1200)
Caused by: 500: Initialization error: 501: The SDK has not been initialized, make sure to call AccountKit.initialize() first
at com.facebook.accountkit.internal.Validate.sdkInitialized(Validate.java:82)
at com.facebook.accountkit.internal.Initializer.getApplicationName(Initializer.java:191)
at com.facebook.accountkit.internal.AccountKitController.getApplicationName(AccountKitController.java:584)
at com.facebook.accountkit.AccountKit.getApplicationName(AccountKit.java:289)
at com.facebook.accountkit.ui.AccountKitActivity.onCreate(AccountKitActivity.java:184)
at android.app.Activity.performCreate(Activity.java:6185)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2650)
... 10 more
Automatic way to change the language when the application STATE changes?
If not blacklisted, US
will be the default country even when defaultCountry
option is set to another country
In the README.md
is missing any reference to Native SDK initialisations.
For everyone interested in Android, you need to add the app id and app name to the AndroidManifest.xml
Follow these instructions: https://developers.facebook.com/docs/accountkit/android#initsdk
I am not sure for iOS
After pressing on Switch and move finger outside component area before releasing it the component stops working.
When I remove package react-native-facebook-account-kit and use basic react-native then Switch works all the time good.
This happens on example witch patch:
diff --git a/sample/app.js b/sample/app.js
index 49b6230..b9ba0b9 100644
--- a/sample/app.js
+++ b/sample/app.js
@@ -19,7 +19,8 @@ import AccountKit, {
class AccountKitSample extends Component {
state = {
authToken: null,
- loggedAccount: null
+ loggedAccount: null,
+ val: false
}
componentWillMount() {
@@ -130,7 +131,7 @@ class AccountKitSample extends Component {
onLogin={(token) => this.onLogin(token)} onError={(e) => this.onLogin(e)}>
<Text style={styles.buttonText}>SMS</Text>
</LoginButton>
-
+ <Switch onValueChange={(value) => this.setState({val: value})} value={this.state.val} />
<TouchableOpacity style={styles.button} onPress={() => this.onEmailLoginPressed()}>
<Text style={styles.buttonText}>Email</Text>
</TouchableOpacity>
workaround:
use in Switch function:
onResponderRelease={()=> this.setState({val: !this.state.val })}
During first login loginWithPhone() works fine, but if I logout and call loginWithPhone() again, I'm receiving red screen complaining about login callback being already registered.
AccountKit.loginWithPhone()
.then((code) => {
if (!code) {
self.endLoading();
return;
} else {
.......
}
}).catch(() =>{
self.endLoading();
});
Code in catch() is running on android but on iOS its not executing can you please check!
App is crashing after certain time in production! Google Pre-Launch report also showing crash.
Cannot reproduce it everytime
Crash
FATAL EXCEPTION: main
Process: com.fetchsky.peekaboo, PID: 9569
java.lang.NullPointerException
at com.facebook.accountkit.internal.AppEventsLogger.handleResponse(AppEventsLogger.java:526)
at com.facebook.accountkit.internal.AppEventsLogger.access$600(AppEventsLogger.java:57)
at com.facebook.accountkit.internal.AppEventsLogger$4.onCompleted(AppEventsLogger.java:510)
at com.facebook.accountkit.internal.AccountKitGraphRequestAsyncTask.onPostExecute(AccountKitGraphRequestAsyncTask.java:188)
at com.facebook.accountkit.internal.AccountKitGraphRequestAsyncTask.onPostExecute(AccountKitGraphRequestAsyncTask.java:42)
at android.os.AsyncTask.finish(AsyncTask.java:632)
at android.os.AsyncTask.access$600(AsyncTask.java:177)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
FATAL EXCEPTION: main
Process: com.fetchsky.peekaboo, PID: 25137
java.lang.NullPointerException: Attempt to invoke virtual method 'com.facebook.accountkit.internal.AccountKitRequestError com.facebook.accountkit.internal.AccountKitGraphResponse.getError()' on a null object reference
at com.facebook.accountkit.internal.AppEventsLogger.handleResponse(AppEventsLogger.java:526)
at com.facebook.accountkit.internal.AppEventsLogger.access$600(AppEventsLogger.java:57)
at com.facebook.accountkit.internal.AppEventsLogger$4.onCompleted(AppEventsLogger.java:510)
at com.facebook.accountkit.internal.AccountKitGraphRequestAsyncTask.onPostExecute(AccountKitGraphRequestAsyncTask.java:188)
at com.facebook.accountkit.internal.AccountKitGraphRequestAsyncTask.onPostExecute(AccountKitGraphRequestAsyncTask.java:42)
at android.os.AsyncTask.finish(AsyncTask.java:636)
at android.os.AsyncTask.access$500(AsyncTask.java:177)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:653)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6837)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
Need early response as my app is production!
Couldn't find headers of React Native modules for #ios. Any idea how to fix?
I am new to rnpm but I think contrary to what suggested in the README.md
you need
rnpm install react-native-facebook-account-kit
rnpm link react-native-facebook-account-kit
Let me know if that makes sense?
Trying to get the logged-in account info with AccountKit.getCurrentAccount()
fails with the error: Could not get account data
, even though I can retrieve the current token with AccountKit.getCurrentAccessToken()
. Please any ideas? I am doing ...
AccountKit.getCurrentAccount()
.then((account) => {
...
})
})
On iOS.
Thanks
This is caused by a bug on Account Kit SDK reported here.
A solution is fix and downgrade the Account Kit SDK version to 4.12.0
Poorly formatted country code (e.g. lowercased) crashed the app.
Given countryWhitelist: ['us', 'sk']
, app crashes (feel free to use any country code)
App should not crash.
defaultCountry: 'sk',
works as expected. Lowercased country code is not problem here.Error: File path too long on Windows, keep below 240 characters
{project_path}\node_modules\react-native-facebook-account-kit\android\build\intermediates\exploded-aar\com.android.support\appcompat-v7\24.2.1\res\drawable-mdpi-v4\abc_btn_radio_to_on_mtrl_000.png: Error: File path too long on Windows, keep below 240 characters
Android build time error
Works great on iOS, but after following Android setup guide the gradle build fails. I'm getting this error:
Error:(33, 8) error: RNAccountKitModule is not abstract and does not override abstract method onActivityResult(int,int,Intent) in ActivityEventListener
Probably a React native v0.33 specific bug
I have been happily using this library for two months now and does a great job. I have been using the client token flow where no backend is necessary.
As my app is getting more ready I would like to build a more secure authentication flow that involves exchanging client code for a server retrieved access_token. The official facebook doc pages:
https://developers.facebook.com/docs/accountkit/graphapi#at-validation
suggests to include the access_token in the header of each request so the backend can validate them using the graph API.
My question is whether this validation will add a bit of latency to each client requests. The alternative I was pondering is to generate a separate JTW token after the server authenticates the user so the backend can validate all subsequent calls simply checking the signature of the JWT and I would need to validate the user against facebook servers just the first time after login.
What would the community suggest?
How are you using this library?
Thanks
:react-native-facebook-account-kit:preBuild UP-TO-DATE
:react-native-facebook-account-kit:preReleaseBuild UP-TO-DATE
:react-native-facebook-account-kit:compileReleaseNdk UP-TO-DATE
:react-native-facebook-account-kit:compileLint
:react-native-facebook-account-kit:copyReleaseLint UP-TO-DATE
:react-native-facebook-account-kit:checkReleaseManifest
:react-native-facebook-account-kit:preDebugAndroidTestBuild UP-TO-DATE
:react-native-facebook-account-kit:preDebugBuild UP-TO-DATE
:react-native-facebook-account-kit:preDebugUnitTestBuild UP-TO-DATE
:react-native-facebook-account-kit:preReleaseUnitTestBuild UP-TO-DATE
:react-native-facebook-account-kit:prepareComAndroidSupportAnimatedVectorDrawable2321Library
> Building 30% > :react-native-facebook-account-kit:prepareComAndroidSupportApp:react-native-facebook-account-kit:prepareComAndroidSupportAppcompatV72321Library
> Building 30%> Building 30% > :react-native-facebook-account-kit:prepareComAndroidSupportDes:react-native-facebook-account-kit:prepareComAndroidSupportDesign2321Library
:react-native-facebook-account-kit:prepareComAndroidSupportRecyclerviewV72321Library
> Building 30% > :react-native-facebook-account-kit:prepareComAndroidSupportSup:react-native-facebook-account-kit:prepareComAndroidSupportSupportV42321Library
:react-native-facebook-account-kit:prepareComAndroidSupportSupportVectorDrawable2321Library
> Building 30% > :react-native-facebook-account-kit:prepareComFacebookAndroidAc:react-native-facebook-account-kit:prepareComFacebookAndroidAccountKitSdk4150Library
:react-native-facebook-account-kit:prepareComFacebookFrescoDrawee0110Library
:react-native-facebook-account-kit:prepareComFacebookFrescoFbcore0110Library
:react-native-facebook-account-kit:prepareComFacebookFrescoFresco0110Library
> Building 31% > :react-native-facebook-account-kit:prepareComFacebookFrescoIma:react-native-facebook-account-kit:prepareComFacebookFrescoImagepipeline0110Library
> Building 31%:react-native-facebook-account-kit:prepareComFacebookFrescoImagepipelineBase0110Library
:react-native-facebook-account-kit:prepareComFacebookFrescoImagepipelineOkhttp30110Library
> Building 31% > :react-native-facebook-account-kit:prepareComFacebookReactReac:react-native-facebook-account-kit:prepareComFacebookReactReactNative0321Library
:react-native-facebook-account-kit:prepareComFacebookSoloaderSoloader010Library
> Building 31% > :react-native-facebook-account-kit:prepareOrgWebkitAndroidJscR:react-native-facebook-account-kit:prepareOrgWebkitAndroidJscR174650Library
:react-native-facebook-account-kit:prepareReleaseDependencies
:react-native-facebook-account-kit:compileReleaseAidl
:react-native-facebook-account-kit:compileReleaseRenderscript
:react-native-facebook-account-kit:generateReleaseBuildConfig
:react-native-facebook-account-kit:mergeReleaseShaders
:react-native-facebook-account-kit:compileReleaseShaders
:react-native-facebook-account-kit:generateReleaseAssets
:react-native-facebook-account-kit:mergeReleaseAssets
:react-native-facebook-account-kit:generateReleaseResValues
:react-native-facebook-account-kit:generateReleaseResources
> Building 32% > :react-native-facebook-account-kit:mergeReleaseResources:react-native-facebook-account-kit:mergeReleaseResources
> Building 32%:react-native-facebook-account-kit:processReleaseManifest
> Building 33% > :react-native-facebook-account-kit:processReleaseResources:react-native-facebook-account-kit:processReleaseResources
> Building 33%:react-native-facebook-account-kit:generateReleaseSources
:react-native-facebook-account-kit:incrementalReleaseJavaCompilationSafeguard
:react-native-facebook-account-kit:compileReleaseJavaWithJavac
:react-native-facebook-account-kit:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
> Building 33% > :react-native-facebook-account-kit:compileReleaseJavaWithJavac/home/ubuntu/bosspayments/mobile/node_modules/react-native-facebook-account-kit/android/src/main/java/io/underscope/react/fbak/RNAccountKitModule.java:33: error: RNAccountKitModule is not abstract and does not override abstract method onActivityResult(int,int,Intent) in ActivityEventListener
> Building 33% > :react-native-facebook-account-kit:compileReleaseJavaWithJavacpublic class RNAccountKitModule extends ReactContextBaseJavaModule implements ActivityEventListener {
^
/home/ubuntu/bosspayments/mobile/node_modules/react-native-facebook-account-kit/android/src/main/java/io/underscope/react/fbak/RNAccountKitModule.java:62: error: method does not override or implement a method from a supertype
@Override
^
2 errors
:react-native-facebook-account-kit:compileReleaseJavaWithJavac FAILED
> Building 33%
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-facebook-account-kit:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 1 mins 41.395 secs
cd "mobile/android"
export REACT_NATIVE="$(which react-native)"
./gradlew --no-daemon assembleRelease -PdisablePreDex
returned exit code 1
Action failed: ./gradlew --no-daemon assembleRelease -PdisablePreDex
Is there a way to override the status bar style?
Hello, i'm try to run the example and not work :(
i try RN033 and RN040 following this steps
git clone https://github.com/underscopeio/react-native-facebook-account-kit
cd react-native-facebook-account-kit/examples/RN040
npm install
react-native run-ios
and both returned the same error:
run app
@gaguirre is this logic correct?
https://github.com/underscopeio/react-native-facebook-account-kit/blob/master/android/src/main/java/io/underscope/react/fbak/RNAccountKitModule.java#L213-L219
I am not able to prefill the user phone number even though I follow the instructions:
If people grant the READ_PHONE_STATE permission, the SDK can automatically fill in the device’s phone number. People still need to manually submit their phone number to continue the login process
Add the following permission to AndroidManifest.xml to allow the SDK to auto-fill the device's phone number:
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
RNAccountKit.configure({
responseType: 'token',
titleType: 'login',
initialAuthState: '',
facebookNotificationsEnabled: true,
readPhoneStateEnabled: true,
receiveSMS: true,
defaultCountry: 'GB'
})
I'm receiving the following warning
{
name: "TimeoutError",
message: "Event response for 'login' timed out"
}
Testing on Android I got an error red screen saying something like "impossible to find ... defaultCountry" in RNAccountKitModule.jave:240"
Should it be added here?
https://github.com/underscopeio/react-native-facebook-account-kit/blob/master/index.js#L16-L24
Or is it a necessary user specific configuration after 0.1.0
? Because before that was not the case, since my code was using the module without the need to any custom configuration.
Thanks for the clarification
Sanket$ react-native run-android
JS server already running.
Running /Users/socomo/Library/Android/sdk/platform-tools/adb -s emulator-5554 reverse tcp:8081 tcp:8081
Building and installing the app on the device (cd android && ./gradlew installDebug...
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72301Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42321Library UP-TO-DATE
:app:prepareComFacebookFrescoDrawee0110Library UP-TO-DATE
:app:prepareComFacebookFrescoFbcore0110Library UP-TO-DATE
:app:prepareComFacebookFrescoFresco0110Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipeline0110Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipelineBase0110Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipelineOkhttp30110Library UP-TO-DATE
:app:prepareComFacebookReactReactNative0341Library UP-TO-DATE
:app:prepareComFacebookSoloaderSoloader010Library UP-TO-DATE
:app:prepareOrgWebkitAndroidJscR174650Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources
:app:bundleDebugJsAndAssets SKIPPED
:app:processDebugManifest
Warning: /Users/socomo/learn/reactNative/TestProject/android/app/src/main/AndroidManifest.xml:33:7-36:51 Warning:
activity#com.facebook.accountkit.ui.AccountKitActivity@android:theme was tagged at AndroidManifest.xml:33 to replace other declarations but no other declaration present
/Users/socomo/learn/reactNative/TestProject/android/app/src/main/AndroidManifest.xml:33:7-36:51 Warning:
activity#com.facebook.accountkit.ui.AccountKitActivity@android:theme was tagged at AndroidManifest.xml:33 to replace other declarations but no other declaration present
:app:processDebugResources
/Users/socomo/learn/reactNative/TestProject/android/app/src/main/res/values/styles.xml:2 : Error retrieving parent for item: No resource found that matches the given name 'Theme.AccountKit'.
/Users/socomo/learn/reactNative/TestProject/android/app/src/main/res/values/styles.xml:14:21-54 : No resource found that matches the given name: attr 'com_accountkit_input_accent_color'.
/Users/socomo/learn/reactNative/TestProject/android/app/src/main/res/values/styles.xml:15:21-54 : No resource found that matches the given name: attr 'com_accountkit_input_border_color'.
/Users/socomo/learn/reactNative/TestProject/android/app/src/main/res/values/styles.xml:9:21-49 : No resource found that matches the given name: attr 'com_accountkit_primary_color'.
/Users/socomo/learn/reactNative/TestProject/android/app/src/main/res/values/styles.xml:10:21-54 : No resource found that matches the given name: attr 'com_accountkit_primary_text_color'.
/Users/socomo/learn/reactNative/TestProject/android/app/src/main/res/values/styles.xml:11:21-56 : No resource found that matches the given name: attr 'com_accountkit_secondary_text_color'.
/Users/socomo/learn/reactNative/TestProject/android/app/src/main/res/values/styles.xml:12:21-52 : No resource found that matches the given name: attr 'com_accountkit_status_bar_color'.
:app:processDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/socomo/Library/Android/sdk/build-tools/23.0.1/aapt'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 22.215 secs
React Native Version i am using = 0.34.1
Hello . I received this logcat from user , when try to open Account kit via intent .
java.lang.NullPointerException
1 at com.facebook.accountkit.internal.AppEventsLogger.handleResponse(AppEventsLogger.java:526)
2 at com.facebook.accountkit.internal.AppEventsLogger.access$600(AppEventsLogger.java:57)
3 at com.facebook.accountkit.internal.AppEventsLogger$4.onCompleted(AppEventsLogger.java:510)
4 at com.facebook.accountkit.internal.AccountKitGraphRequestAsyncTask.onPostExecute(AccountKitGraphRequestAsyncTask.java:188)
5 at com.facebook.accountkit.internal.AccountKitGraphRequestAsyncTask.onPostExecute(AccountKitGraphRequestAsyncTask.java:42)
6 at android.os.AsyncTask.finish(AsyncTask.java:631)
7 at android.os.AsyncTask.access$600(AsyncTask.java:177)
8 at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
9 at android.os.Handler.dispatchMessage(Handler.java:99)
10 at android.os.Looper.loop(Looper.java:137)
11 at android.app.ActivityThread.main(ActivityThread.java:5041)
12 at java.lang.reflect.Method.invokeNative(Native Method)
13 at java.lang.reflect.Method.invoke(Method.java:511)
14 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
15 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
16 at dalvik.system.NativeStart.main(Native Method)
React Native Account Kit version: 4+
Platform(s) (iOS, Android, or both?): Android
Need some feedback from you,please!
Thank alot!
The 'Resend code' link is always white on Android. Is there a way to change this?
The order of config options seems to be wrong.
const configOptions = {
...options,
...RNAccountKit.configDefaults
}
should be
const configOptions = {
...RNAccountKit.configDefaults,
...options
}
I am not able to use backgroundImage in theme. Please tell me what path to give or where should I put my account_kit_back.jpg.
RNAccountKit.configure({
titleType: 'title',
theme: {
// Background
// backgroundColor: Color.hex(Colors.SILVER_GREY),
backgroundImage: 'account_kit_back.jpg',
// Button
buttonBackgroundColor: Color.hex(Colors.WHITE),
buttonBorderColor: Color.hex(Colors.WHITE),
buttonTextColor: Color.hex(Colors.PRIMARY_GREY),
// Button disabled
buttonDisabledBackgroundColor: Color.rgba(255, 255, 255, 0.5),
// Header
headerBackgroundColor: Color.hex(Colors.ECHO_GREEN),
headerButtonTextColor: Color.hex(Colors.PRIMARY_GREY),
headerTextColor:Color.hex( Colors.PRIMARY_GREY),
// Input
inputBackgroundColor: Color.rgba(255, 255, 255, 0.5),
inputBorderColor: Color.hex(Colors.WHITE),
inputTextColor: Color.hex(Colors.PRIMARY_GREY),
// Others
iconColor: Color.hex(Colors.ECHO_GREEN),
textColor: Color.hex(Colors.PRIMARY_GREY),
titleColor: Color.hex(Colors.PRIMARY_GREY),
// Header
statusBarStyle: StatusBarStyle.LightContent, // or StatusBarStyle.Default
}
})
Image should come as background.
react-native init AccountKitSample
rnpm install react-native-facebook-account-kit
index.android.js
with the following code. Actually I take it from sample app:import React, { Component } from 'react'
import {
AppRegistry,
StyleSheet,
Text,
View
} from 'react-native'
import AccountKit, {
LoginButton,
Color,
StatusBarStyle,
} from 'react-native-facebook-account-kit'
AccountKit.configure({})
class AccountKitSample extends Component {
state = {
authToken: null,
loggedAccount: null
}
componentWillMount() {
AccountKit.getCurrentAccessToken()
.then((token) => {
if (token) {
AccountKit.getCurrentAccount()
.then((account) => {
this.setState({
authToken: token,
loggedAccount: account
})
})
} else {
console.log('No user account logged')
}
})
.catch((e) => console.log('Failed to get current access token', e))
}
onLogin(token) {
if (!token) {
console.warn('User canceled login')
this.setState({})
} else {
AccountKit.getCurrentAccount()
.then((account) => {
this.setState({
authToken: token,
loggedAccount: account
})
})
}
}
onLoginError(e) {
console.log('Failed to login', e)
}
onEmailLoginPressed() {
AccountKit.loginWithEmail()
.then((token) => { this.onLogin(token) })
.catch((e) => this.onLoginError(e))
}
onLogoutPressed() {
AccountKit.logout()
.then(() => {
this.setState({
authToken: null,
loggedAccount: null
})
})
.catch((e) => console.log('Failed to logout'))
}
renderUserLogged() {
const { id, email, phoneNumber } = this.state.loggedAccount;
return (
<View>
<TouchableOpacity style={styles.button} onPress={() => this.onLogoutPressed()}>
<Text style={styles.buttonText}>Logout</Text>
</TouchableOpacity>
<Text style={styles.label}>Account Kit Id</Text>
<Text style={styles.text}>{id}</Text>
<Text style={styles.label}>Email</Text>
<Text style={styles.text}>{email}</Text>
<Text style={styles.label}>Phone Number</Text>
<Text style={styles.text}>{phoneNumber ? `${phoneNumber.countryCode} ${phoneNumber.number}` : ''}</Text>
</View>
)
}
renderLogin() {
return (
<View>
<LoginButton style={styles.button} type="phone"
onLogin={(token) => this.onLogin(token)} onError={(e) => this.onLogin(e)}>
<Text style={styles.buttonText}>SMS</Text>
</LoginButton>
<TouchableOpacity style={styles.button} onPress={() => this.onEmailLoginPressed()}>
<Text style={styles.buttonText}>Email</Text>
</TouchableOpacity>
</View>
)
}
render() {
return (
<View style={styles.container}>
{ this.state.loggedAccount ? this.renderUserLogged() : this.renderLogin() }
</View>
)
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
button: {
height: 50,
width: 300,
backgroundColor: 'aqua',
marginBottom: 10
},
buttonText: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
label: {
fontSize: 20,
textAlign: 'center',
fontWeight: 'bold',
marginTop: 20
},
text: {
fontSize: 20,
textAlign: 'center',
margin: 10,
}
})
AppRegistry.registerComponent('test', () => AccountKitSample);
Error messages:
undefined is not an object (evaluating 'RNAccountKitNative.configure')
configure
index.js:40
RNAccountKit
index.js:27
<unknown>
index.js:64
loadModuleImplementation
require.js:122
guardedLoadModule
require.js:65
_require
require.js:49
<unknown>
index.android.js:10
loadModuleImplementation
require.js:122
guardedLoadModule
require.js:58
_require
require.js:49
global code
require-0.js:1
when I running react-native link react-native-facebook-account-kit more than 1 time,, the result is
then in file MainApplication.Java the result
import io.underscope.react.fbak.RNAccountKitPackage;
import io.underscope.react.fbak.RNAccountKitPackage;
import io.underscope.react.fbak.RNAccountKitPackage;
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new RNAccountKitPackage(),
new RNAccountKitPackage(),
new RNAccountKitPackage(),
new ImagePickerPackage(),
new VectorIconsPackage()
);
}
Then in the file setting.gradle and build.gradle, both of the file don't change....
so.. while i run react-native run-android... i have error
can you help me.....
It seems that RNAccountKit.loginWithPhone()
for responseType: 'code'
configuration does return string on iOS (being the code returned), but { state: '', code: "..." }
kind of object on Android. It would be great if react-native-facebook-account-kit would provide consistent API across platforms.
From version 0.4.1 I'm getting the following error when running react-native run-android
. I'm going to fix this in a new branch and submit a PR right away.
Unknown source file : UNEXPECTED TOP-LEVEL EXCEPTION:
Unknown source file : com.android.dex.DexException: Multiple dex files define Lbolts/AggregateException;
Unknown source file : at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
Unknown source file : at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
Unknown source file : at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
Unknown source file : at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
Unknown source file : at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
Unknown source file : at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502)
Unknown source file : at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
Unknown source file : at com.android.dx.command.dexer.Main.run(Main.java:277)
Unknown source file : at com.android.dx.command.dexer.Main.main(Main.java:245)
Unknown source file : at com.android.dx.command.Main.main(Main.java:106)
:app:dexDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2
The buttonDisabledBackgroundColor
parameter in theme does not seem to be updating the actual color. Is this the correct parameter?
I see that in the RNAccountKit.m file it doesn't seem to be applied
NSArray *colorOptions = @[@"backgroundColor",@"buttonBackgroundColor",@"buttonBorderColor",
@"buttonTextColor",@"headerBackgroundColor",@"headerTextColor",
@"iconColor",@"inputBackgroundColor",@"inputBorderColor",
@"inputTextColor",@"textColor",@"titleColor"];
It looks like Facebook added new skin styles: classic, translucent, contemporary.
Because this library uses compile ('com.facebook.android:account-kit-sdk:4.+')
my app adopted the new skin style as soon as I recompiled.
It would be great to add the possibility to pick either skin from the configuration.
How do you customize the colors for Android?
Error:(32, 8) error: RNAccountKitModule is not abstract and does not override abstract method onActivityResult(Activity,int,int,Intent) in ActivityEventListener
Simple gradle sync fails in android studio because of this error.
It seems that whitelist/blacklist support doesnt really work. When I add some whitelist, still all countries are displayed. The source code doesnt seem to set whitelistedCountryCodes
anywhere, either.
When we do loginWithPhone(), the views it shows are being placed UNDER our AppView and navigation views.
How to show them above?
I'm getting "Cannot read property 'login' of undefined", further down investigating the problem, I see that it's not being registered as a Native Module.
When I check if the native module is linked I get a undefined:
const RNAccountKitNative = NativeModules.RNAccountKit // evaluates undefined
console.log(NativeModules) // nothing related to it
To run the account kit popup.
AccountKit.getCurrentAccount() doesn't return user details once the app has been closed.
hi, i'm trying like a tutorial but i got error like this
Possible Unhandled Promise Rejection (id: 0):
Server generated an error
Error: Server generated an error
at createErrorFromErrorData (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:7452:11)
at http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:7403:11
at MessageQueue.__invokeCallback (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:7266:10)
at http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:7138:8
at guard (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:7076:1)
at MessageQueue.invokeCallbackAndReturnFlushedQueue (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:7137:1)
at DedicatedWorkerGlobalScope.onmessage (http://localhost:8081/debuggerWorker.js:39:56)
my code
componentWillMount() {
AccountKit.configure({
defaultCountry : 'ID'
});
AccountKit.getCurrentAccessToken().then(
(token) => {
if (!token) {
AppRegistry.runApplication('login', {
initialProps : {},
rootTag : 1
});
}
else {
AccountKit.getCurrentAccount().then(
(account) => {
console.log("Current Account ", account);
}).catch(function(error) {
console.log('There has been a problem with your fetch operation: ' + error.message);
// ADD THIS THROW error
throw error;
});
}
}).catch((error) => {
console.log(error.message);
throw error;
});
}
is there anything I missed in the code section?
please help me :(
error: cannot find symbol
import io.underscope.react.RNAccountKit;
symbol: class RNAccountKit
location: package io.underscope.react
error: cannot find symbol
new RNAccountKit(),
^
symbol: class RNAccountKit
location: class MainActivity
I followed the manual installation for Android
This module works great in our devices and simulators.
But it fails our mocha tests with the following error:
return RNAccountKitNative.configure(configOptions);
TypeError: Cannot read property 'configure' of undefined
at RNAccountKit.configure (/Users/giro/stardust-app/node_modules/react-native-facebook-account-kit/index.js:41:12)
This seems to be happening when Babel tries to import this module, since it's not already transpiled like most modules, from what I can tell.
According to http://stackoverflow.com/questions/35040978/babel-unexpected-token-import-when-running-mocha-tests, all distributed modules should be transpiled already-- is this something we can do for this module?
Is there anything, in particular, we need to do in order to have AK able to be capable of language support? When changing the country, I would have assumed the rest of the interface and texts will be adjusted to the language for that country.
Whenever AccountKit.logout() is called, the code inside the success promise doesn't get executed.
Tried it my own app as well as the sample app in this repo.
Update to the latest SDK versions for Account Kit.
Implement onNewIntent method
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.