Skip to content

Latest commit

 

History

History
450 lines (325 loc) · 9.05 KB

File metadata and controls

450 lines (325 loc) · 9.05 KB
theme background class highlighter lineNumbers info drawings css title
seriph
./images/main.jpg
text-center
shiki
false
## How to optimizate for react native app.
persist
unocss
How to optimizate React Native App

How to optimize performance for React Native App

Presenters: Khoa + Loc


Overview

  • React native is single-threaded.

JavaScript thread?

Conclusion:

  • Dont block JS thread
  • Keep higher UI frame rate (60 fps)

=> make a native look and feel to the apps.


Read more about Performance Overview


Rule Code Style

1. Remove all console.log statements

  • use lint code to detect all statements
  • use babel plugins to remove all statements from production such as babel-plugin-transform-remove-console
module.exports = function () {
  return {
    // ... other project config such as presets and plugins
    env: {
      production: {
        plugins: ["transform-remove-console"],
      },
    },
  }
}

Rule Code Style

2. Avoid use use of ScrollView to render huge lists

// bad
<ScrollView>
  {items.map(item => {
    return <Item key={item.id.toString()} name={item.name} />;
  })}
</ScrollView>
// good
<FlatList
  data={items}
  keyExtractor={item => `${items.id}`}
  renderItem={({ item }) => <Item name={item.name} />}
/>

Rule Code Style

3. Avoid arrow functions

// bad
function Todo() {
  function addTodo() {
    // ...
  }
  return <Pressable onPress={() => addTodo()} />
}
// good
function Todo() {
  function addTodo() {
    // ...
  }
  return <Pressable onPress={addTodo} />
}

Rule Code Style

1. Remove all console.log statements

Slidev is a slides maker and presenter designed for developers, consist of the following features

  • 📝 Text-based - focus on the content with Markdown, and then style them later
  • 🎨 Themable - theme can be shared and used with npm packages
  • 🧑‍💻 Developer Friendly - code highlighting, live coding with autocompletion
  • 🤹 Interactive - embedding Vue components to enhance your expressions
  • 🎥 Recording - built-in recording and camera view
  • 📤 Portable - export into PDF, PNGs, or even a hostable SPA
  • 🛠 Hackable - anything possible on a webpage


Read more about Why Slidev?


Navigation

Hover on the bottom-left corner to see the navigation's controls panel, learn more

Keyboard Shortcuts

right / space next animation or slide
left / shiftspace previous animation or slide
up previous slide
down next slide

Here!


layout: image-right image: https://source.unsplash.com/collection/94734566/1920x1080


Code

Use code snippets and get the highlighting directly!1

interface User {
  id: number
  firstName: string
  lastName: string
  role: string
}

function updateUser(id: number, update: User) {
  const user = getUser(id)
  const newUser = { ...user, ...update }
  saveUser(id, newUser)
}
<style> .footnotes-sep { @apply mt-20 opacity-10; } .footnotes { @apply text-sm opacity-75; } .footnote-backref { display: none; } </style>

Components

You can use Vue components directly inside your slides.

We have provided a few built-in components like <Tweet/> and <Youtube/> that you can use directly. And adding your custom components is also super easy.

<Counter :count="10" />

Check out the guides for more.

<Tweet id="1390115482657726468" />

class: px-20

Themes

Slidev comes with powerful theming support. Themes can provide styles, layouts, components, or even configurations for tools. Switching between themes by just one edit in your frontmatter:

---
theme: default
---
---
theme: seriph
---

Read more about How to use a theme and check out the Awesome Themes Gallery.


preload: false

Animations

Animations are powered by @vueuse/motion.

<div v-motion :initial="{ x: -80 }" :enter="{ x: 0 }">Slidev</div>
Slidev
<script setup lang="ts"> const final = { x: 0, y: 0, rotate: 0, scale: 1, transition: { type: 'spring', damping: 10, stiffness: 20, mass: 2 } } </script>

LaTeX

LaTeX is supported out-of-box powered by KaTeX.


Inline $\sqrt{3x-1}+(1+x)^2$

Block

$$ \begin{array}{c}

\nabla \times \vec{\mathbf{B}} -, \frac1c, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \

\nabla \times \vec{\mathbf{E}}, +, \frac1c, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \

\nabla \cdot \vec{\mathbf{B}} & = 0

\end{array} $$


Learn more


Diagrams

You can create diagrams / graphs from textual descriptions, directly in your Markdown.

sequenceDiagram
    Alice->John: Hello John, how are you?
    Note over Alice,John: A typical interaction
Loading
graph TD
B[Text] --> C{Decision}
C -->|One| D[Result 1]
C -->|Two| E[Result 2]
Loading
@startuml

package "Some Group" {
  HTTP - [First Component]
  [Another Component]
}

node "Other Groups" {
  FTP - [Second Component]
  [First Component] --> FTP
}

cloud {
  [Example 1]
}


database "MySql" {
  folder "This is my folder" {
    [Folder 3]
  }
  frame "Foo" {
    [Frame 4]
  }
}


[Another Component] --> [Example 1]
[Example 1] --> [Folder 3]
[Folder 3] --> [Frame 4]

@enduml

Learn More


layout: center class: text-center


Learn More

Documentations · GitHub · Showcases

Footnotes

  1. Learn More