Skip to content

Instantly share code, notes, and snippets.

Alex Loukissas aloukissas

  • Los Angeles, CA
Block or report user

Report or block aloukissas

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 ShareDemo.js
include React from "react";
include { Platform, Share, Text, View } from "react-native";
class ShareDemo extends React.Component {
handleShare = async () => {
try {
const message = "Hey, check out this awesome new app!";
const url = "https://chck.app";
const isIos = Platform.OS === "ios";
let content = {};
View LinkingPhone.js
import React from "react";
import { Linking, Text, View } from "react-native";
class LinkingDemoModal extends React.Component {
handleOpenUrl = url => {
Linking.openURL(url);
}
render() {
return (
View LinkingDemoModal.js
import React from "react";
import { Text, View } from "react-native";
import { WebBrowser } from "expo";
class LinkingDemoModal extends React.Component {
handleOpenUrl = url => {
WebBrowser.openBrowserAsync(url);
}
render() {
View LinkingDemo.js
import React from "react";
import { Linking, Text, View } from "react-native";
class LinkingDemo extends React.Component {
handleOpenUrl = url => {
Linking.openURL(url);
}
render() {
return (
View App.js
loadAppResources = async () => {
SplashScreen.hide();
const fonts = [
require("./assets/fonts/Roboto.ttf"),
require("./assets/fonts/Roboto_bold.ttf"),
require("./assets/fonts/Roboto_medium.ttf")
];
const cachedFonts = fonts.map(font => {
View App.js
loadSplashResourcesAsync = async () => {
const splash = require("./assets/images/splash.png");
return Asset.loadAsync(splash);
};
View App.js
render() {
if (!this.state.isSplashReady) {
return (
<AppLoading
startAsync={this.loadSplashResources}
onFinish={() => this.setState({ isSplashReady: true })}
autoHideSplash={false}
/>
);
}
View register-listener.js
class App extends React.Component {
state = {
notification: ""
};
registerForPushNotificationsAsync = async () => {
// Same as earlier
}
handleNotification = notification => {
View send-notification.js
const EXPO_HOST = "https://exp.host/--/api/v2/push/send";
function sendNotification(token, title, body) {
return fetch(EXPO_HOST, {
body: JSON.stringify({
to: token,
title: title,
body: body
}),
headers: {
View push-token.js
import { Notifications, Permissions } from "expo";
const PUSH_ENDPOINT = "https://your-push-server/push-token"
async function registerForPushNotificationsAsync() {
// Request permissions -- same as earlier
[...]
// Get the token that uniquely identifies this device
const token = await Notifications.getExpoPushTokenAsync();
You can’t perform that action at this time.