Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ScrollView,
Image,
SafeAreaView,
StatusBar
} from 'react-native';
import * as Expo from 'expo';
// Config
import { Analytics, ScreenHit } from 'expo-analytics';
import colours from '../config/colours';
// Components
import SocialButton from '../components/SocialButton';
import { getCurrentYear, socialLinks, manifest } from '../lib/constants';
import SK_LOGO from '../assets/images/lk-logo.png';
// Constants
const { ...meta } = Expo.Constants.manifest;
// GA tracking
const ID = Expo.Constants.manifest.extra.googleAnalytics;
const analytics = new Analytics(ID);
export default class AboutScreen extends React.Component {
componentDidMount() {
Expo.Amplitude.logEvent('SCREEN: About');
analytics.hit(new ScreenHit('SCREEN: About'));
}
render() {
return (
onPress = async () => {
const { score, screenshot: url } = this.props;
// const url = await AssetUtils.uriAsync(image);
const appName = Expo.Constants.manifest.name;
const title = `${appName}`;
const message = `OMG! I got ${score} points in @baconbrix ${appName}. ${storeUrl() ||
''}`;
Share.share(
{
message,
title,
url,
},
{
tintColor: Expo.Constants.manifest.tintColor,
excludedActivityTypes: [
'com.apple.UIKit.activity.Print',
'com.apple.UIKit.activity.AssignToContact',
'com.apple.UIKit.activity.AddToReadingList',
'com.apple.UIKit.activity.AirDrop',
View,
ScrollView,
ImageBackground
} from 'react-native';
import * as Expo from 'expo';
import PropTypes from 'prop-types';
import format from 'format-duration';
import Placeholder from 'rn-placeholder';
import { Analytics, ScreenHit } from 'expo-analytics';
// Config
import colours from '../config/colours';
// Components
import Credits from '../components/Credits';
// GA tracking
const ID = Expo.Constants.manifest.extra.googleAnalytics;
const analytics = new Analytics(ID);
export default class DetailsScreen extends React.Component {
static get propTypes() {
return {
navigation: PropTypes.object.isRequired
};
}
constructor(props) {
super(props);
this.state = { lyrics: null, /* err: null, */ isReady: null };
}
async componentDidMount() {
const {
logInWithSavedData = async () => {
const deviceId = Expo.Constants.deviceId
const userId = await AsyncStorage.getItem('userId')
const accessToken = await AsyncStorage.getItem('accessToken')
const accessTokenFb = await AsyncStorage.getItem('accessTokenFb')
if (userId && accessToken) {
console.log('loguje z TOKEN', accessToken, userId)
this.props.logInWithToken({ accessToken, userId, deviceId }).then(async () => {
const newAccessToken = this.props.currentUser.CurrentUser.currentAccessToken
await AsyncStorage.setItem('accessToken', newAccessToken)
}).catch(async () => {
await AsyncStorage.removeItem('accessToken')
await AsyncStorage.removeItem('userId')
Alert.alert('You were logged out', 'Please log in again')
})
}
shadowRadius: 2,
height: 54,
width: "100%",
flexDirection: "row",
justifyContent: "flex-start",
alignItems: "center",
padding: 5
},
modal: {
justifyContent: "flex-start",
alignItems: "center",
position: "absolute",
zIndex: 4,
elevation: 4,
height: Dimensions.get("window").height - Expo.Constants.statusBarHeight,
marginTop: Expo.Constants.statusBarHeight / 2
}
});
@connect(store => {
return {
tweets: store.tweets.tweets,
fetchingTweets: store.tweets.fetchingTweets,
fetchedTweets: store.tweets.fetchedTweets,
errorTweets: store.tweets.error,
user: store.login.user,
tweetPosted: store.tweets.tweetPosted,
newTweetModalOpen: store.tweets.newTweetModalOpen
};
})
export default class HomeScreen extends Component {
constructor(props) {
_renderNUXRow() {
let tooltipMessage;
if (Expo.Constants.isDevice) {
tooltipMessage = 'Shake your device to show this menu.';
} else {
tooltipMessage = 'In iPhone Simulator, press \u2318D to show this menu.';
}
let headingStyles = MENU_NARROW_SCREEN
? [styles.nuxHeading, styles.nuxHeadingNarrow]
: styles.nuxHeading;
return (
shadowOpacity: 0.3,
shadowRadius: 2,
height: 54,
width: "100%",
flexDirection: "row",
justifyContent: "flex-start",
alignItems: "center",
padding: 5
},
modal: {
justifyContent: "flex-start",
alignItems: "center",
position: "absolute",
zIndex: 4,
elevation: 4,
height: Dimensions.get("window").height - Expo.Constants.statusBarHeight,
marginTop: Expo.Constants.statusBarHeight / 2
}
});
@connect(store => {
return {
tweets: store.tweets.tweets,
fetchingTweets: store.tweets.fetchingTweets,
fetchedTweets: store.tweets.fetchedTweets,
errorTweets: store.tweets.error,
user: store.login.user,
tweetPosted: store.tweets.tweetPosted,
newTweetModalOpen: store.tweets.newTweetModalOpen
};
})
export default class HomeScreen extends Component {
scrollEventThrottle={16}
onScroll={Animated.event(
[
{
nativeEvent: { contentOffset: { y: this.state.scrollY } }
}
],
{
useNativeDriver: true
}
)}
>
submit = async () => {
const deviceId = Expo.Constants.deviceId || 'defaultMobileClient'
this.setState({ error: '', loading: true })
const actionName = this.state.isLogin ? 'login' : 'signup'
if (this.props.currentUser.CurrentUser) {
const userId = this.props.currentUser.CurrentUser._id
const token = this.props.currentUser.CurrentUser.currentAccessToken
await this.props.clearToken({ userId, token })
}
this.props[actionName]({ username: this.state.username, password: this.state.password, deviceId, saveToken: true })
.then(async () => {
this.props.dispatch(courseActions.close())
const accessToken = this.props.currentUser.CurrentUser.currentAccessToken
const userId = this.props.currentUser.CurrentUser._id
await AsyncStorage.setItem('accessToken', accessToken)
await AsyncStorage.setItem('userId', userId)
outputRange: [1, 0, 0]
});
var headerOp = this.state.scrollY.interpolate({
inputRange: [95, 180, 181],
outputRange: [0, 0.75, 0.75]
});
var headerContentOp = this.state.scrollY.interpolate({
inputRange: [0, 180, 210],
outputRange: [0, 0, 1]
});
return (