react-native-toast-message icon indicating copy to clipboard operation
react-native-toast-message copied to clipboard

text1NumberOfLines props not working

Open RushirajJhala opened this issue 3 years ago • 6 comments
trafficstars

text1NumberOfLines props not working , it always shows 1 only line

RushirajJhala avatar Mar 25 '22 06:03 RushirajJhala

i'm also facing this issue, i tried below still not working

const toastConfig = { info: (props) => ( <BaseToast {...props} style={{ height: 100 }} contentContainerStyle={{}} text2Style={{ numberOfLines: 2, }} /> ), };

RaguRam1991 avatar Apr 25 '22 12:04 RaguRam1991

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-toast-message/lib/src/components/BaseToast.styles.js b/node_modules/react-native-toast-message/lib/src/components/BaseToast.styles.js
index 105748b..5440cea 100644
--- a/node_modules/react-native-toast-message/lib/src/components/BaseToast.styles.js
+++ b/node_modules/react-native-toast-message/lib/src/components/BaseToast.styles.js
@@ -5,7 +5,7 @@ export const BORDER_RADIUS = 6;
 export const styles = StyleSheet.create({
     base: {
         flexDirection: 'row',
-        height: HEIGHT,
+        minHeight: HEIGHT,
         width: WIDTH,
         borderRadius: BORDER_RADIUS,
         shadowOffset: { width: 0, height: 0 },

jimkhan avatar May 17 '22 08:05 jimkhan

Hi, to me it wasn't enough using @jimkhan's approach. Besides changing the height to minHeight, I also changed had to change the following file node_modules/react-native-toast-message/lib/src/components/BaseToast.js:

  • from default value text1NumberOfLines = 1 to text1NumberOfLines = 5
  • removed the setter for the ellipsizeMode='tail' property.

Hope it helps 👍

mganchas avatar May 17 '22 15:05 mganchas

I found it works to use text1NumberOfLines = 0 like the docs said, then it wraps perfectly for me.

NickWhiu avatar Jul 31 '22 10:07 NickWhiu

This is still not fixed

hussain992 avatar Nov 06 '23 01:11 hussain992