Last active
August 20, 2024 18:30
-
-
Save sayurimizuguchi/d19a046a94ee936ab2442f7cc1a7541d to your computer and use it in GitHub Desktop.
Text Component using react-i18next example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { Text, View, StyleSheet } from 'react-native'; | |
import { useTranslation } from 'react-i18next'; | |
type Props = { | |
keyText: String, | |
}; | |
export const TextComponent = ({ keyText, ...rest }: Props) => { | |
const { t } = useTranslation(); | |
return ( | |
<Text style={textStyle.text} {...rest}> | |
{t(keyText)} | |
</Text> | |
) | |
} | |
const textStyle = StyleSheet.create({ | |
text: { | |
fontSize: 20, | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment