Open Nor01 opened 7 months ago
no solution?
same
Can using text2NumberOfLines = 0, or text1NumberOfLines = 0, then it wraps perfectly for me.
I tested your code,no working for me
@zkteco-home Apply text1NumberOfLines
in toastConfig
, as shown at https://github.com/calintamas/react-native-toast-message/blob/HEAD/docs/custom-layouts.md#create-custom-layouts.
The following works for me using "react-native-toast-message": "^2.2.0"
. Ensure you apply to whichever layout types are in use, the below is with the error
type:
error: (props) => (
<ErrorToast
{...props}
text1Style={{
fontSize: 12,
fontWeight: '300'
}}
text1NumberOfLines={0}
/>
Has anyone actually resolved this yet? Can I create a pr otherwise @calintamas?
I thought the toast would fit the height of content? Instead it overflows toast if I use the numberOfLines
prop:
info: (props: ToastOptions) => {
const styles = toastStyles();
return (
<BaseToast
{...props}
contentContainerStyle={{ paddingHorizontal: 15 }}
renderLeadingIcon={() => (
<View style={styles.icon}>
<InfoIcon {...hW} color={styles.info.borderLeftColor} />
</View>
)}
style={styles.info}
text1NumberOfLines={1}
text1Style={styles.text1}
text2NumberOfLines={3} // 0 also overflows
text2Style={styles.text2}
/>
);
},
Increase container height for toast message to avoid text truncation
Steps to reproduce create an utility function to use Toast library:
Then you can render the component in you app.tsx:
You can create a basic function to call the toast notification example:
Following this other issues reported:
Issue #474 and #339
It seems that attempting to override styling through the
style
prop from BaseToastProps is not yielding the expected results. Despite our efforts, none of the styles are being applied or taking effect. On the bright side, thetext1Style
andtext2Style
props are functioning as anticipated.Additionally, when delving into the
node_modules/react-native-toast-message/lib/src/components/BaseToast.styles.js
file, it's possible to adjust the height. However, even after increasing the height, the text remains truncated.Environment (please complete the following information):
Additional context I have tried to override from utility function the
base
item styles fromstyle
prop in BaseToast.styles.js for example:This is not taking effect.