Skip to content

Instantly share code, notes, and snippets.

@sayurimizuguchi
Last active August 20, 2024 18:30
Show Gist options
  • Save sayurimizuguchi/d19a046a94ee936ab2442f7cc1a7541d to your computer and use it in GitHub Desktop.
Save sayurimizuguchi/d19a046a94ee936ab2442f7cc1a7541d to your computer and use it in GitHub Desktop.
Text Component using react-i18next example
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