From 225e035cb797bfe0b3eb43a3740a5cef6dfd110e Mon Sep 17 00:00:00 2001 From: Myroslav Hryschenko Date: Fri, 27 Oct 2023 17:24:23 +0300 Subject: [PATCH 1/4] style(text-props): :memo: added section with contributors and added new props to table documentation --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7a07946..006f7f5 100644 --- a/README.md +++ b/README.md @@ -88,7 +88,8 @@ const styles = StyleSheet.create({ | colors | string[] | **Required** | An array of at least two color values that represent gradient colors. Example: `colors={["black", "white"]}`. | | start | { x: number, y: number } | { x: 0.5, y: 0 } | An optional prop. He declare the position that the gradient starts. Example `start={{ x: 0.5, y: 0 }}`. | | end | { x: number, y: number } | { x: 1, y: 1 } | Same as start, but for the of the gradient. | -| textStyle | [TextStyle](https://reactnative.dev/docs/text-style-props) | Default Value | A property to change all styles that a text has. | +| textStyle | [TextStyle](https://reactnative.dev/docs/text-style-props) | Default Value | A property to change all styles that a text has. +| textProps | [TextProps](https://reactnative.dev/docs/text-style-props#props) | Default Value | A property to apply native props to text. | --- @@ -103,6 +104,10 @@ const styles = StyleSheet.create({ --- +## Contributors + + +- [](https://github.com/BLOCKMATERIAL) [MATERIALBLOCK](https://github.com/BLOCKMATERIAL) ## License This project is under the MIT license. See the [LICENSE](./LICENSE) to learn more. From cefc5a4d56c9be6de87da2b75552177e93ebe387 Mon Sep 17 00:00:00 2001 From: Myroslav Hryschenko Date: Fri, 27 Oct 2023 17:27:31 +0300 Subject: [PATCH 2/4] feat(text-props): :sparkles: added textProps to native component for example customer can pass role/ellipsizeMode to Text and configutated it --- src/components/LinearGradientText.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/LinearGradientText.tsx b/src/components/LinearGradientText.tsx index 2d40f46..d9b6bb2 100644 --- a/src/components/LinearGradientText.tsx +++ b/src/components/LinearGradientText.tsx @@ -2,23 +2,26 @@ import React, { FC } from 'react'; import { Text, TextStyle, StyleSheet } from 'react-native'; import MaskedView from '@react-native-masked-view/masked-view'; import LinearGradient from 'react-native-linear-gradient'; +import { TextProps } from 'react-native'; interface Props { text: string; textStyle?: TextStyle; + textProps?: TextProps; colors: string[]; start?: { x: number; y: number }; end?: { x: number; y: number }; } export const LinearGradientText: FC = (props) => { - const { text, textStyle = {}, colors, start = { x: 0, y: 1 }, end = { x: 1, y: 1 } } = props; + const { text, textStyle = {}, textProps={}, colors, start = { x: 0, y: 1 }, end = { x: 1, y: 1 } } = props; return ( {text}}> - {text} - + + {text} + ); }; From bcc1794561f963660b437294858773b90c221a84 Mon Sep 17 00:00:00 2001 From: Myroslav Hryschenko Date: Fri, 27 Oct 2023 17:43:24 +0300 Subject: [PATCH 3/4] fix(text-props): :art: added example and code formatting --- example/src/App.tsx | 12 +++++++++++- src/components/LinearGradientText.tsx | 3 ++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/example/src/App.tsx b/example/src/App.tsx index eb3f441..e3c66b3 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -1,15 +1,23 @@ import React from 'react'; -import { StyleSheet, View } from 'react-native'; +import {StyleSheet, View } from 'react-native'; import { LinearGradientText } from 'react-native-linear-gradient-text'; export default function App() { + return ( + ); @@ -19,7 +27,9 @@ const styles = StyleSheet.create({ container: { flex: 1, alignItems: 'center', + rowGap: 20, justifyContent: 'center', + marginHorizontal: 100, backgroundColor: '#ffffff', }, }); diff --git a/src/components/LinearGradientText.tsx b/src/components/LinearGradientText.tsx index d9b6bb2..b737742 100644 --- a/src/components/LinearGradientText.tsx +++ b/src/components/LinearGradientText.tsx @@ -21,7 +21,8 @@ export const LinearGradientText: FC = (props) => { {text} - + + ); }; From 5964c6992597f9a8532a52619b39235a3e42c34c Mon Sep 17 00:00:00 2001 From: Myroslav Hryschenko Date: Fri, 27 Oct 2023 17:53:59 +0300 Subject: [PATCH 4/4] fix(text-props): :lipstick: added code example --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 006f7f5..b322631 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,7 @@ export const App = () => { start={{ x: 0.5, y: 0 }} end={{ x: 1, y: 1 }} textStyle={{ fontSize: 40 }} + textProps={{allowFontScaling: true}} // Optional /> );