Skip to content

Instantly share code, notes, and snippets.

krissanawat101 krissnawat

Block or report user

Report or block krissnawat

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View headerRight.js
headerRight: (
<TouchableOpacity
style={{ marginRight: 30 }}
onPress={() =>
Alert.alert("Logout alert", "Do you really want to Logout...", [
{
text: "NO",
onPress: () => console.warn("NO Pressed"),
style: "cancel"
},
View defaultNavigationOptions.js
defaultNavigationOptions: ({ navigation }) => ({
headerStyle: {
backgroundColor: colors.green01,
elevation: 0,
shadowOpacity: 0
},
headerLeft: (
<TouchableOpacity
style={{ marginLeft: 20 }}
onPress={() => navigation.openDrawer()}
View createAppContainer.js
export default createAppContainer(DrawerNavigator);
View DrawerNavigator.js
const DrawerNavigator = createDrawerNavigator({
AppNavigator: {
screen: AppNavigator,
navigationOptions: {
drawerLabel: "Home"
}
}
});
View createDrawerNavigator.js
import {
createStackNavigator,
createDrawerNavigator,
createAppContainer,
} from "react-navigation";
View initialRouteName.js
{
initialRouteName: "Home",
headerMode: "none"
}
View onAuthStateChanged.js
componentDidMount() {
firebase.auth().onAuthStateChanged(user => {
if (user) {
} else {
alert("Your have not logged in");
this.props.navigation.navigate("LoggedOut");
}
});
}
View facebook button.js
<RoundedButton
text="Connect to Facebook"
textColor={colors.green01}
backgroundColor={colors.white}
icon={
<Icon name="facebook" size={20} style={styles.facebookIcon} />
}
onPress={() => this.FacebookLogin()}
/>
View facebooklogin.js
async FacebookLogin() {
const result = await LoginManager.logInWithPermissions([
"public_profile",
"email"
]);
if (result.isCancelled) {
throw new Error("User cancelled the login process");
}
const data = await AccessToken.getCurrentAccessToken();
View appdelegate.m
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
BOOL handled = [[FBSDKApplicationDelegate sharedInstance] application:application openURL:url options:options]
];
// Add any custom logic here.
return handled;
}
You can’t perform that action at this time.