GithubHelp home page GithubHelp logo

hectahertz / react-native-typography Goto Github PK

View Code? Open in Web Editor NEW
3.4K 31.0 105.0 4.24 MB

Pixel–perfect, native–looking typographic styles for React Native ✒️

License: MIT License

JavaScript 100.00%
react react-native typography typography-themes ios android

react-native-typography's Introduction

Hi there! 🤓

react-native-typography's People

Contributors

danielmschmidt avatar eduardinni avatar enagorny avatar evanbacon avatar hectahertz avatar ldevalliere avatar petetnt avatar timothystewart6 avatar vonovak avatar yilinjuang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-native-typography's Issues

Material styles doesn't match with the guidelines

I noticed that the styles used for material typography doesn't match with the guidelines and there is no option of "overline" typography.

What's the case? Are you guys fixing this or do I have to use something alternate??

Typescript Support

Hey @hectahertz,

Love the project, Currently the repo has no typed file for typescript imports. There is currently two ways this can be done, it included in your repo, or it to be added to the @types repo.

Is this something you would be interested adding or would you like help?

Thanks

Line height issue (Android vs iOS)

Hi, I have the following style:

class SettingsHomeScreen extends DrawerScreen {
  _onPress = () => {
    // pass
  };
  render() {
    return (
      <View style={styles.container}>
        <ScrollView>
          <View style={styles.card}>
            <View style={styles.card_container}>
              <Touchable onPress={this._onPress}>
                <View style={styles.group}>
                  <Text style={[ material.body2 ]}>Desconectarse</Text>
                </View>
              </Touchable>
            </View>
          </View>
        </ScrollView>
      </View>
    );
  }

I'm using Expo v23, I see the elements are being rendered different in iOS than Android, especially the vertical alignment of the texts. Are the line heights right? looks like the problem is related to them.

Please look these screenshots:

iOS (great):

screen shot 2017-12-13 at 16 53 27

Android (line height too high):

screen shot 2017-12-13 at 16 53 36

Include material typography adjustments for tall and dense scripts

Material Design has considerations for tall and dense scripts (perhaps Apple does too)

https://material.io/guidelines/style/typography.html

Twitter Lite has a typography component that adapts its style to the language of the text being rendered within the component. If this module were to include the material adjustments for tall and dense scripts, people could create their AppText/Typography component to automatically select the preferred text weight/size/line-height for a given language.

Republish example with update to Expo

Sorry if this is trivial but I thought you should know. The online example on Expo refuses to render since the project was published using an older version of Expo CLI which is no longer supported. (All Expo users have probably run into this at some point).

The message is:

This project needs an update
This project uses Expo SDK v31.0.0. If you want to open this project, the author will need to update the project's SDK version.

Add support for web

I think this could be really useful for people building web apps with React Native (e.g., using react-native-web). Web apps built with RNW will default the OS system font, but may want to switch between human/material depending on the platform the browser runs on. Do you any questions or thoughts about how to support web?

styled-components expect lineHeight to contain units

I'm trying to use the library with styled-components as mentioned in this example.

The problem is that styled expect the lineHeight to contain units, but there is none. As we can see, for example, human.title1Object:

Object {
  "backgroundColor": "transparent",
  "color": "#000000",
  "fontFamily": "System",
  "fontSize": 28,
  "fontWeight": "400",
  "letterSpacing": 0.355469,
  "lineHeight": 34,
}

If I use the object like this:

export const Title1 = styled(props => <Text {...props} />)`
  ${human.title1Object};
`;

I get this:
86185357_210672296735122_7868388049141366784_n

Should I hack the library and add a unit to the object by myself or I'm missing something?

Thanks 👋

Consider including Platform styles on same Text component

Have you considered being able to have one Text component with arbitrary iOS and Android styles?

Something like:

<Text style={[human.largeTitle, material.display2]}>Hello Typography!</Text>

Then pick the style based on Platform.

Material typography V2

Material design has updated its typography definitions.

any plans to mirror that in this library?

systemWeight black

I was wondering why the systemWeight black is not exported here ?

Is it because it's not available in android ? how about a fallout to bold in case of android ?

Scaling font sizes for bigger screens

Hi there,

First thanks for this awesome lib! It has helped me a lot. One question, though:

Shouldn't it be responsible for scaling for smaller/bigger screen sizes? This is almost required when dealing with Android and even more when dealing with tablets.

Thanks!

iOSUIKit will cut the bottom of Text if contains Chinese characters

The bottom of texts seem to be cut out on Android using iOSUIKit if the texts contain Chinese characters. You may refer to the part A of the screenshot.

I have also tested out with different line heights to get workaround. You may refer to part B for the result.

Environment

