3

Write React Native style in an easy way and restore the original design one to o...

 2 years ago
source link: https://reactnativeexample.com/write-react-native-style-in-an-easy-way-and-restore-the-original-design-one-to-one/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
StyleSheet

Write React Native style in an easy way and restore the original design one to one

Nov 20, 2021

1 min read

Tanjun

Write React Native style in an easy way and restore the original design one to one. Get size from designer and use it in your app.
Happy coding!

Installation

yarn add tanjun

Usage

import { TanjunProvider, View, Text } from 'tanjun'

const App = () => (
  <TanjunProvider
    // Your design size
    value={{
      width: 375,
      height: 812,
    }}>
    // The width and height or the font size are obtained from the design
    <View style={{ width: 200, height: 140 }}>
      <Text style={{ fontSize: 46 }}>Hello Tanjun </Text>
    </View>
  </TanjunProvider>
)

Advanced Usage

You can provide your own Image Text View implementations. Please move to example/src/my-own-proivder.tsx for more details.

License

GitHub

View Github


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK