facebookarchive / react-native-fbsdk

A React Native wrapper around the Facebook SDKs for Android and iOS. Provides access to Facebook login, sharing, graph requests, app events etc.
https://developers.facebook.com/docs/react-native
Other
2.99k stars 908 forks source link

LoginButton Change button height #697

Open crtl opened 4 years ago

crtl commented 4 years ago

It is possible to change the button height but the button will look like shit after it. Are there some plans to provide a customizable facebook button or is everyone building it by their own?

Expected Behavior

Button should be at least customizable in sizes.

Code Example

<LoginButton style={{width: "100%", height: 56}} />

screenshot

Environment

"react-native-fbsdk": "^1.1.1",
Manoj-coder commented 4 years ago

use this one for customizable facebook login button.

import { LoginManager } from 'react-native-fbsdk';

then after create one function for dynamically use in button

handleFacebookLogin () {
    LoginManager.logInWithPermissions(['public_profile', 'email', 'user_friends']).then(
      function (result) {
        if (result.isCancelled) {
          console.log('Login cancelled')
        } else {
          console.log('Login success with permissions: ' + result.grantedPermissions.toString())
        }
      },
      function (error) {
        console.log('Login fail with error: ' + error)
      }
    )
  }

call that arrow function in onPress of button.

<TouchableOpacity style={styles.btn} onPress={this.handleFacebookLogin}>
          <Text style={styles.TextStyle}>Login With Facebook </Text>     
          //As per change your button height using stylesheet
 </TouchableOpacity>
anastely commented 4 years ago

Hey, @Manoj-coder It's work for me and i got this in logs

Login success with permissions: public_profile, email

But how can I get this data "email, username, photo" to save it in the state then i want to send it to our API to save it?