Skip to content

Instantly share code, notes, and snippets.

View jasurkurbanov's full-sized avatar
💭
Focusing...

Jasur Kurbanov jasurkurbanov

💭
Focusing...
View GitHub Profile
@jasurkurbanov
jasurkurbanov / App.js
Last active July 22, 2020 04:25
For Custom Text Component Tutorial
import * as React from 'react';
import { Text, View, StyleSheet } from 'react-native';
export default function App() {
return (
<View style={styles.container}>
<Text style={styles.h1}>Heading 1</Text>
<Text style={styles.h2}>Heading 2</Text>
<Text style={styles.h3}>Heading 3</Text>
<Text style={styles.h4}>Heading 4</Text>
@jasurkurbanov
jasurkurbanov / expo-project
Last active July 22, 2020 04:27
Create New Expo Project
expo init MyApp
cd MyApp
expo start # you can also use: npm start
import * as React from 'react';
import { Text } from 'react-native';
const MyText = ()=> {
return (
<Text>Custom Component</Text>
);
};
export { MyText }
@jasurkurbanov
jasurkurbanov / index.js
Last active July 22, 2020 07:31
MyText-index.js 2
import * as React from 'react';
import { Text } from 'react-native';
const MyText = ({ h1, h2, h3, h4, h5, p, bold, italic, title, style, ...rest })=> {
return (
<Text>{title}</Text>
);
};
export { MyText }
@jasurkurbanov
jasurkurbanov / index.js
Last active July 22, 2020 07:30
MyText-index.js 3
import * as React from 'react';
import { Text } from 'react-native';
const MyText = ({ h1, h2, h3, h4, h5, p, bold, italic, title, style, ...rest })=> {
return (
<Text style={[
h1 && { fontSize: 48 },
h2 && { fontSize: 32 },
h3 && { fontSize: 20 },
h4 && { fontSize: 18 },
@jasurkurbanov
jasurkurbanov / App.js
Created July 22, 2020 07:32
Custom Text Component Tutorial
import React from 'react';
import { StyleSheet, View } from 'react-native';
import { MyText } from './src/components/MyText'
export default function App() {
return (
<View style={styles.container}>
<MyText title={'Header 1'} h1/>
<MyText title={'Header 1'} h2/>
import { PixelRatio, Dimensions} from 'react-native';
const pixelRatio = PixelRatio.get();
const deviceHeight = Dimensions.get('window').height;
const deviceWidth = Dimensions.get('window').width;
const adjust = (size) => {
if (pixelRatio >= 2 && pixelRatio < 3) {
// iphone 5s and older Androids
@jasurkurbanov
jasurkurbanov / index.md
Last active July 22, 2020 14:43
MyText-index.js adjust added
require 'redcarpet'
markdown = Redcarpet.new("Hello World!")
puts markdown.to_html

const MyText = ({ h1, h2, h3, h4, h5, p, bold, italic, title, style, ...rest })=> { Marked text This text will be italic this text will be bold return (

import * as React from 'react'; import { Text } from 'react-native'; import adjust from "../../adjust";

const MyText = ({ h1, h2, h3, h4, h5, p, bold, italic, title, style, ...rest })=> { return ( <Text style={[ h1 && { fontSize: adjust(48) }, h2 && { fontSize: adjust(32) }, h3 && { fontSize: adjust(20) },