How to use the @emotion/native function in @emotion/native

To help you get started, we’ve selected a few @emotion/native examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github echobind / react-native-template / template / src / components / TextInput / TextInput.tsx View on Github external
* Overrides the text that's read by the screen reader when the user interacts with the element. By default, the
  * label is constructed by traversing all the children and accumulating all the Text nodes separated by space.
  */
   accessibilityLabel?: string;
}

type ComponentProps = TextInputProps &
  ColorProps &
  SpaceProps &
  TextStyleProps &
  TypographyProps &
  BorderProps &
  LayoutProps &
  FlexProps;

const InputContainer = styled(Container)``;

const Input = styled.TextInput`
  ${flex};
  ${borders};
  ${color};
  ${layout};
  ${space};
  ${textStyle};
  ${typography};
`;

// NOTE: for layout and dimensioning of TextInput, wrap it in a Container
export const TextInput: FC = ({
  topLabel,
  icon,
  accessibilityLabel,
github emotion-js / emotion / packages / native / types / tests.tsx View on Github external
positive: 'green'
  }
}

export const themed = 
export const composed = 

function MyComponent(_props: AdditionalProps) {
  return null
}

function MyOtherComponent(_props: { foo: string }) {
  return null
}

styled(MyComponent)({ width: 100 })
styled(MyComponent)({ width: 100 }).withComponent(MyOtherComponent)
styled(MyComponent)(({ bar }) => ({ color: bar }))
styled(View)({ width: 100 })
styled(View)(({ foo, testID }) => ({ color: foo, testID }))

const styles = {
  container: css({ flex: 1 }),
  scrollContainer: css`
    flex-grow: 1;
    align-items: center;
  `,
  centered: css`
    justify-content: center;
    align-items: center;
  `
}
github emotion-js / emotion / packages / native / types / tests.tsx View on Github external
export const ComposedView = styled.View`
  ${className} ${className2}
  background-color: white;
`

export const NestedComposedView = styled.View(css`
  ${className} ${className2}
  background-color: white;
`)

function MyStyledComponent(_props: { style?: StyleProp }) {
  return null
}

styled(MyStyledComponent)(stretchImageStyle)

const theme = {
  color: {
    primary: 'blue',
    negative: 'red',
    positive: 'green'
  }
}

export const themed = 
export const composed = 

function MyComponent(_props: AdditionalProps) {
  return null
}
github echobind / react-native-template / template / src / components / Text / component.tsx View on Github external
import React, { SFC } from 'react';
import styled from '@emotion/native';
import { Text as RNText, TextProperties, TextStyle } from 'react-native';
import { fonts, colors } from '../../styles';

const StyledText = styled(RNText)`
  ${fonts.regular};
  color: ${colors.black}
  font-size: 15px;
`;

export interface Props extends TextProperties {
  /** Children components */
  children?: React.ReactNode;
  /** The text to display if not using children components. */
  text?: string;
  /** Style override */
  style?: TextStyle;
}

/**
 * Text component that wraps the built-in React Native Text
github echobind / react-native-template / template / src / screens / IntroScreen / component.tsx View on Github external
import React, { Component } from 'react';
import { ImageBackground, StatusBar, StyleSheet, View, ViewStyle } from 'react-native';
import bgImage from '../../assets/images/background.png';
import { Screen } from '../../components/Screen';
import { Text } from '../../components/Text';
import { colors } from '../../styles';

const Background = styled(ImageBackground)`
  ${StyleSheet.absoluteFillObject};
`;

interface Props {
  style?: ViewStyle;
}

const StyledScreen = styled(Screen)`
  align-items: center;
  margin-top: 60px;
`;

const StyledText = styled(Text)`
  color: ${colors.white};
  font-size: 24px;
`;

/**
 * First screen a logged out user sees, welcoming them to the app.
 */
export class IntroScreen extends Component {
  public render() {
    return (
github storybookjs / storybook / app / react-native / src / preview / components / OnDeviceUI / panel.tsx View on Github external
import React, { PureComponent } from 'react';
import { StyleSheet, Animated } from 'react-native';
import styled from '@emotion/native';

const Container = styled(Animated.View)(({ theme }) => ({
  backgroundColor: theme.backgroundColor,
}));

interface Props {
  style: any[];
}

export default class Panel extends PureComponent {
  render() {
    const { children, style } = this.props;
    return {children};
  }
}
github echobind / react-native-template / template / src / screens / IntroScreen / component.tsx View on Github external
import styled from '@emotion/native';
import React, { Component } from 'react';
import { ImageBackground, StatusBar, StyleSheet, View, ViewStyle } from 'react-native';
import bgImage from '../../assets/images/background.png';
import { Screen } from '../../components/Screen';
import { Text } from '../../components/Text';
import { colors } from '../../styles';

const Background = styled(ImageBackground)`
  ${StyleSheet.absoluteFillObject};
`;

interface Props {
  style?: ViewStyle;
}

const StyledScreen = styled(Screen)`
  align-items: center;
  margin-top: 60px;
`;

const StyledText = styled(Text)`
  color: ${colors.white};
  font-size: 24px;
`;
github echobind / react-native-template / template / src / screens / IntroScreen / IntroScreen.tsx View on Github external
import React from 'react';
import { ImageBackground, StatusBar, StyleSheet } from 'react-native';
import { NavigationScreenProps } from 'react-navigation';
import styled from '@emotion/native';

import { Button } from '../../components/Button';
import { Screen } from '../../components/Screen';
import { Text } from '../../components/Text';
import { Container } from '../../components/Container';
import { colors } from '../../styles';
import bgImage from '../../assets/images/background.png';

const BackgroundImage = styled(ImageBackground)`
  ${StyleSheet.absoluteFillObject};
`;

/**
 * First screen a logged out user sees, welcoming them to the app.
 */
export function IntroScreen(props: NavigationScreenProps) {
  return (
github echobind / react-native-template / template / src / screens / IntroScreen / component.tsx View on Github external
import { colors } from '../../styles';

const Background = styled(ImageBackground)`
  ${StyleSheet.absoluteFillObject};
`;

interface Props {
  style?: ViewStyle;
}

const StyledScreen = styled(Screen)`
  align-items: center;
  margin-top: 60px;
`;

const StyledText = styled(Text)`
  color: ${colors.white};
  font-size: 24px;
`;

/**
 * First screen a logged out user sees, welcoming them to the app.
 */
export class IntroScreen extends Component {
  public render() {
    return (
      
        
        
          Welcome to the intro Screen!
github echobind / react-native-template / template / src / components / Screen / component.tsx View on Github external
import styled from '@emotion/native';
import React, { ReactNode, SFC } from 'react';
import { SafeAreaView, ViewStyle } from 'react-native';

import { colors, margins } from '../../styles';

/**
 * A base screen component that allows for background-color to be specified
 */

const SafeView = styled(SafeAreaView)`
  flex: 1;
  background-color: ${props => props.backgroundColor || colors.white};
`;

const PaddedView = styled.View`
  padding-horizontal: ${`${margins.screenMargin}px`};
`;

interface ScreenProps {
  /** the background color of the screen */
  backgroundColor?: string;
  /** main part of the screen */
  children?: ReactNode;
  /** view styles to override the base */
  style?: ViewStyle;
}

@emotion/native

Style and render React Native components using emotion

MIT
Latest version published 1 year ago

Package Health Score

68 / 100
Full package analysis