Skip to content

Instantly share code, notes, and snippets.

import type { ConfigPlugin } from '@expo/config-plugins';
import { withXcodeProject } from '@expo/config-plugins';
/*
https://github.com/CocoaPods/CocoaPods/issues/12022
https://developer.apple.com/forums/thread/733461
in xCode 15, the signature files seems to be generated twice, which causes the build to fail.
*/
const withMyCustomBuildPhase: ConfigPlugin = (config) => {
@Gguigre
Gguigre / ForecastItem.component.js
Created January 16, 2019 21:08
Sunshine complete ForecastItem component
type PropsType = {
forecast: ForecastType,
index: number
};
export class ForecastItem extends Component<PropsType, StateType> {
render() {
const { forecast, index } = this.props;
const image = getImageFromWeatherType(forecast.weatherType);
return (
@Gguigre
Gguigre / TransitionView.component.js
Created January 16, 2019 21:03
Complete TransitionView component
type PropsType = { index?: number };
export class TransitionView extends PureComponent<PropsType> {
render() {
const { index, ...rest } = this.props;
return (
<Animatable.View
animation="fadeIn"
duration={theme.transitionDuration}
delay={index ? (index * theme.transitionDuration) / 5 : 0}
@Gguigre
Gguigre / ForecastItem.component.js
Created January 16, 2019 20:56
Sunshine simple ForecastItem component
export class ForecastItem extends Component<PropsType, StateType> {
render() {
const { forecast } = this.props;
const image = getImageFromWeatherType(forecast.weatherType);
return (
<TransitionView style={styles.container}>
// ...
</TransitionView>
);
}
@Gguigre
Gguigre / Overview.component.js
Created January 16, 2019 20:54
Sunshine complete Overview component
render() {
//...
return (
<TransitionView style={styles.container} animation="slideInDown">
{!!maxTemperature && !!minTemperature && !!weatherType && !!image && (
//...
}
</TransitionView>
);
}
@Gguigre
Gguigre / Overview.component.js
Created January 16, 2019 20:53
Sunshine simple Overview component
render() {
const { maxTemperature, minTemperature, weatherType } = this.props;
const today = new Date();
const image = getImageFromWeatherType(weatherType);
return (
<View style={styles.container}>
{!!maxTemperature && !!minTemperature && !!weatherType && !!image && (
<TransitionView style={styles.content}>
<View>
@Gguigre
Gguigre / Overview.component.js
Created January 16, 2019 20:52
Sunshine basic Overview component
render() {
return (
<View style={styles.container}>
<View style={styles.content}>
<View>
<Text style={[theme.typo.mediumText, styles.whiteText]}>
{today.toDateString()}
</Text>
<Text style={[theme.typo.veryBigText, styles.whiteText]}>
{maxTemperature ? `${maxTemperature}°` : ""}
@Gguigre
Gguigre / TransitionView.component.js
Created January 16, 2019 20:51
Basic TransitionView component
//...
render() {
const { ...rest } = this.props;
return (
<Animatable.View
animation="fadeIn"
duration={theme.transitionDuration}
useNativeDriver
{...rest}
/>