Skip to content

Instantly share code, notes, and snippets.

View bpoulaindev's full-sized avatar
:electron:
Crafting nice UIs

Baptiste Poulain bpoulaindev

:electron:
Crafting nice UIs
  • Lille, France
  • 11:52 (UTC +02:00)
View GitHub Profile
@gchumillas
gchumillas / AppText.tsx
Last active November 14, 2023 20:12
React Native: how to extend Text component (the "hook" and the "class" way).
import React from 'react'
import { Text, TextProps } from 'react-native'
// The "hook" way.
// The `React.PropsWithChildren` type adds the `children` property to the `TextProps` type.
const AppText1 = ({ children, style, ...rest }: React.PropsWithChildren<TextProps>) => (
<Text style={[{ fontFamily: 'monospace' }, style]} {...rest}>
{children}
</Text>
)