How to use the @emotion/native.Text 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 emotion-js / emotion / packages / native / types / tests.tsx View on Github external
export const ThemedView = styled.View`
  background-color: ${({ theme }) => theme.color.positive}; // ${({ bar }) =>
  bar}
`

const largeTextStyle: TextStyle = {
  fontSize: 24
}

const stretchImageStyle: ImageStyle = {
  resizeMode: 'stretch'
}

// for some reason, TypeScript is not complaining about the incorrect interpolated type
styled.Text(largeTextStyle, stretchImageStyle)
export const LargeText = styled.Text`
  ${largeTextStyle}
  // ${stretchImageStyle}
`

styled.Image(
  stretchImageStyle
  // this style will not align with the ImageStyle typing requirement
  // largeTextStyle
)
export const StretchedImage = styled.Image`
  ${stretchImageStyle};
`

export const ComposedView = styled.View`
  ${className} ${className2}
github storybookjs / storybook / addons / ondevice-knobs / src / types / Date.js View on Github external
import PropTypes from 'prop-types';
import React, { PureComponent } from 'react';
import { View } from 'react-native';
import DateTimePicker from 'react-native-modal-datetime-picker';
import styled from '@emotion/native';

const Touchable = styled.TouchableOpacity(({ theme }) => ({
  borderColor: theme.borderColor,
  borderWidth: 1,
  borderRadius: 2,
  padding: 5,
}));

const Label = styled.Text(({ theme }) => ({
  fontSize: 13,
  color: theme.labelColor,
}));

// TODO seconds support
class DateType extends PureComponent {
  constructor() {
    super();
    this.state = {
      isDateVisible: false,
      isTimeVisible: false,
    };
  }

  showDatePicker = () => {
    this.setState({ isDateVisible: true });
github storybookjs / storybook / app / react-native / src / preview / components / OnDeviceUI / navigation / button.tsx View on Github external
import React, { PureComponent } from 'react';
import { TouchableOpacity } from 'react-native';
import styled from '@emotion/native';

const ActiveBorder = styled.View<{ active: boolean }>(({ active, theme }) => ({
  backgroundColor: active ? theme.borderColor : 'transparent',
  height: 3,
}));

const ButtonText = styled.Text<{ active: boolean }>(({ theme, active }) => ({
  color: active ? theme.buttonActiveTextColor : theme.buttonTextColor,
  paddingHorizontal: 8,
  paddingVertical: 10,
  fontSize: 11,
}));

interface Props {
  id: number | string;
  active: boolean;
  onPress: (id: number | string) => void;
}

export default class Button extends PureComponent {
  onPress = () => {
    const { onPress, id } = this.props;
    onPress(id);
github storybookjs / storybook / app / react-native / src / preview / components / Shared / text.ts View on Github external
import styled from '@emotion/native';

export const Header = styled.Text<{ selected: boolean }>(
  ({ theme }) => ({
    fontSize: 20,
    color: theme.headerTextColor,
  }),
  ({ selected }) => (selected ? { fontWeight: 'bold' } : {})
);

export const Name = styled.Text<{ selected: boolean }>(
  ({ theme }) => ({
    fontSize: 16,
    color: theme.headerTextColor,
  }),
  ({ selected }) => (selected ? { fontWeight: 'bold' } : {})
);

export const Label = styled.Text(({ theme }) => ({
  fontSize: 18,
  color: theme.labelColor,
}));
github storybookjs / storybook / addons / ondevice-knobs / src / types / Button.js View on Github external
import PropTypes from 'prop-types';
import React from 'react';
import { TouchableOpacity } from 'react-native';
import styled from '@emotion/native';

const Label = styled.Text(({ theme }) => ({
  fontSize: 17,
  color: theme.labelColor,
}));

const ButtonType = ({ knob, onPress }) => (
   onPress(knob)}>
    <label>{knob.name}</label>
  
);

ButtonType.defaultProps = {
  knob: {},
};

ButtonType.propTypes = {
  knob: PropTypes.shape({
github storybookjs / storybook / addons / ondevice-jsx / src / components / index.tsx View on Github external
import React from 'react';
import { View, TouchableOpacity, Clipboard } from 'react-native';
import styled from '@emotion/native';

const Label = styled.Text(({ theme }) =&gt; ({
  color: theme.labelColor,
  fontSize: 12,
  letterSpacing: 1,
}));

interface Props {
  storySource: string;
}

export default class JSX extends React.PureComponent {
  onPressCopy = () =&gt; {
    const { storySource } = this.props;

    Clipboard.setString(storySource);
  };

@emotion/native

Style and render React Native components using emotion

MIT
Latest version published 2 years ago

Package Health Score

62 / 100
Full package analysis