  • One plus 6T / Android 9
  • react-native: 0.59.5
  • react-native-typography: 1.4.0

Here is my code for the screenshot.

          <View style={{ marginBottom: 20 }}>
            {/* Part A */}
            <Text style={{ color: '#000' }}>{'Android使用\nnone style (Mg排版)'}</Text>
            <Text style={[material.title]}>{'Android使用\nmaterial.title (Mg排版)'}</Text>
            <Text style={[iOSUIKit.title3, {  }]}>{'Android使用\niOSUIKit.title3 (Mg排版)'}</Text>
            <Text style={[iOSUIKit.body, {  }]}>{'Android使用\niOSUIKit.body (Mg排版)'}</Text>
            <Text style={[iOSUIKit.callout, {  }]}>{'Android使用\niOSUIKit.callout (Mg排版)'}</Text>
            <Text style={[iOSUIKit.subhead, {  }]}>{'Android使用\niOSUIKit.subhead (Mg排版)'}</Text>
            <Text style={[iOSUIKit.footnote, {  }]}>{'Android使用\niOSUIKit.footnote (Mg排版)'}</Text>
            <Text style={[iOSUIKit.caption2, {  }]}>{'Android使用\niOSUIKit.caption2 (Mg排版)'}</Text>
          </View>
          <View>
            {/* Part B */}
            <Text style={{ color: '#000' }}>{'Android使用\nnone style (Mg排版)'}</Text>
            <Text style={[material.title]}>{'Android使用\nmaterial.title (Mg排版)'}</Text>
            <Text style={[iOSUIKit.title3, { lineHeight: iOSUIKit.title3.lineHeight + 2 }]}>{'Android使用\niOSUIKit.title3 (Mg排版)'}</Text>
            <Text style={[iOSUIKit.body, { lineHeight: iOSUIKit.body.lineHeight + 1 }]}>{'Android使用\niOSUIKit.body (Mg排版)'}</Text>
            <Text style={[iOSUIKit.callout, { lineHeight: iOSUIKit.callout.lineHeight + 1 }]}>{'Android使用\niOSUIKit.callout (Mg排版)'}</Text>
            <Text style={[iOSUIKit.subhead, { lineHeight: iOSUIKit.subhead.lineHeight + 1 }]}>{'Android使用\niOSUIKit.subhead (Mg排版)'}</Text>
            <Text style={[iOSUIKit.footnote, { lineHeight: iOSUIKit.footnote.lineHeight + 1 }]}>{'Android使用\niOSUIKit.footnote (Mg排版)'}</Text>
            <Text style={[iOSUIKit.caption2, { lineHeight: iOSUIKit.caption2.lineHeight + 2 }]}>{'Android使用\niOSUIKit.caption2 (Mg排版)'}</Text>
          </View>

Screenshot_20190429-105823

Add windows support

I am trying to get this library working for react-native-windows and ran into a similar problem as the react-native-web issure where systemWeights was undefined. I got the library working by making a systemDenseWeights.windows.js, systemTallWeights.windows.js, and systemWeights.windows.js files. Is this the best ways to do this or is there another way the can be done to default the imports when Platform.OS is unknown?

Dark Mode support

Hi,

I never used your lib yet, but very interested to (as I was starting to do a similar thing).
One thing I noticed is that I don't see dark colors (eg: iOS Colors have light & dark values, which are different, same for grey, see https://developer.apple.com/design/human-interface-guidelines/ios/visual-design/color/)

Is there any plan to handle that? Might be a bit breaking change for color as the api should change (or we could add new api & keep legacy one for backward compat).

Missing types for dense and tall

Types of collections mentioned here are missing. For instance,

export var systemDenseWeights: {
  thin: TextStyle;
  light: TextStyle;
  regular: TextStyle;
  semibold: TextStyle;
  bold: TextStyle;
};

Add react-native-web to the example app

The example folder of this repo contains an Expo app with examples for both iOS and Android, but there's nothing for web yet.

For now I'm just using this fork of a boilerplate for quick manual testing, but it's not a great long term solution.

An option would be to fully transform the example app into something similar to the boilerplate but we lose the possibility of deploying it to expo which I find very useful.

Another option would be to just share the components and screens and have two separate apps, this would probably fit this use case better.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.