import React from "react"; import { StyleSheet, View, ViewProps } from "react-native"; import { Raw } from "./animations/Raw"; import { SIZES } from "./tokens"; export interface IPlaceholder extends ViewProps { /* An optional component that animates the placeholder */ Animation?: React.ComponentType; /* An optional component to display on the left */ Left?: React.ComponentType; /* An optional component to display on the right */ Right?: React.ComponentType; } export const Placeholder: React.FC = ({ children, style, Left, Right, Animation, ...props }) => { const AnimationProvider = Animation || Raw; return ( {Left && } {children} {Right && } ); }; const styles = StyleSheet.create({ full: { flex: 1 }, left: { marginRight: SIZES.normal }, right: { marginLeft: SIZES.normal }, row: { flexDirection: "row", width: "100%" } });